(Unicode C) Load DER encoded X.509 Certificate (.cer, .crt)
Loads a digital certificate from a binary DER encoded X.509 Certificate (.cer, .crt) and fetches information about the cert.
#include <C_CkCertW.h>
void ChilkatSample(void)
{
HCkCertW cert;
BOOL success;
cert = CkCertW_Create();
// LoadFromFile will load virtually any certificate format file.
// It will auto-recognize the format and load appropiately.
success = CkCertW_LoadFromFile(cert,L"/Users/chilkat/testData/cer/chilkat_ssl.cer");
if (success != TRUE) {
wprintf(L"%s\n",CkCertW_lastErrorText(cert));
CkCertW_Dispose(cert);
return;
}
// DN = "Distinguished Name"
wprintf(L"SubjectDN:%s\n",CkCertW_subjectDN(cert));
wprintf(L"Common Name:%s\n",CkCertW_subjectCN(cert));
wprintf(L"Issuer Common Name:%s\n",CkCertW_issuerCN(cert));
wprintf(L"Serial Number:%s\n",CkCertW_serialNumber(cert));
CkCertW_Dispose(cert);
}
|