Validates every signature of the document: for each signed signature field, the byte range, the digest of the bytes it covers,
the CMS signature value, its time-stamp token, and the signer's certificate path to the trust anchors options
gives, with the revocation of each certificate.
public IReadOnlyList<PdfSignatureValidation> ValidateSignatures(PdfSignatureValidationOptions? options = null)
The trust anchors, extra certificates, validation time and revocation settings; null for none and now.
ISO 32000-2 §12.8.1: the digest is recomputed over the ByteRange of the file the document was opened from (offsets from
its first byte) and compared with the one the signature carries; a difference, or a signature value that does not verify with the
signer's certificate, makes the signature Invalid. The byte ranges must leave out exactly the
Contents hexadecimal string (§12.8.3.3.1), so a range that leaves another gap is reported. SubFilters
adbe.pkcs7.detached, ETSI.CAdES.detached, adbe.pkcs7.sha1 and ETSI.RFC3161 are validated (Table 260);
adbe.x509.rsa_sha1 is reported as unsupported.
The signer's certificate path is built from the certificates the signature carries, the document security store's (§12.8.4.3) and ExtraCertificates to one of TrustAnchors, and checked as RFC 5280 §6.1 describes (signatures, validity at the validation time, basic constraints, key usage, path length). A path that reaches no anchor, or a certificate outside its validity period, makes the signature Indeterminate. A signature time-stamp token that verifies, with its unit's chain trusted, moves the validation time back to its time (§12.8.3.4.8).
Each certificate's revocation is checked with the CRLs and OCSP responses the signature (§12.8.3.3.2), the document security store and the options hold; they are fetched only through OnlineRevocationClient when the caller sets it. This method sends synchronously; use ValidateSignaturesAsync(PdfSignatureValidationOptions?, CancellationToken) to fetch asynchronously.
Long-term validation (§12.8.5.3; ETSI EN 319 142-1 B-LTA): a document timestamp that validates proves that everything its byte range covers (earlier signatures, their time-stamp tokens, the security store written before it) existed at its time, so each earlier signature is validated at the time of the nearest later valid document timestamp instead of now: its unit's and signer's certificates need only have been valid, and the store's revocation data current, then. The latest timestamp is validated now. See AddValidationData(Stream, PdfSignatureValidationOptions?).
Modification detection (§12.8.2.2.2, §12.8.2.4): the byte ranges shall end at the %%EOF that terminates a revision
(§12.8.1), which SignedRevision names, else SignedRevisionUnknown. Each later
revision is compared object by object with the one before it, and every change is classified
(PdfModificationKind) and checked against the permissions in effect: those of the document's certification
signature (its DocMDP P, Table 257; 3 without one), narrowed by the P of every field lock signed before the change
(Table 236). A change they do not permit makes every signature before it Invalid
(ModificationNotPermitted), and so does a change to a field the signature locks through its FieldMDP reference or its
field's lock dictionary (LockedFieldModified). Updates that only add a document security store or a document timestamp
are always permitted. See Modifications.
Edits made to the document in memory and not yet saved are not part of the file and play no part. A read: safe concurrently with other reads.