Add craft-pkcs7: DER, X.509, CMS SignedData, PKCS #12, RFC 3161 and revocation from PdfCraft

* Add craft-pkcs7: DER, X.509, CMS SignedData, PKCS #12, RFC 3161 and revocation from PdfCraft

Moved from PdfCraft's crates/sign at 1d7a9f9f: der, x509, cms, pkcs12, timestamp,
revocation, keys, rsa_pad and ec512, with their unit tests, the integration tests
that need no PDF, and the test keys.

x509 no longer returns PdfCraft's worded sentences: signing_problem gives a
SigningProblem and build_chain_noted a Refused (reason and the two certificates).
The checks behind them are unchanged. Error is SignError without its PDF variants.

* craft-pkcs7: write the certificate serial verbatim in SignerInfo and ESSCertIDv2

A serial with its high bit set and no leading zero was written with one added, so
the signer identifier and the signing-certificate attribute named a different
number than the certificate has.

Ported from storytold/pdfcraft#6868. The test uses a certificate that really has
such a serial and also checks that the signer's certificate is found.

* craft-pkcs7: note why RIPEMD-160 is supported

---------

Co-authored-by: jonathanwxh-cell <jonathanwxh@gmail.com>
This commit is contained in:
Dylan M. Taylorandjonathanwxh-cell authored and GitHub committed 2026-11-12 09:45:31 -05:00
1 parent 493476eb8d
commit 1c5c8a4e14
33 files changed
+6554 -88

No files matched your search

+4
View File
@@ -257,6 +257,10 @@ craft-<name> = { git = "https://github.com/storytold/craft-libs", rev = "<commit
- [`craft-pcraft-format`](crates/pcraft-format/README.md): the envelope of PhotoCraft's `.pcraft`
bundle: `Manifest<D>` with the document as a type parameter, `TileRef`, the entry paths, the
manifest decode limits and the migration runner. The document model stays in PhotoCraft.
- [`craft-pkcs7`](crates/pkcs7/README.md): the formats of digital signatures, read, verified and
written: ASN.1 DER, X.509 certificates and chains, CMS SignedData (PKCS #7), PKCS #12 identity
files, RFC 3161 timestamps, and CRL / OCSP revocation evidence. What a signature means for a
document or a message stays in each app.
- [`craft-penpot`](crates/penpot/README.md): clean-room reader and writer for the Penpot 2.x export
container (`.penpot`): the ZIP archive, its manifest, the per-file, per-page and per-shape JSON
members and media objects, as the JSON the file holds. Bounded on hostile input. Carved from