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

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
var
success: Integer;
cert: TChilkatCert;
strPem: WideString;
pubKey: TPublicKey;

begin
success := 0;

cert := TChilkatCert.Create(Self);

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

success := cert.LoadPem(strPem);
if (success = 0) then
  begin
    Memo1.Lines.Add(cert.LastErrorText);
    Exit;
  end;

pubKey := TPublicKey.Create(Self);
cert.GetPublicKey(pubKey.ControlInterface);

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

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