mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-30 13:08:48 -06:00
* M9: chain building checks CA constraints, key usage, path length and validity build_chain linked certificates by name and signature only. An issuer must also be allowed to issue: basicConstraints CA:TRUE (an old v1 self-signed root without constraints still anchors), keyCertSign when there is a key usage, a pathLenConstraint that allows the CAs below it, and validity at the signing time (or the trusted timestamp / token time) when it is known. Without this, an ordinary end-entity certificate of a trusted CA, embedded in a PDF, could "issue" a certificate for any identity and chain to the trusted root. The signature details now say why an issuer was refused. Tests issue certificates in-process and cover each refusal, plus a signed PDF whose signer chains through an end-entity certificate (Unknown, not Valid). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXAstazhuAFyakty2m93Af * M9: unreadable keyUsage, pathLen or basicConstraints fail closed; only v1/v2 self-signed certificates count as old roots - a present keyUsage that doesn't parse allows no usage (it was unrestricted) - a present pathLenConstraint that doesn't parse allows no CA below (it was unlimited) - basicConstraints counts as present before it is parsed, so a garbled one can't make a certificate look like an old root - the self-signed-without-basicConstraints exception applies to v1/v2 certificates only - restores the load_certificates doc comment Tests build v1 certificates when they have no extensions, as real old roots are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * M9: clippy: slice from a reference in the chain test --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>