(Unicode 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 <CkCertStoreW.h>
#include <CkCertW.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.
CkCertStoreW certStore;
bool readOnly = true;
bool success = certStore.OpenCurrentUserStore(readOnly);
if (success == false) {
wprintf(L"%s\n",certStore.lastErrorText());
return;
}
int numCerts = certStore.get_NumCertificates();
int i = 0;
while (i < numCerts) {
CkCertW *cert = certStore.GetCertificate(i);
wprintf(L"DN = %s\n",cert->subjectDN());
wprintf(L"Email = %s\n",cert->subjectE());
i = i + 1;
}
}
|