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

Transition from Email.GetEncryptedByCert to Email.LastDecryptCert

Provides instructions for replacing deprecated GetEncryptedByCert method calls with LastDecryptCert.

Chilkat Unicode C++ Downloads

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

void ChilkatSample(void)
    {
    bool success = false;

    CkEmailW email;

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The GetEncryptedByCert method is deprecated:

    CkCertW *certObj = email.GetEncryptedByCert();
    if (email.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",email.lastErrorText());
        return;
    }

    //  ...
    //  ...

    delete certObj;

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

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