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

Transition from Cert.ExportPublicKey to Cert.GetPublicKey

Provides instructions for replacing deprecated ExportPublicKey method calls with GetPublicKey.

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
cert: HCkCert;
publickeyObj: HCkPublicKey;
publickeyOut: HCkPublicKey;

begin
success := False;

cert := CkCert_Create();

//  ------------------------------------------------------------------------
//  The ExportPublicKey method is deprecated:

publickeyObj := CkCert_ExportPublicKey(cert);
if (CkCert_getLastMethodSuccess(cert) = False) then
  begin
    Memo1.Lines.Add(CkCert__lastErrorText(cert));
    Exit;
  end;

//  ...
//  ...

CkPublicKey_Dispose(publickeyObj);

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

publickeyOut := CkPublicKey_Create();
success := CkCert_GetPublicKey(cert,publickeyOut);
if (success = False) then
  begin
    Memo1.Lines.Add(CkCert__lastErrorText(cert));
    Exit;
  end;

CkCert_Dispose(cert);
CkPublicKey_Dispose(publickeyOut);