Sample code for 30+ languages & platforms
Delphi ActiveX

Get Certificate Public Key from PEM

See more Certificates Examples

Demonstrates how to load a PEM file containing a certificate and access the public key.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Integer;
cert: TChilkatCert;
pubkey: TPublicKey;

begin
success := 0;

cert := TChilkatCert.Create(Self);

success := cert.LoadFromFile('qa_data/pem/my_cert.pem');
if (success = 0) then
  begin
    Memo1.Lines.Add(cert.LastErrorText);
    Exit;
  end;

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

// Examine the public key as XML..
Memo1.Lines.Add(pubkey.GetXml());
end;