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

Transition from Email.GetSignedByCertChain to Email.LastSignerCert

Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
email: HCkEmail;
certChainObj: HCkCertChain;
signerCert: HCkCert;
certChain: HCkCertChain;

begin
success := False;

email := CkEmail_Create();

//  ...
//  ...

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

certChainObj := CkEmail_GetSignedByCertChain(email);
if (CkEmail_getLastMethodSuccess(email) = False) then
  begin
    Memo1.Lines.Add(CkEmail__lastErrorText(email));
    Exit;
  end;

//  ...
//  ...

CkCertChain_Dispose(certChainObj);

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

signerCert := CkCert_Create();
success := CkEmail_LastSignerCert(email,0,signerCert);
if (success = False) then
  begin
    Memo1.Lines.Add(CkEmail__lastErrorText(email));
    Exit;
  end;

//  Get the certificate chain from the signer certificate.
certChain := CkCertChain_Create();
success := CkCert_BuildCertChain(signerCert,certChain);
if (success = False) then
  begin
    Memo1.Lines.Add(CkCert__lastErrorText(signerCert));
    Exit;
  end;

CkEmail_Dispose(email);
CkCert_Dispose(signerCert);
CkCertChain_Dispose(certChain);