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

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
cert: HCkCert;
strPem: PWideChar;
pubKey: HCkPublicKey;

begin
success := False;

cert := CkCert_Create();

strPem := '-----BEGIN CERTIFICATE----- ...';

success := CkCert_LoadPem(cert,strPem);
if (success = False) then
  begin
    Memo1.Lines.Add(CkCert__lastErrorText(cert));
    Exit;
  end;

pubKey := CkPublicKey_Create();
CkCert_GetPublicKey(cert,pubKey);

//  You can now use the public key object however it is needed,
//  and access its various properties and methods..

Memo1.Lines.Add(CkPublicKey__getXml(pubKey));

CkCert_Dispose(cert);
CkPublicKey_Dispose(pubKey);