Lazarus Pascal
Lazarus Pascal
Example: Crypt2.AddPfxSourceBd method
Demonstrates how to call the AddPfxSourceBd method.Chilkat Lazarus Pascal 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.BinData,
Chilkat.Crypt2;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
crypt: TCrypt2;
bdPfx: TBinData;
pfxPassword: string;
begin
success := False;
crypt := TCrypt2.Create;
success := False;
// Do public-key decryption (RSA)
crypt.CryptAlgorithm := 'pki';
// ...
// ...
// ...
bdPfx := TBinData.Create;
success := bdPfx.LoadFile('c:/my_pfx_files/a.pfx');
// ...
pfxPassword := 'secret1';
success := crypt.AddPfxSourceBd(bdPfx,pfxPassword);
if (success = False) then
begin
WriteLn(crypt.LastErrorText);
Exit;
end;
// Add as many as PFX sources as desired...
success := bdPfx.LoadFile('c:/my_pfx_files/b.pfx');
pfxPassword := 'secret2';
success := crypt.AddPfxSourceBd(bdPfx,pfxPassword);
if (success = False) then
begin
WriteLn(crypt.LastErrorText);
Exit;
end;
// ...
// ...
crypt.Free;
bdPfx.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.