Lazarus Pascal Requires Chilkat v11.0.0+
Lazarus Pascal
Example: Crypt2.LastSignerCert method
Demonstrates how to call the LastSignerCert 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.Cert,
Chilkat.Crypt2;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
crypt: TCrypt2;
p7m_path: string;
out_path: string;
numSigners: Integer;
i: Integer;
cert: TCert;
begin
success := False;
crypt := TCrypt2.Create;
p7m_path := 'qa_data/p7m/Firma.docx.p7m';
out_path := 'qa_output/Firma.docx';
success := crypt.VerifyP7M(p7m_path,out_path);
if (success = False) then
begin
WriteLn(crypt.LastErrorText);
Exit;
end;
// Examine the certificate(s) used for signing.
numSigners := crypt.NumSignerCerts;
i := 0;
cert := TCert.Create;
while i < numSigners do
begin
crypt.LastSignerCert(i,cert);
WriteLn('Signer: ' + cert.SubjectDN);
i := i + 1;
end;
crypt.Free;
cert.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.