Skip to content
PressJetDocs Docs v0.1.0-beta.9 GitHub
Edit this page
Source docs v0.1.0-beta.9 Install v0.1.0-beta.7
On this page

PDF signatures: PAdES, validation and encryption

Pressjet signs PDFs at the four PAdES baseline levels (ETSI EN 319 142-1), validates signed PDFs from any producer, and protects PDFs with AES-256 passwords. The signing core is the pressjet-pades crate: Rust, no browser, no network of its own.

Level What it adds Needs
B-B A CAdES detached signature bound to the signer's certificate A certificate and its key
B-T An RFC 3161 time-stamp that proves when the signature existed A time-stamp authority (TSA)
B-LT The certificates and OCSP or CRL answers needed to validate it later, in the PDF's DSS Access to the issuers' OCSP or CRL servers
B-LTA A document time-stamp over all of it, renewable before it expires The TSA again

Every signature is an incremental revision: a PDF can collect any number of signatures and each stays valid. Levels above B-B are added without the key, so the signing worker never touches the network.

Sign over HTTP

POST /v1/sign with the server's certificate (PRESSJET_SIGNING_P12_BASE64 and PRESSJET_SIGNING_P12_PASSPHRASE; RSA 2048 bits or more, or ECDSA P-256, P-384 or P-521).

{
  "version": 1,
  "pdf": "<base64>",
  "signature": {
    "name": "Ada Lovelace",
    "reason": "Approved",
    "level": "B-LTA",
    "certify": 2,
    "visible": { "page": 1, "rect": [72, 72, 272, 132] },
    "lock": { "action": "include", "fields": ["Total"] },
    "digest": "SHA-256"
  }
}
Field Meaning
level B-B (default), B-T, B-LT, B-LTA. Above B-B the server needs PRESSJET_TSA_URL.
certify true or 1: no changes allowed afterwards; 2: form filling and signing; 3: also annotations. Only the first signature may certify.
field Sign this empty signature field, or name the new one.
visible Page, rectangle [left, bottom, right, top] in points, and optional lines of text.
lock Lock form fields once signed: all, or include/exclude a list of fields.
digest SHA-256, SHA-384 or SHA-512.
rsaPadding pkcs1 (default) or pss, for RSA keys.

Configuration for levels above B-B:

Variable Meaning
PRESSJET_TSA_URL The RFC 3161 time-stamp authority. The server reaches no other host for time-stamps.
PRESSJET_TSA_AUTHORIZATION An Authorization header value for a commercial TSA.
PRESSJET_REVOCATION_HOSTS Comma-separated OCSP and CRL hosts the server may contact for B-LT and B-LTA. Unset: the hosts your own certificates name.

Validate

POST /v1/validate-signatures with pdf and trustAnchors (PEM text; or set PRESSJET_TRUST_ANCHORS to a PEM file). The answer lists every signature and document time-stamp:

{
  "valid": true,
  "signatures": [{
    "field": "Signature1", "kind": "signature", "indication": "PASSED", "level": "B-LTA",
    "signer": { "subject": "CN=Ada Lovelace,O=Example,C=US" },
    "algorithm": "ECDSA with SHA-256",
    "proofOfExistence": "2026-12-03T10:00:00Z",
    "modifications": { "level": "validationData", "details": [] },
    "errors": [], "warnings": []
  }]
}

indication follows ETSI EN 319 102-1: PASSED, FAILED (tampered, revoked, wrong key usage, forbidden algorithm, modified beyond what the certification allows) or INDETERMINATE (untrusted chain, expired without a time-stamp, missing revocation data). The server validates offline, from the PDF's own DSS: a PDF's certificates choose the OCSP and CRL URLs, so fetching them would let anyone make the server call arbitrary hosts. Sign at B-LT or B-LTA, or validate with the CLI's --online and an explicit host list.

What validation checks, beyond the cryptography:

  • The byte range starts the file, its only gap is exactly the signature's /Contents, and it ends a revision (signature wrapping).
  • Every object changed after a signature is classified; redefining page content, resources or a locked field fails the signature (incremental saving and shadow attacks).
  • The certificate that verifies is the one the signature names (ESS signing-certificate-v2).
  • SHA-1, MD5, RSA below 2048 bits and unknown curves fail, in signatures, certificates, OCSP answers and CRLs.

