Sample code for 30+ languages & platforms
Delphi ActiveX

Example: Crypt2.LastSignerCert method

Demonstrates how to call the LastSignerCert method.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Integer;
crypt: TChilkatCrypt2;
p7m_path: WideString;
out_path: WideString;
numSigners: Integer;
i: Integer;
cert: TChilkatCert;

begin
success := 0;

crypt := TChilkatCrypt2.Create(Self);

p7m_path := 'qa_data/p7m/Firma.docx.p7m';
out_path := 'qa_output/Firma.docx';

success := crypt.VerifyP7M(p7m_path,out_path);
if (success = 0) then
  begin
    Memo1.Lines.Add(crypt.LastErrorText);
    Exit;
  end;

// Examine the certificate(s) used for signing.
numSigners := crypt.NumSignerCerts;
i := 0;

cert := TChilkatCert.Create(Self);

while i < numSigners do
  begin
    crypt.LastSignerCert(i,cert.ControlInterface);
    Memo1.Lines.Add('Signer: ' + cert.SubjectDN);
    i := i + 1;
  end;
end;