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

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkCertW.h>
#include <CkPublicKeyW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkCertW cert;

    const wchar_t *strPem = L"-----BEGIN CERTIFICATE----- ...";

    success = cert.LoadPem(strPem);
    if (success == false) {
        wprintf(L"%s\n",cert.lastErrorText());
        return;
    }

    CkPublicKeyW pubKey;
    cert.GetPublicKey(pubKey);

    //  You can now use the public key object however it is needed,
    //  and access its various properties and methods..

    wprintf(L"%s\n",pubKey.getXml());
    }