Delphi DLL
Delphi DLL
Transition from Email.GetSignedByCertChain to Email.LastSignerCert
Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.Chilkat Delphi DLL Downloads
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, CertChain, Cert, Email;
...
procedure TForm1.Button1Click(Sender: TObject);
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);
end;