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

Transition from Crypt2.GetSignerCertChain to Crypt2.LastSignerCert

Provides instructions for replacing deprecated GetSignerCertChain method calls with LastSignerCert.

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
crypt2: HCkCrypt2;
index: Integer;
certchainObj: HCkCertChain;
signerCert: HCkCert;
certChain: HCkCertChain;

begin
success := False;

crypt2 := CkCrypt2_Create();

//  ...
//  ...
index := 0;

//  ------------------------------------------------------------------------
//  The GetSignerCertChain method is deprecated:

certchainObj := CkCrypt2_GetSignerCertChain(crypt2,index);
if (CkCrypt2_getLastMethodSuccess(crypt2) = False) then
  begin
    Memo1.Lines.Add(CkCrypt2__lastErrorText(crypt2));
    Exit;
  end;

//  ...
//  ...

CkCertChain_Dispose(certchainObj);

//  ------------------------------------------------------------------------
//  Do the equivalent using LastSignerCert, and then get the certificate chain from the cert.
//  Your application creates a new, empty Cert object which is passed 
//  in the last argument and filled upon success.

signerCert := CkCert_Create();
success := CkCrypt2_LastSignerCert(crypt2,index,signerCert);
if (success = False) then
  begin
    Memo1.Lines.Add(CkCrypt2__lastErrorText(crypt2));
    Exit;
  end;

certChain := CkCertChain_Create();
success := CkCert_BuildCertChain(signerCert,certChain);
if (success = False) then
  begin
    Memo1.Lines.Add(CkCert__lastErrorText(signerCert));
    Exit;
  end;

CkCrypt2_Dispose(crypt2);
CkCert_Dispose(signerCert);
CkCertChain_Dispose(certChain);