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.|
|Dispose||Releases the resources used by this .|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (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.)|
Use this class to work with an X.509 store.
This type implements the IDisposable interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Dispose method in a try/catch block. To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). For more information, see the “Using an Object that Implements IDisposable” section in the IDisposable interface topic.
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.