Sample code for 30+ languages & platforms
C++ Requires Chilkat v11.0.0+

Transition from Cert.ExportPublicKey to Cert.GetPublicKey

Provides instructions for replacing deprecated ExportPublicKey method calls with GetPublicKey.

Chilkat C++ Downloads

C++
#include <CkCert.h>
#include <CkPublicKey.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkCert cert;

    //  ------------------------------------------------------------------------
    //  The ExportPublicKey method is deprecated:

    CkPublicKey *publickeyObj = cert.ExportPublicKey();
    if (cert.get_LastMethodSuccess() == false) {
        std::cout << cert.lastErrorText() << "\r\n";
        return;
    }

    //  ...
    //  ...

    delete publickeyObj;

    //  ------------------------------------------------------------------------
    //  Do the equivalent using GetPublicKey.
    //  Your application creates a new, empty PublicKey object which is passed 
    //  in the last argument and filled upon success.

    CkPublicKey publickeyOut;
    success = cert.GetPublicKey(publickeyOut);
    if (success == false) {
        std::cout << cert.lastErrorText() << "\r\n";
        return;
    }
    }