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
function SignPadesToStreamForDigest(Stream: TStream; const Options: TPadesSignOptions; DigestAlgorithm: TCmsDigestAlgorithm): Boolean;
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
| Stream | The destination stream object where output data will be written |
| Options | Signature details structure specifying certificates, levels, optional dictionary keys, and field constraints |
| DigestAlgorithm | Message digest used for the document, the signed attributes, and the signature algorithm; one of cdaSha256, cdaSha3_256, cdaSha3_384 or cdaSha3_512 |
Active to be TrueSignPadesForDigest writes to a filecdaSha256 keeps the behaviour of SignPadesToStreamdigestAlgorithm, the messageDigest signed attribute (32, 48 or 64 octets), the signer's signatureAlgorithm, and the RSASSA-PSS hash and salt length all follow itcertHash stays SHA-256 regardless of the choice, as RFC 5035 defines it independently of the SignedData digestSHA3-256 algorithm, first shipped with Windows 11 24H2; test with WinSha3DigestAvailable before offering the choiceDigestAlgorithm raises EPadesCrypto instead of producing a signature whose declared algorithms disagree
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;