Sample code for 30+ languages & platforms
Delphi ActiveX

RSA Import Public Key

See more RSA Examples

Shows how to select/import a public key for RSA encryption or signature verification.

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;
pubKey: TPublicKey;
rsa: TChilkatRsa;

begin
success := 0;

pubKey := TPublicKey.Create(Self);
// In all Chilkat methods expecting a path, you pass either absolute or relative paths.
success := pubKey.LoadFromFile('rsaKeys/myTestRsaPublic.pem');
if (success = 0) then
  begin
    Memo1.Lines.Add(pubKey.LastErrorText);
    Exit;
  end;

rsa := TChilkatRsa.Create(Self);

// Tell RSA to use the public key.
rsa.UsePublicKey(pubKey.ControlInterface);
end;