Delphi DLL
Delphi DLL
RSA Import Private Key
See more RSA Examples
Shows how to select/import a private key for RSA signing or decryption.Chilkat Delphi DLL Downloads
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, PrivateKey, Rsa;
...
procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
privKey: HCkPrivateKey;
password: PWideChar;
rsa: HCkRsa;
begin
success := False;
privKey := CkPrivateKey_Create();
password := 'secret';
// In all Chilkat methods expecting a path, you pass either absolute or relative paths.
success := CkPrivateKey_LoadAnyFormatFile(privKey,'rsaKeys/myTestRsaPrivate.pem',password);
if (success = False) then
begin
Memo1.Lines.Add(CkPrivateKey__lastErrorText(privKey));
Exit;
end;
rsa := CkRsa_Create();
// Tell the RSA object to use the private key (i.e. import the private key)
CkRsa_UsePrivateKey(rsa,privKey);
CkPrivateKey_Dispose(privKey);
CkRsa_Dispose(rsa);
end;