PDFium Delphi Component Docs

ValidatePadesTrust methods

Enterprise edition: link FPdfEnterprise with Lib\Enterprise on the search path; otherwise this method raises EPdfEnterpriseRequired; see the edition matrix

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

RFC 3161 section 2.3 requires the timestamp signer's Extended Key Usage extension to be critical and contain only id-kp-timeStamping. Absent, noncritical, mixed or different EKU makes TimeStampTrustStatus invalid even with a valid token CMS signature and basic chain; the outer document signature keeps its independent results

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

Options

NetworkPolicyptnpOffline uses local certificate evidence. ptnpOnline also applies RetrievalPolicy and AllowedRetrievalOrigins. A configured OpenSSL verifier supports the default pcrpAllowedOrigins policy. Native trust backends use local evidence under that policy and need an explicit pcrpUnrestricted to fetch online
CheckRevocationRequests the configured backend's chain revocation evaluation; Windows excludes the root certificate, whilst 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; it runs only where the CMS signature and the certificate path are both valid, and QualifiedTrustStatus is indeterminate otherwise
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, whilst QualifiedTrust identifies the matched territory, provider, service, type, status and start time

CertificateTrustStatus is basic X.509 path trust: the signer certificate’s key usage and extended key usage are not checked, and the path is validated at the current time rather than at a verified signing time. A certificate that expired after a trusted time-stamp therefore reports an invalid path; applications that need document-signing usage or point-in-time validation should apply that policy to the reported certificates themselves

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 once 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 never reached or its backend supplies no detailed reason, so always read the corresponding status rather than taking an empty diagnostic as success

Remarks

Example

var
  Options: TPadesTrustValidationOptions;
  Validation: TPadesValidationResult;
begin
  ConfigureSslCmsVerifier;
  Options := TPadesTrustValidationOptions.Default;
  Options.NetworkPolicy := ptnpOnline;
  SetLength(Options.AllowedRetrievalOrigins, 1);
  Options.AllowedRetrievalOrigins[0] := 'https://pki.example.com';
  Options.CheckRevocation := True;
  Validation := Pdf1.ValidatePadesTrust(Options);
end;

See Also

ValidatePades FPdfTrustedList AnalyzeSignatureRevisions RenewPadesArchiveTimestamp