Skip to content

Latest commit

 

History

History
64 lines (52 loc) · 4.82 KB

CONFORMANCE.md

File metadata and controls

64 lines (52 loc) · 4.82 KB

Conformance

A PDF library's claims are only as good as the independent tools that verify them. Every push to main regenerates a set of reference documents and validates them with third-party validators in the conformance workflow. Per-run reports (validator output, rendered pages, diffs) are attached to each workflow run as artifacts; the summary tables are printed on the run's summary page.

What is validated, and by what

Check Standard Tool References
PDF/A validation ISO 19005 veraPDF — the industry-standard open-source validator PDF/A-1b, 1a, 2b, 2u, 3b, and a signed PDF/A-2b with a signature stamp
PDF/X structure ISO 15930 Ghostscript render (-dPDFSTOPONERROR) + byte-level assertions (OutputIntent /GTS_PDFX, CMYK profile and RGB-operator ban for X-1a, Info keys, trailer /ID, TrimBox/ArtBox per page, no encryption) PDF/X-1a, X-3, X-4
Visual regression — poppler pdftoppm render diffed against committed golden PNGs (ImageMagick, 5% fuzz, ≤0.5% differing pixels) reference pages, form fill, signature stamps
Signatures ETSI EN 319 142 (PAdES), RFC 5652, RFC 3161 OpenSSL CLI: openssl cms -verify over the exact /ByteRange bytes up to a test root CA, openssl ts -verify for timestamps; tampering must break verification. pyHanko validates the signed PDFs as a whole (trust, timestamp, whole-file coverage) test suite (Signature*Test, PadesSignatureTest, CmsBuilderTest)
Long-term validation ETSI EN 319 142 (PAdES-LT, PAdES-LTA) pyHanko's PAdES-LT / LTA profiles, offline: only the TSA's status is given, the signer's revocation data must come from the document's DSS (scripts/conformance/pades-ltv-check.py) LtvTest
Incremental signing ISO 32000-1 §7.5.6, §12.8.2 every third-party fixture signed in place (prefix unchanged, re-read, verified); several signers and certification judged by pyHanko's modification analysis IncrementalSigningTest
Signature validation ISO 32000-1 §12.8, ETSI EN 319 142 SignatureValidator against crafted attacks: incremental saving (content replaced after signing), shadow replace and hide, signature wrapping, a byte range outside the file, tampering, a revoked signer, a locked field changed; pyHanko agrees on the attacked files SignatureValidatorTest
Encrypted documents ISO 32000-1 §7.6 RC4, AES-128, AES-256 with embedded fonts and non-ASCII text strings decrypted by our reader and poppler; encrypted PDFs (including a LibreOffice one) signed incrementally and judged VALID by pyHanko EncryptionEmbeddedFontTest, IncrementalSigningTest
GOST signatures GOST R 34.10-2012 / 34.11-2012 openssl cms -verify with the gost engine, in the docker/gost image CI job "GOST R 34.10-2012 signing" (GostSignatureTest); checked by hand in CryptoPro CSP — a detached signature from the library verifies as CAdES-BES
Torture set — 11 worst-case documents (tables, Arabic/CJK, barcodes, charts, SVG, forms, signature, PDF/A, merge) rendered by poppler and Ghostscript; manual cross-viewer checklist in VIEWER-MATRIX.md examples/torture/

The reference documents are not toy files: they embed subsetted TrueType fonts, Cyrillic text, bold runs and tables, and are generated by scripts/conformance/generate.php with the sRGB2014 ICC profile vendored in resources/icc/.

Reproduce locally

bash scripts/fetch-fonts.sh
php scripts/conformance/generate.php

# PDF/A — requires veraPDF (https://verapdf.org, or `brew install verapdf`)
bash scripts/conformance/verapdf.sh

# PDF/X — requires Ghostscript
python3 scripts/conformance/pdfx-check.py

# Visual regression — requires poppler + ImageMagick
bash scripts/conformance/visual-check.sh

# Signatures — part of the regular test suite
vendor/bin/phpunit tests/Pdf/SignatureOpenSslTest.php

Known boundaries

  • PDF/X-1a uses the CGATS21_CRPC1 CMYK characterization profile, fetched on demand from the ICC registry (scripts/fetch-icc.sh) — at ~3.7 MB it is cached, not vendored.
  • PDF/X preflight depth: full ISO 15930 preflight is the domain of commercial tools (callas pdfToolbox, Acrobat Preflight). The CI checks cover the machine-checkable structural requirements; they are necessary, not sufficient, conditions.
  • veraPDF emits "Nested MCID" warnings (not violations) for tagged documents; tightening the tagged emission is tracked as future work.
  • Signature verification by the OpenSSL CLI proves cryptographic correctness over /ByteRange; the Acrobat signature panel is verified manually as part of the viewer matrix.