Represents an X.509 store, which is a physical store where certificates are persisted and managed. This class cannot be inherited.
Assembly: System (in System.dll)
Thetype exposes the following members.
|X509Store()||Initializes a new instance of the class using the personal certificates of the current user store.|
|X509Store(IntPtr)||Initializes a new instance of the class using an Intptr handle to an HCERTSTORE store.|
|X509Store(StoreLocation)||Initializes a new instance of the class using the specified StoreLocation value.|
|X509Store(StoreName)||Initializes a new instance of the class using the specified StoreName value.|
|X509Store(String)||Initializes a new instance of the class using the specified store name.|
|X509Store(StoreName, StoreLocation)||Initializes a new instance of the class using the specified StoreName and StoreLocation values.|
|X509Store(String, StoreLocation)||Initializes a new instance of the class using a string that represents a value from the StoreName enumeration and a value from the StoreLocation enumeration.|
|Add||Adds a certificate to an X.509 certificate store.|
|AddRange||Adds a collection of certificates to an X.509 certificate store.|
|Close||Closes an X.509 certificate store.|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|Open||Opens an X.509 certificate store or creates a new store, depending on OpenFlags flag settings.|
|Remove||Removes a certificate from an X.509 certificate store.|
|RemoveRange||Removes a range of certificates from an X.509 certificate store.|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
This section contains two examples. The first example demonstrates how you can open standard X.509 stores and list the number of certificates in each.
The second example demonstrates how you can add and remove single certificates and ranges of certificates.
This example tries to open each standard store in each standard location on the current computer. It prints a summary that shows whether each store exists and, if so, the number of certificates it contains.
The example creates an object for each combination of standard name and standard location. It calls the Open method with the OpenFlags.OpenExistingOnly flag, which opens the physical store only if it already exists. If the physical store exists, the example uses the Name, Location, and Certificates properties to display the number of certificates in the store.
This example opens an X.509 certificate store, adds and deletes certificates, and then closes the store. It assumes that you have three certificates to add to and remove from a local store.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.