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

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
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);