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

Transition from Email.GetSignedByCertChain to Email.LastSignerCert

Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkEmailW.h>
#include <CkCertChainW.h>
#include <CkCertW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkEmailW email;

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The GetSignedByCertChain method is deprecated:

    CkCertChainW *certChainObj = email.GetSignedByCertChain();
    if (email.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",email.lastErrorText());
        return;
    }

    //  ...
    //  ...

    delete certChainObj;

    //  ------------------------------------------------------------------------
    //  Do the equivalent using LastSignerCert to get the signing certificate,
    //  then build the cert chain from the signing certificate object.

    CkCertW signerCert;
    success = email.LastSignerCert(0,signerCert);
    if (success == false) {
        wprintf(L"%s\n",email.lastErrorText());
        return;
    }

    //  Get the certificate chain from the signer certificate.
    CkCertChainW certChain;
    success = signerCert.BuildCertChain(certChain);
    if (success == false) {
        wprintf(L"%s\n",signerCert.lastErrorText());
        return;
    }
    }