Delphi ActiveX Requires Chilkat v11.0.0+
Delphi ActiveX
Get Public Key from Certificate PEM
See more Certificates Examples
Loads a certificate from a PEM file and gets the cert's public key.Chilkat Delphi ActiveX Downloads
var
success: Integer;
cert: TChilkatCert;
pubkey: TPublicKey;
begin
success := 0;
cert := TChilkatCert.Create(Self);
success := cert.LoadFromFile('qa_data/certs/someCert.pem');
if (success = 0) then
begin
Memo1.Lines.Add(cert.LastErrorText);
Exit;
end;
// Get the certificate's public key:
pubkey := TPublicKey.Create(Self);
cert.GetPublicKey(pubkey.ControlInterface);
Memo1.Lines.Add(pubkey.GetPem(0));
// OK.. we have the public key which can be used in other Chilkat classes/methods...