Encrypt

POST /v1/encrypt with pdf and encryption:

{ "version": 1, "pdf": "<base64>",
  "encryption": { "ownerPassword": "…", "userPassword": "…", "permissions": ["print", "copy"] } }

AES-256 only (PDF 2.0, V5 R6). Signed PDFs are refused: encryption rewrites every string and stream, which breaks their signatures.

SDKs

SDK Sign with PAdES options Validate Encrypt
Python client.sign(..., level=, certify=, field=, visible=, lock=, digest=, rsa_padding=) client.validate_signatures(pdf, trust_anchors=) client.encrypt(pdf, owner_password=, ...)
TypeScript pressjet.sign(pdf, { level, certify, field, visible, lock, digest, rsaPadding }) pressjet.validateSignatures(pdf, { trustAnchors }) pressjet.encrypt(pdf, { ownerPassword, ... })
Go client.Sign(ctx, pdf, SignatureDetails{Level, CertifyLevel, Visible, Lock, ...}) client.ValidateSignatures(ctx, pdf, &ValidationOptions{...}) client.Encrypt(ctx, pdf, EncryptOptions{...})
PHP $pressjet->sign(..., level:, certify:, visible:, lock:, digest:) $pressjet->validateSignatures($pdf, trustAnchors:) $pressjet->encrypt($pdf, ownerPassword:, ...)

Command line

pressjet signatures validate signed.pdf --trust root.pem
pressjet signatures validate signed.pdf --trust root.pem --online ocsp.example.com,crl.example.com --json
pressjet signatures extend signed.pdf --level B-LTA --tsa https://tsa.example.com \
  --online ocsp.example.com -o archived.pdf

extend on a B-LTA document adds a new archival time-stamp: run it before the last one's TSA certificate expires to keep the signatures verifiable.

Rust

use pressjet_pades::{sign, validate, AlgorithmPolicy, Level, Services, SignatureOptions,
    SoftwareKey, TrustStore, ValidationPolicy};

let key = SoftwareKey::from_pkcs12(&archive, &passphrase)?;
let signed = sign(&pdf, &SignatureOptions { name: Some("Ada".into()), ..Default::default() },
    Level::BB, &key, Services::default(), &AlgorithmPolicy::default())?;
let report = validate(&signed, &ValidationPolicy::new(TrustStore::from_bytes(&root_pem)?), None)?;

Keys can live elsewhere; every provider's signature is checked against its certificate before it is embedded:

Provider Type Notes
PKCS#12 or PKCS#8 in memory SoftwareKey Wiped from memory when dropped.
PKCS#11 token or HSM provider::pkcs11::Pkcs11Key (feature pkcs11) Found by label; RSA PKCS#1 v1.5, RSA-PSS, ECDSA.
AWS KMS provider::remote::KmsProvider with KeyService::AwsKms SigV4 with AwsCredentials; MessageType: DIGEST.
Azure Key Vault KmsProvider with KeyService::AzureKeyVault Bearer token (static or managed identity).
Google Cloud KMS KmsProvider with KeyService::GoogleKms Bearer token (static or metadata server).
Anything that can sign a digest CallbackProvider A closure.
A signer that answers later prepare_signature + cms::PendingCms Send PendingCms::digest(), then finish with the signature and PreparedPdf::embed.

pressjet_pades::evidence adds what an e-signature workflow records around the PDF: a hash-chained AuditTrail, a CompletionCertificate sealed as a time-stamped CMS that openssl cms -verify can check, and qr_payload for a signed QR code. They record what the platform decided; identity verification and consent capture stay with the platform.

Interoperability and compliance

Output is checked in CI with pyHanko (including ETSI AdES LTA validation, offline) and poppler's pdfsig; Adobe Acrobat has not been tested automatically. The evaluation against ISO 32000-2, ETSI EN 319 142-1 and 319 102-1, RFC 5280, 3161 and 6960 is in plans/digital-signatures/compliance.md. Pressjet provides building blocks for eIDAS, ESIGN and UETA workflows; it has not been assessed or certified against any of them.