PLModernSignatureSizeEstimate

Cryptography, digital signatures

Description

Estimates the encoded size of the detached CMS that PLBuildModernDetachedCMS would produce for a certificate

The estimate covers the SignedData envelope, the certificate, signed attributes, the commitment type and signature policy attributes plus the raw signature and the requested reserve

Syntax

Delphi

Function PLModernSignatureSizeEstimate(CertContext: Pointer;
  Const CertificateDER: AnsiString; SignatureReserveBytes: Integer): Integer;

Parameters

CertContextWindows CERT_CONTEXT handle, may be Nil when only the DER form is available
CertificateDERDER-encoded certificate bytes
SignatureReserveBytesAdditional bytes reserved on top of the envelope, typically the /Contents reserve the sign process configured

Return value

The estimated size in bytes, or 0 when the certificate cannot be parsed

Remarks

Signers pre-allocate the PDF /Contents hole from this value so the placeholder never needs rewriting once the real CMS arrives

See also

PLBuildModernDetachedCMS, PLModernCertificateKeyAlgorithm, SetSignProcessReserveContentsBytes