Unicode C++
Unicode C++
Apple Keychain - List Certificates
See more Apple Keychain Examples
Iterates over the certificates in the Apple Keychain.Chilkat Unicode C++ Downloads
#include <CkCertStoreW.h>
#include <CkCertW.h>
void ChilkatSample(void)
{
bool success = false;
CkCertStoreW certStore;
// On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
// The argument passed to OpenCurrentUserStore is ignored.
success = certStore.OpenCurrentUserStore(false);
if (success == false) {
wprintf(L"%s\n",certStore.lastErrorText());
return;
}
int numCerts = certStore.get_NumCertificates();
wprintf(L"numCerts = %d\n",numCerts);
CkCertW cert;
int i = 0;
while (i < numCerts) {
certStore.GetCert(i,cert);
wprintf(L"%s\n",cert.subjectDN());
wprintf(L"%s\n",cert.subjectCN());
wprintf(L"%s\n",cert.serialNumber());
wprintf(L"----\n");
i = i + 1;
}
certStore.CloseCertStore();
}