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

Convert Certificate from DER to PEM.

See more Certificates Examples

Loads a digital certificate from any format, such as DER, and saves to PEM format.

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.
    // In this case, load a DER format certificate and convert to PEM.
    success = cert.LoadFromFile(L"qa_data/certs/testCert.cer");
    if (success != true) {
        wprintf(L"%s\n",cert.lastErrorText());
        return;
    }

    success = cert.ExportCertPemFile(L"qa_data/certs/testCert.pem");
    if (success != true) {
        wprintf(L"%s\n",cert.lastErrorText());
        return;
    }

    wprintf(L"Converted certificate from DER to PEM format.\n");
    }