Delphi ActiveX Requires Chilkat v11.0.0+
Delphi ActiveX
Get Base64 Public Key from Private Key
See more ECC Examples
Demonstrates how to get the public key in base64 format from a private key.Chilkat Delphi ActiveX Downloads
var
success: Integer;
bd: TChilkatBinData;
privKey: TPrivateKey;
pubKey: TPublicKey;
pubKeyBase64: WideString;
begin
success := 0;
// Load a private key from base64.
bd := TChilkatBinData.Create(Self);
success := bd.AppendEncoded('MHQCA....n0Q==','base64');
privKey := TPrivateKey.Create(Self);
success := privKey.LoadAnyFormat(bd.ControlInterface,'');
if (success = 0) then
begin
Memo1.Lines.Add(privKey.LastErrorText);
Exit;
end;
pubKey := TPublicKey.Create(Self);
privKey.ToPublicKey(pubKey.ControlInterface);
pubKeyBase64 := pubKey.GetEncoded(1,'base64');
Memo1.Lines.Add(pubKeyBase64);