PDFium Delphi Component Docs

SignPadesToStreamForDigest 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 with the chosen digest algorithm to a stream

Syntax

function SignPadesToStreamForDigest(Stream: TStream; const Options: TPadesSignOptions; DigestAlgorithm: TCmsDigestAlgorithm): Boolean;

Description

Appends an incremental approval or certification signature update, then writes the complete output bytes to a destination stream, computing the document digest with the algorithm named by DigestAlgorithm and declaring that same algorithm inside the CMS signature

Parameters

StreamThe destination stream object where output data will be written
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
  OutStream: TMemoryStream;
  Opts: TPadesSignOptions;
begin
  if not Pdf1.Active then Exit;
  OutStream := TMemoryStream.Create;
  try
    Opts := TPadesSignOptions.Default;
    Opts.CertificateThumbprint := 'a1b2c3d4e5';
    Pdf1.SignPadesToStreamForDigest(OutStream, Opts, cdaSha3_512);
  finally
    OutStream.Free;
  end;
end;

See Also

SignPadesToStream SignPadesForDigest FPdfCms FPdfCryptoWin