Verifies an ordered chain, signing purpose and optional SAN identity.
- Parameters
-
| leaf | Untrusted non-CA peer certificate. |
| intermediates | Issuers in exact leaf-to-anchor order; excludes leaf and anchor. |
| anchor | Caller-selected trusted CA certificate, not inferred from the chain. |
| at | Explicit caller time, tested inclusively on every certificate. |
| role | Server or Client signing role, not a TLS key-exchange policy. |
| identity | Caller-owned DNS text or network-order IP bytes in SubjectAltName. Required for Server. Null for Client checks trust/purpose only and makes no client-identity or application-authorization assertion. |
- Returns
- Success for this subset, or the first typed failure with certificate index.
- Exceptions
-
Composes the existing signature/name, validity, CA/pathLen, KU and SAN helpers without changing Certificate::VerifyChain. Each issuer requires keyCertSign if KU exists; only the leaf requires digitalSignature. Each present EKU, including on the anchor, must explicitly grant the role (anyEKU alone fails).
The anchor is external trust input, so its self-signature and issuer name are NOT verified. As a deliberate local policy, its validity, v3 CA status, pathLen, KU, EKU, public-key suitability and extensions ARE enforced just like an issuer; this is stricter than RFC 5280's abstract trust-anchor input. Names chain by exact DER, and pathLen counts every supplied intermediate, including self-issued ones (conservative; no self-issued rollover processing).
Keys: RSA 2048..8192 bits or named-curve ECDSA P-256/P-384/P-521. Non-anchor signatures: RSA PKCS#1 v1.5 or ECDSA with SHA-256/384/512. Critical BC, KU, EKU and DNS/IP-only SAN are processed. All other critical extensions, including SKI/AKI and certificatePolicies, fail unsupported. Name constraints, policy mappings, policy constraints and inhibitAnyPolicy fail unsupported even when noncritical. Noncritical certificatePolicies asserts policies but does not itself restrict a path: it is ignored, with no requested-policy acceptance claim. Other noncritical hints (SKI/AKI, AIA, CRL distribution points, issuerAltName, etc.) are ignored. TLS Feature (including OCSP Must-Staple) and proxyCertInfo also fail unsupported even when noncritical; their additional obligations cannot be satisfied by this certificate-only entrypoint.
Every present SAN and KU/EKU is validated, even on issuers or identityless clients. KU agreement-only bits require keyAgreement; keyCertSign requires cA. No CN fallback. No CRL/OCSP checks; a revoked certificate can pass. See doc/tls-peer-verification.md for the supported-subset contract.