PDFDock Logo
PDFDockFile processor
Security & Privacy10 min readUpdated Sep 5, 2026

How Digital Signatures Work in PDF: PKI Cryptography, Hashes & Document Integrity Verification

In business and legal environments, the term 'signature' is frequently applied to two vastly different concepts: pasting a PNG scan of a handwritten signature onto a page versus sealing a document with a Public Key Infrastructure (PKI) cryptographic digital signature. This technical guide explains how ISO 32000 digital signatures work under the hood, how the /ByteRange array creates a tamper-proof cryptographic seal, and how certificate validation works across global legal frameworks.

PDFDock Security Research
Cryptography & Document Integrity Specialists

Key Technical Takeaways

  • An electronic signature (such as a pasted bitmap image) provides zero mathematical proof against post-signing document tampering.
  • A cryptographic digital signature uses asymmetric public-key cryptography (RSA/ECDSA) and cryptographic hashes (SHA-256) to seal the file.
  • The PDF /ByteRange dictionary defines the exact byte offsets hashed by the signature, excluding only the signature container itself.
  • Modifying even a single whitespace character or punctuation mark in a digitally signed PDF breaks the cryptographic hash, invalidating the seal.

Table of Contents

1. Electronic Signatures vs Cryptographic Digital Signatures

In legal jurisprudence (including the US ESIGN Act and EU eIDAS regulation), signatures are categorized into distinct security tiers: ### Simple Electronic Signature (SES) A simple electronic signature is any electronic sound, symbol, or process associated with a contract—such as typing your name into a web form, drawing a signature with your mouse, or pasting a transparent PNG image of your handwritten autograph onto a PDF using an image overlay tool. **Critical Limitation**: A simple electronic signature contains no cryptographic bond to the document content. Anyone can open the PDF in an editor, alter the financial figures or contract terms, and leave the pasted signature image completely untouched. ### Cryptographic Digital Signature (AdES / QES) A digital signature is a mathematical cryptographic construct based on public-key infrastructure. It does not merely represent intent; it cryptographically binds the signer's verified identity to the exact binary byte sequence of the document.

Pasting an image of a signature onto a PDF is visually appealing, but it provides zero forensic protection against fraudulent alteration. Only cryptographic digital signatures can mathematically prove that a contract has not been altered.

2. The Mathematical Foundation: Hashes and Asymmetric Keys

The cryptographic sealing of a PDF document relies on two mathematical cornerstones: 1. **Cryptographic Hash Function (SHA-256)**: The document byte stream is passed through a collision-resistant hash algorithm. This calculates a fixed-size 256-bit hexadecimal string (the 'message digest'). If even a single bit in the 50-page document changes, the resulting SHA-256 digest changes unpredictably (the avalanche effect). 2. **Asymmetric Key Pair (Public & Private Keys)**: - The signer holds a secure **Private Key** (kept in a hardware token, HSM, or encrypted keystore). - The document's SHA-256 hash is encrypted using the signer's Private Key to generate the digital signature. - Anyone in the world can use the signer's **Public Key** (embedded in an X.509 digital certificate) to decrypt the signature and verify that it matches the document hash.

3. Inside the PDF Byte Stream: The /ByteRange Architecture

A fundamental mathematical problem arises when signing a file: how can a document contain its own digital signature without altering its own cryptographic hash? The PDF specification solves this with the **/ByteRange** array inside the Signature Dictionary (/Sig): ``` /ByteRange [0, 84020, 96020, 142050] ``` This array specifies four integer offsets: - **Range 1**: From byte 0 to byte 84020 (the beginning of the file up to the signature value). - **Range 2**: From byte 96020 to byte 238070 (the file contents immediately after the signature value to the end of the file). The byte gap between 84020 and 96020 is where the hexadecimal PKCS#7 / CMS signature container is stored. The hash is computed over all bytes **except** the signature placeholder itself!
Signature ParameterPDF Dictionary KeyFunctionStandard Used
Filter/FilterSpecifies the signature handlerAdobe.PPKLite
SubFilter/SubFilterEncoding standard of signature payloadadbe.pkcs7.detached / ETSI.CAdES.detached
Byte Range/ByteRangeArray defining exact byte regions covered by hashISO 32000-1 clause 12.8
Certificate Chain/CertX.509 public key certificate of signerITU-T X.509 v3

4. Certificate Authorities, Timestamping (TSA) & Long-Term Validation (LTV)

For a digital signature to remain legally binding years into the future, it requires three supporting trust anchors: 1. **Certificate Authority (CA)**: A trusted third-party issuer (such as DigiCert, Sectigo, or government root CAs) that verifies the signer's legal identity before issuing the certificate. 2. **RFC 3161 Timestamp Authority (TSA)**: If a certificate expires after two years, how can you prove the document was signed while the certificate was still valid? A trusted timestamp authority signs a cryptographically verified timestamp ticket that is bundled into the PDF. 3. **Long-Term Validation (LTV / PAdES)**: The PDF embeds the Certificate Revocation List (CRL) or Online Certificate Status Protocol (OCSP) response directly into the Document Security Store (/DSS). This enables readers to validate the signature offline even if the issuing CA server is unavailable years later.

5. How PDF Readers Detect Document Tampering

When you open a signed PDF in Adobe Acrobat or another compliant viewer: 1. The reader reads the /ByteRange coordinates and recalculates the SHA-256 hash of those byte segments. 2. The reader decrypts the signature value using the public key from the embedded certificate. 3. If the computed hash matches the decrypted hash exactly: **'Signed and all signatures are valid. The document has not been modified since this signature was applied.'** 4. If someone added a page, merged an attachment, or edited text: **'Signature is INVALID. The document has been altered or corrupted since it was signed.'**

Frequently Asked Questions

Can I add a password to a digitally signed PDF?▼

Encrypting a PDF with a password after it has been digitally signed alters the document byte stream, which breaks the cryptographic hash and renders the signature invalid. Any encryption must be configured during initial authoring before signing.

What happens if I use 'Merge PDF' or 'Rotate PDF' on a signed document?▼

Tools that modify page layout or re-serialize PDF byte streams will invalidate existing cryptographic digital signatures. Always perform merges, rotations, and page removals before applying final digital signatures.

Is an electronic signature image legally valid?▼

In many jurisdictions, simple electronic signatures are legally acceptable for basic agreements if both parties agree. However, for high-stakes transactions, real estate, and court filings, qualified cryptographic digital signatures are strictly required.

Does PDFDock store my private signing keys?▼

No. PDFDock runs 100% locally inside your client-side browser sandbox. No documents, keys, or certificates are ever uploaded or transmitted to external servers.

Recommended PDFDock Tools for This Guide

Related Guides & Analyses