(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 <CkCert.h>
void ChilkatSample(void)
{
CkCert cert;
bool success;
// LoadFromFile will load virtually any certificate format file.
// It will auto-recognize the format and load appropiately.
success = cert.LoadFromFile("/Users/chilkat/testData/cer/chilkat_ssl.cer");
if (success != true) {
std::cout << cert.lastErrorText() << "\r\n";
return;
}
// DN = "Distinguished Name"
std::cout << "SubjectDN:" << cert.subjectDN() << "\r\n";
std::cout << "Common Name:" << cert.subjectCN() << "\r\n";
std::cout << "Issuer Common Name:" << cert.issuerCN() << "\r\n";
std::cout << "Serial Number:" << cert.serialNumber() << "\r\n";
}
|