| Visual Basic (Declaration) | |
|---|---|
Public Enum CertificateStoreName Inherits System.Enum | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As CertificateStoreName | |
| C# | |
|---|---|
public enum CertificateStoreName : System.Enum | |
| Managed Extensions for C++ | |
|---|---|
__value public enum CertificateStoreName : public System.Enum | |
| C++/CLI | |
|---|---|
public enum class CertificateStoreName : public System.Enum | |
| Member | Description |
|---|---|
| Acrs | The name for Automatic Certificate Request Service certificate stores. |
| AddressBook | The name of the certificate store holding "Other People". These certificates usually include a public key but no private key, and are used to encrypt outgoing messages. |
| CA | The name used for Intermediate Certification Authorities". |
| Disallowed | The name used for "Untrusted Certificates". |
| Efs | The name for Windows encrypting file systems certificate stores. |
| My | The name used for "Personal Certificates". These certificates usually include a public key (that is exported) and a private key that is used to decrypt received messages. |
| NtAuth | The name for NT authentication certificate stores. |
| Request | The name for pending certificate request stores. |
| Root | The name used for "Trusted Root Certification Authorities". |
| Spc | The name for software publisher's certificate stores. |
| Trust | The name used for "Enterprise Trust". |
| TrustedPeople | The name used for "Trusted People". |
| TrustedPublisher | The name used for "Trusted Publishers". |
The following example demonstrates accessing a certificate and displaying info about it.
| Visual Basic | Copy Code |
|---|---|
Private Sub DisplayCertificateInfo(ByVal certNum as Integer) ' Create a new CertificateStore to access the "MY" certificate store Dim store as new CertificateStore(CertificateStoreLocation.LocalMachine, CertificateStoreName.My) Try ' Get the requested certificate Dim cert as Certificate = store(certNum) ' Display info about the certificate Dim msg as String msg+= "The following information about the certificate is available." + vbCrLF + vbCrLf msg+= "Name: " + cert.Name + vbCrLf msg+= "Description: " + cert.Description + vbCrLf msg+= "Expires: " + cert.ExpirationDate + vbCrLf msg+= "Issued: " + cert.IssueDate + vbCrLf msg+= "Issues to: " + cert.IssuedTo + vbCrLf msg+= "Serial number: " + cert.SerialNumber + vbCrLf msg+= "Version: " + cert.Versio MessageBox.Show(msg) Catch ex as Exception MessageBox.Show("Error. No certificate found at index " + certNum) End Try End Sub | |
| C# | Copy Code |
|---|---|
private void DisplayCertificateInfo(int certNum) { // Create a new CertificateStore to access the "MY" certificate store CertificateStore store = new CertificateStore(CertificateStoreLocation.LocalMachine, CertificateStoreName.My); try { // Get the requested certificate Certificate cert = store[certNum]; // Display info about the certificate string msg = ""; msg+= "The following information about the certificate is available.\r\n\r\n"; msg+= "Name: " + cert.Name + "\r\n"; msg+= "Description: " + cert.Description + "\r\n"; msg+= "Expires: " + cert.ExpirationDate + "\r\n"; msg+= "Issued: " + cert.IssueDate + "\r\n"; msg+= "Issues to: " + cert.IssuedTo + "\r\n"; msg+= "Serial number: " + cert.SerialNumber + "\r\n"; msg+= "Version: " + cert.Version; MessageBox.Show(msg); } catch(Exception ex) { MessageBox.Show("Error. No certificate found at index " + certNum); } } | |
A certificate store is a location on the system (memory, disk, registry, etc.) where certificates are stored for use. Although there are many certificate stores, there are two commonly used system stores.
- MY - personal certificates go here
- ROOT - certificates for Trusted Root Certificate Authorities
System.Object
System.ValueType
System.Enum
Dart.PowerTCP.Mail.CertificateStoreName
Target Platforms: Microsoft .NET Framework 2.0