Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
LastErrorText
See more RSA Examples
How to get RSA debugging information. If any RSA method returns a failed status, check the contents of the LastErrorText string property. Send it to support@chilkatsoft.com if you need further help.Chilkat Pascal (Lazarus/Delphi) Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.PrivateKey,
Chilkat.Rsa;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
rsa: TRsa;
privKey: TPrivateKey;
begin
success := False;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
rsa := TRsa.Create;
privKey := TPrivateKey.Create;
success := rsa.GenKey(2048,privKey);
if (success <> True) then
begin
// The LastErrorText provides detailed information about
// any failure. It is standard to all Chilkat components.
// This is good information to send to support@chilkatsoft.com
WriteLn(rsa.LastErrorText);
Exit;
end;
rsa.Free;
privKey.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.