Add EU DSS (PAdES) signing engine#422
Conversation
kwart
left a comment
There was a problem hiding this comment.
Automated review pass. Most findings are correctness gaps in the LT/LTA + networking paths plus a gap between claimed and actual test coverage. Design and model wiring look clean. Inline comments below; a few minor items folded in here:
DssTrustConfigurer.buildVerifierswallows trusted-source exceptions (logs WARNING, continues), so a misconfigured truststore/cert proceeds without trust anchors and fails later with an opaque DSS error instead ofconsole.dss.ltNoRevocation.- Truststore password is stored plaintext in
advanced.propertiesand bound to a plainTextField(notPasswordField). - Visible signature: graphic and background image are mutually exclusive, and
GRAPHIC_AND_DESCRIPTIONwith no graphic path silently usesbgImgPathas the graphic. DssSigningEngineTestrelies on BouncyCastle/PDFBox via transitive compile-scope deps rather than declared test deps.- Benign scope creep:
MainWindowControllernow gates the wholesignatureAppearanceAccordionPaneonVISIBLE_SIGNATURE.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Wire JSignPdf's HTTP proxy into the DSS TSP/OCSP/CRL/AIA data loaders so PROXY_SUPPORT is honoured; SOCKS is reported as unsupported instead of silently bypassing the proxy. - Fail fast with a specific message when level LT/LTA is requested without a TSA (LT/LTA build on a signature timestamp), instead of failing deep in DSS. - Resolve the default port (443/80) from the URI scheme when the TSA URL omits an explicit port, so basic-auth credentials match the real connection. - Document that the encrypt-before-sign 128-bit key length matches the OpenPDF engine's password encryption (no strength downgrade). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- DssFontUtils: materialise the font bytes into an InMemoryDocument while the stream is open, instead of handing DSS the stream that this method closes on return (DSSFileFont re-reads the font lazily in getJavaFont()/getInputStream()). - DssSigningEngineTest: assert the achieved baseline level via DSS's own validator (SimpleReport.getSignatureFormat) rather than only the subfilter, which is identical for B/T/LT/LTA. Assert visible-signature placement (page + rectangle). Add dss-validation / dss-policy-jaxb as test-scoped deps. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Port jsignpdf-pades' EmbeddedTsaServer (an in-JVM RFC 3161 TSA on a loopback port, backed by a self-signed timestamping cert and BouncyCastle TSP) into the engine-dss test suite, so level T can be produced and asserted without external network. Adds: - baselineBWithTsaUpgradesToT: B + TSA auto-upgrades to and validates as T - explicitBaselineTWithTsaProducesT: explicit T validates as T This closes the level-T verification gap; LT/LTA success still needs reachable revocation/AIA and stays out of the unit suite (the reference project covers LT/LTA only as no-trust failure cases too). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…fallback, declare test deps - DssTrustConfigurer.buildVerifier now propagates trust-source load failures instead of swallowing them (WARNING + continue). DssSigningEngine catches and fails fast with the new console.dss.trustConfigFailed message, so a misconfigured truststore/cert/LOTL no longer signs without the intended trust anchors and surfaces an opaque DSS error later. - Visible signature: stop silently using the background image as the signature graphic in GRAPHIC_AND_DESCRIPTION mode when no graphic is configured. DSS renders a single image; graphic vs background are now cleanly mutually exclusive (graphic mode w/o graphic -> text only). - engines/dss now declares pdfbox (compile; used directly by the engine) and bouncycastle (test; BC provider + embedded TSA) explicitly instead of relying on transitive compile-scope deps. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks — responses to the five folded-in bullets (fixes in 8df522b): 1. 3. Visible-signature image fallback — fixed. Removed the silent 4. Test relying on transitive compile-scope deps — fixed. 2. Truststore password — partly fixed, partly a deliberate boundary call. The input is already a 5. All green after the changes: |
Implements the
dsssigning engine described indesign-doc/3.1-engine-dss.md— the first phase-2 engine behind the phase-1 pluggable-engine API. It produces PAdES signatures (ETSI.CAdES.detached) at baseline levels B / T / LT / LTA, which the OpenPDF engine cannot create. The default engine staysopenpdf, so nothing changes unless you opt in.What's included
engines/dssmodule —DssSigningEngine(signing flow lifted fromjsignpdf-padesonto JSignPdf'sBasicSignerOptions/KeyStoreUtils/logging),PrivateKeySignatureToken, DSS enum mappings, a bundled-font helper, andDssTrustConfigurerbuilding theCommonCertificateVerifierfromengine.dss.*(fails LT/LTA fast when revocation data is unreachable). Registered viaServiceLoader.net.sf.jsignpdf.types.PadesLevel; newBasicSignerOptions.padesLevel(persisted, copied, in equals/hashCode).-pl/--pades-level(B/T/LT/LTA), plus the matchingEngineMismatchValidatorrule so unsupported levels fail fast.engine.dss.*trust keys.--tsa-hash-alg, Swing dialog, properties) is now canonicalised ingetTsaHashAlgWithFallback(), so a lowercase entry such assha256no longer NPEs in iText (setDigestName) or throws in DSS (DigestAlgorithm.forJavaName). Fixes [Question] TSA: org.bouncycastle.asn1.ASN1ObjectIdentifier.<init> 'identifier' cannot be null #126 / One working piece of timestamping settings please #181.dss-bom6.4 import + managed dep in the root pom, the new module in the engines aggregator, a runtime dep indistribution, andlicenseMergeentries for the new DSS/JAXB transitive license names.messages.propertieskeys;JSignPdf.adoc(--pades-levelrow + "PAdES & the DSS engine" section, plus a visible-signature placeholder table calling out${timestamp}for showing the signing date/time — Show time/date on signature #114),3.1.0release notes, and README.Related issues
Selecting
-eng dss(withengine.dss.online.enabled=trueor local trust material for LT/LTA) closes the review's LTV-compliance cluster, which the OpenPDF engine structurally cannot satisfy:CRLInfopath is not used bydss).Also addressed:
${timestamp}).--overwrite(rejected by the always-incrementaldssengine).OnlineTSPSource; TSA nonce is still not implemented.EncryptionAlgorithm.forKey) instead of the hardcoded RSA cast, so EC keys should sign through thedsspath. Worth confirming with an EC PKCS#11 token.Not covered: #255 (RSASSA-PSS) — the token still produces RSA PKCS#1 v1.5, not PSS.
Verification
engines/dsstests pass (signing B / visible signature / LT-fails-offline / capabilities), incl. checkstyle + license check.jsignpdftests pass, with added--pades-levelcases in the validator / registry / cmdline suites and a newgetTsaHashAlgWithFallbackcanonicalisation regression test.lib/contains the DSS jars;--list-engineslistsdss; an end-to-end CLI sign with-eng dss -pl Bsucceeds, and-eng openpdf -pl LTAfails fast with the capability-mismatch message.Notes
dssis selected (license-compatible with JSignPdf's dual MPL-2.0 / LGPL-2.1).🤖 Generated with Claude Code