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

RSA Import Private Key

See more RSA Examples

Shows how to select/import a private key for RSA signing or decryption.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
var
success: Integer;
privKey: TPrivateKey;
password: WideString;
rsa: TChilkatRsa;

begin
success := 0;

privKey := TPrivateKey.Create(Self);
password := 'secret';
//  In all Chilkat methods expecting a path, you pass either absolute or relative paths.
success := privKey.LoadAnyFormatFile('rsaKeys/myTestRsaPrivate.pem',password);
if (success = 0) then
  begin
    Memo1.Lines.Add(privKey.LastErrorText);
    Exit;
  end;

rsa := TChilkatRsa.Create(Self);

//  Tell the RSA object to use the private key (i.e. import the private key)
rsa.UsePrivateKey(privKey.ControlInterface);