PDFium Delphi Component Docs

SignPadesForDigest method

PAdES B-B and B-T signing is part of every edition; the B-LT and B-LTA levels require the Enterprise edition (link FPdfEnterprise with Lib\Enterprise on the search path), otherwise they raise EPdfEnterpriseRequired before any output is written; see the edition matrix

Component: TPdf  ·  Unit: PDFium
Writes a constrained approval or certification PAdES signature update that uses the chosen digest algorithm

Syntax

function SignPadesForDigest(const FileName: string; const Options: TPadesSignOptions; DigestAlgorithm: TCmsDigestAlgorithm): Boolean;

Description

Appends an incremental approval or certification signature update, then stores it to FileName, computing the document digest with the algorithm named by DigestAlgorithm and declaring that same algorithm inside the CMS signature

Parameters

FileNameThe output file the signed document is written to
OptionsSignature details structure specifying certificates, levels, optional dictionary keys, and field constraints
DigestAlgorithmMessage digest used for the document, the signed attributes, and the signature algorithm; one of cdaSha256, cdaSha3_256, cdaSha3_384 or cdaSha3_512

Remarks

Example

var
  Opts: TPadesSignOptions;
begin
  if not Pdf1.Active then Exit;
  if not WinSha3DigestAvailable then Exit;
  try
    Opts := TPadesSignOptions.Default;
    Opts.CertificateThumbprint := 'a1b2c3d4e5';
    Pdf1.SignPadesForDigest('signed-sha3.pdf', Opts, cdaSha3_256);
  except
    on E: EPadesCrypto do ShowMessage(E.Message);
  end;
end;

See Also

SignPades SignPadesToStreamForDigest FPdfCms FPdfCryptoWin