C++
C++
Transition from Email.GetSignedByCertChain to Email.LastSignerCert
Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.Chilkat C++ Downloads
#include <CkEmail.h>
#include <CkCertChain.h>
#include <CkCert.h>
void ChilkatSample(void)
{
bool success = false;
CkEmail email;
// ...
// ...
// ------------------------------------------------------------------------
// The GetSignedByCertChain method is deprecated:
CkCertChain *certChainObj = email.GetSignedByCertChain();
if (email.get_LastMethodSuccess() == false) {
std::cout << email.lastErrorText() << "\r\n";
return;
}
// ...
// ...
delete certChainObj;
// ------------------------------------------------------------------------
// Do the equivalent using LastSignerCert to get the signing certificate,
// then build the cert chain from the signing certificate object.
CkCert signerCert;
success = email.LastSignerCert(0,signerCert);
if (success == false) {
std::cout << email.lastErrorText() << "\r\n";
return;
}
// Get the certificate chain from the signer certificate.
CkCertChain certChain;
success = signerCert.BuildCertChain(certChain);
if (success == false) {
std::cout << signerCert.lastErrorText() << "\r\n";
return;
}
}