Sample code for 30+ languages & platforms
Unicode C

Load CMS PKCS#7 Certificate (.p7b)

See more Certificates Examples

Loads a digital certificate from a Cryptographic Message Syntax Standard PKCS7 (.p7b) file and fetches information about the cert.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkCertW.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkCertW cert;

    success = FALSE;

    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.p7b");
    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);

    }