Sample code for 30+ languages & platforms
Unicode C++

Load PEM Format Certificate (.pem)

See more Certificates Examples

Loads a PEM format digital certificate and fetches information about the cert.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkCertW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkCertW cert;

    // LoadFromFile will load virtually any certificate format file.
    // It will auto-recognize the format and load appropiately.

    success = cert.LoadFromFile(L"/Users/chilkat/testData/cer/cert.pem");
    if (success != true) {
        wprintf(L"%s\n",cert.lastErrorText());
        return;
    }

    // DN = "Distinguished Name"
    wprintf(L"SubjectDN:%s\n",cert.subjectDN());

    wprintf(L"Common Name:%s\n",cert.subjectCN());
    wprintf(L"Issuer Common Name:%s\n",cert.issuerCN());

    wprintf(L"Serial Number:%s\n",cert.serialNumber());
    }