---
title: "Covered bytes and revisions"
description: "Learn which part of a PDF a PDF-PQS signature protects, how PDF revisions work, and how verifiers catch edits made after signing."
---

> Documentation Index
> Fetch the complete documentation index at: https://pdf-pqs.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Covered bytes and revisions

When you add a digital signature to a PDF, the signature cannot include its own bytes (otherwise changing the signature value would change the hash it is signing). Instead, PDFs solve this using **incremental updates**: rather than rewriting the file from scratch, every new signature or edit is appended to the end of the file as a new **revision**, and each revision closes with a `%%EOF` marker.

A PDF-PQS signature takes advantage of this structure. It protects an exact prefix of the file from byte `0` up to byte `L` (written `[0, L)`), where `L` is the exact end of the revision that existed right before the signature was added.

## How L works

When a signer creates a PDF-PQS signature, four simple rules keep the covered bytes unambiguous:

- **L is recorded inside the signature.** The signer stores `L` in a signed attribute called `pdf-byte-length` (OID `N.1.3`). Because this attribute is itself signed, an attacker cannot change `L` without breaking the signature.
- **L must land on a real revision boundary.** A verifier does not just search for the text `%%EOF` (which could appear inside a comment or embedded text). It follows the PDF's internal cross-reference chain to confirm `L` is a genuine revision end (immediately after `%%EOF`, `%%EOF` LF, `%%EOF` CR, or `%%EOF` CR LF).
- **The signature goes right after L.** The revision starting at byte `L` adds the PDF-PQS signature itself (either inside a classical host signature in Place A, or as an attached file in Place B).
- **Later edits never alter `[0, L)`.** Any future signatures, comments, or updates must be appended after the signature revision. That way, the original signed bytes `[0, L)` stay intact forever.

To tie everything together, the signer computes a SHA-512 fingerprint (hash) of bytes `[0, L)` and stores it in the `message-digest` attribute. The ML-DSA signature signs all of those signed attributes at once, cryptographically locking in both the document hash and the exact byte length `L`.

## What a verifier reports

If something is wrong with `L` or with the bytes it covers, a verifier returns a specific result code:

| What happened | Result code | Verification step |
|---|---|---|
| `L` is bigger than the file itself | `E_LENGTH_OUT_OF_RANGE` | 3 |
| `L` does not land on a genuine PDF revision end | `E_NOT_REVISION_END` | 3 |
| At least one byte in `[0, L)` was modified after signing | `E_DIGEST_MISMATCH` | 4 |
| Extra changes or revisions were appended after the signature revision | `W_CHANGES_AFTER_L` (warning) | 12 |

Notice that changes appended *after* `L` produce a **warning**, not a failure. That is intentional and matches how Adobe Acrobat and other classical PDF readers work: the signature over the original version `[0, L)` is still cryptographically valid, but because later PDF revisions can hide or visually alter pages, verifiers must alert users whenever anything was added after the signature.

## Multiple signatures on one PDF

PDFs often collect several signatures over time (for example, from a buyer, a seller, and a notary). Because every PDF-PQS signature covers `[0, L)` up to its own revision boundary, each new signature automatically covers all earlier revisions, including any previous PDF-PQS signatures.

You can see this in action in the `two-signatures` test vector: when the second signature is added in a new revision, it covers the first signature, and the verifier reports `W_CHANGES_AFTER_L` on the first signature to let you know a newer revision followed it.

For the full formal rules, see [Section 5](https://pdf-pqs.org/specification/covered) and the definitions in [Section 2](https://pdf-pqs.org/specification/conventions-and-definitions).

Source: https://pdf-pqs.org/concepts/covered-bytes/index.mdx
