Sample code for 30+ languages & platforms
Lazarus Pascal

Example: Crypt2.GetSignatureSigningTimeStr method

Demonstrates how to call the GetSignatureSigningTimeStr method.

Chilkat Lazarus Pascal Downloads

Lazarus Pascal
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.Crypt2;

// ---------------------------------------------------------------------------

procedure RunDemo;
var
  success: Boolean;
  crypt: TCrypt2;
  numSigners: Integer;
  i: Integer;

begin
  success := False;

  crypt := TCrypt2.Create;

  success := crypt.VerifyP7M('qa_data/cades/CAdES-T/Signature-C-T-1.p7m','qa_output/out.dat');
  if (success = False) then
    begin
      WriteLn(crypt.LastErrorText);
      Exit;
    end;

  numSigners := crypt.NumSignerCerts;
  WriteLn('Num Signers = ' + numSigners);

  i := 0;
  while i < numSigners do
    begin
      if (crypt.HasSignatureSigningTime(i) = True) then
        begin
          WriteLn(i + 1 + ': ' + crypt.GetSignatureSigningTimeStr(i));
        end
      else
        begin
          WriteLn(i + 1 + ': has no signing time.');
        end;
      i := i + 1;
    end;

  //  Sample output:

  //  Num Signers = 1
  //  1: Sun, 03 Dec 2013 06:57:41 GMT


  crypt.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.