Sample code for 30+ languages & platforms
Delphi DLL

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 DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Cert, PublicKey;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
cert: HCkCert;
pubkey: HCkPublicKey;

begin
success := False;

cert := CkCert_Create();

success := CkCert_LoadFromFile(cert,'qa_data/pem/my_cert.pem');
if (success = False) then
  begin
    Memo1.Lines.Add(CkCert__lastErrorText(cert));
    Exit;
  end;

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

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

CkCert_Dispose(cert);
CkPublicKey_Dispose(pubkey);

end;