PDFium Delphi Component Docs

ValidatePadesTrust methods

Component: TPdf  ·  Unit: PDFium
Validates PAdES signature integrity, current system trust, optional revocation evidence, and RFC 3161 timestamp tokens

Syntax

function ValidatePadesTrust(const Options: TPadesTrustValidationOptions): TPadesValidationResult;

function ValidatePadesTrustAsync(const Options: TPadesTrustValidationOptions; const Reply: TPadesTrustValidationReply): Boolean;

Description

Both methods capture the exact original file, memory buffer, custom stream, or completed progressive source retained by the active component and never validate a PDFium-resaved copy

Every ordinary signature is checked against its original ByteRange, CMS signed attributes and signature value, signing-certificate-v2 binding, the configured backend's current certificate chain, and optional revocation evidence

Signature timestamps and Document Time-stamps additionally validate their SHA-256 message imprint, attached CMS signature, TSA chain, and optional revocation state

The timestamp signer certificate must have a critical Extended Key Usage extension containing only id-kp-timeStamping, as required by RFC 3161 section 2.3. A missing, noncritical, mixed, or different EKU produces an invalid TimeStampTrustStatus even when the token's CMS signature and basic certificate chain are valid; the outer document signature retains its independent results

The asynchronous overload captures the source before dispatch and reports completion through TPadesTrustValidationReply

Options

NetworkPolicyptnpOffline uses cached certificate data only while ptnpOnline permits Windows chain retrieval
CheckRevocationRequests the configured backend's chain revocation evaluation; Windows excludes the root certificate, while OpenSSL checks configured CRLs against the chain
CheckTimeStampsValidates signature timestamp and Document Time-stamp tokens when present
UrlRetrievalTimeoutMsBounds native URL retrieval used by chain and revocation processing
QualifiedTrustEvaluatorOptionally evaluates the signer and collected chain against an authenticated offline trusted-list snapshot
QualifiedValidationTimeSelects the UTC service-history evaluation time, with zero using the current time
CancellationTokenStops at the next validation stage boundary
OnProgressReceives the stage, signature index, signature count, and overall percentage

Result

TPadesValidationResult.Signatures reports independent ByteRangeStatus, CmsSignatureStatus, AlgorithmPolicyStatus, SigningCertificateStatus, CertificateTrustStatus, QualifiedTrustStatus, RevocationStatus, TimeStampStatus, TimeStampSignatureStatus, TimeStampTrustStatus, and TimeStampRevocationStatus values, while QualifiedTrust identifies the matched territory, provider, service, type, status, and start time

AlgorithmInfo records the CMS digest and signature OIDs plus the signing certificate public-key and named-curve OIDs, and applies the ISO/TS 32002 NIST, Brainpool, Ed25519, Ed448, and curve-to-digest rules before integrity is accepted

Unsupported algorithms, unavailable platform trust services, incomplete revocation evidence, and cancelled validation are not promoted to valid states

Each signature entry includes RevocationReason and NativeRevocationError from its CMS verification, plus independent TimeStampRevocationReason and NativeTimeStampRevocationError from timestamp-token verification. The reason fields use TPdfCmsRevocationReason; native error fields are Cardinal values in the selected backend's error space, such as OpenSSL's X509_V_ERR_* codes or a raw Windows provider or GetLastError DWORD. Windows values are preserved without conversion to a common HRESULT space

The timestamp pair describes an embedded signature timestamp or a Document Time-stamp, without overwriting the ordinary signature pair. Timestamp diagnostics are populated only after token structure and message imprint checks allow CMS verification to run

With CheckRevocation = False, diagnostic reasons remain pcrrNone and errors remain zero. The same defaults apply when a check is not reached or its backend supplies no detailed reason, so always read the corresponding status rather than treating an empty diagnostic as success

Remarks

Example

var
  Options: TPadesTrustValidationOptions;
  Validation: TPadesValidationResult;
begin
  Options := TPadesTrustValidationOptions.Default;
  Options.NetworkPolicy := ptnpOnline;
  Options.CheckRevocation := True;
  Validation := Pdf1.ValidatePadesTrust(Options);
end;

See Also

ValidatePades FPdfTrustedList AnalyzeSignatureRevisions RenewPadesArchiveTimestamp