(.NET Core C#) List Certificates in the Current User Certificate Store (Windows Only)
This is a Windows-only example to list the certificates in the current-user certificate store (located in the Windows Registry).
// This is a Windows-only example because it lists the certificates
// stored in the Windows Current User Certificate Store located in the
// Windows Registry.
Chilkat.CertStore certStore = new Chilkat.CertStore();
bool readOnly = true;
bool success = certStore.OpenCurrentUserStore(readOnly);
if (success == false) {
Debug.WriteLine(certStore.LastErrorText);
return;
}
int numCerts = certStore.NumCertificates;
int i = 0;
while (i < numCerts) {
Chilkat.Cert cert = certStore.GetCertificate(i);
Debug.WriteLine("DN = " + cert.SubjectDN);
Debug.WriteLine("Email = " + cert.SubjectE);
i = i + 1;
}
|