(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).
#include <CkCertStore.h>
#include <CkCert.h>
void ChilkatSample(void)
{
// This is a Windows-only example because it lists the certificates
// stored in the Windows Current User Certificate Store located in the
// Windows Registry.
CkCertStore certStore;
bool readOnly = true;
bool success = certStore.OpenCurrentUserStore(readOnly);
if (success == false) {
std::cout << certStore.lastErrorText() << "\r\n";
return;
}
int numCerts = certStore.get_NumCertificates();
int i = 0;
while (i < numCerts) {
CkCert *cert = certStore.GetCertificate(i);
std::cout << "DN = " << cert->subjectDN() << "\r\n";
std::cout << "Email = " << cert->subjectE() << "\r\n";
i = i + 1;
}
}
|