PDF Encryption

A security layer applied to a PDF that requires a password to open or to perform certain operations such as printing or copying text.

PDF encryption applies a cryptographic lock to a document, requiring anyone who opens or modifies it to provide the correct password. Beyond access control, PDF encryption also enables a fine-grained permission system — you can allow a recipient to read and print a document but forbid them from copying text, editing content, or adding annotations.

Encryption in PDF is implemented through a security handler. The most widely used is the Standard Security Handler, which supports two passwords: a user password (required to open the document) and an owner password (required to change the permissions or remove encryption). These two passwords can be different, or either can be empty.

PDF encryption has evolved through several generations of algorithms. Early PDFs used 40-bit RC4 (PDF 1.1–1.3), which is trivially broken today. PDF 1.4–1.6 moved to 128-bit RC4. PDF 1.6 and later support 128-bit AES (Advanced Encryption Standard). PDF 2.0 mandates 256-bit AES — the current standard that, when correctly implemented, is computationally infeasible to brute-force.

User password vs owner password

PDF's two-password system serves different roles:

**User password (open password)** — When set, anyone who tries to open the PDF must enter this password. Without it, the document cannot be viewed at all. If no user password is set, the document opens freely but may still have permissions restrictions.

**Owner password (permissions password)** — Controls who can change the document's permissions, remove encryption, or perform restricted operations. An owner can always access and modify the document. A user with only the user password is bound by the permissions the owner set.

In practice, many encrypted PDFs are distributed with only an owner password and no user password. This means anyone can open and read the document, but the permissions restrictions are enforced — for example, printing is disabled. The security of this arrangement depends entirely on whether the PDF viewer enforces the restrictions, since the document itself is readable.

Encryption algorithms and strength

The algorithm used determines how resistant the encryption is to attack:

**RC4 (40-bit and 128-bit)** — Used in PDF 1.1 through 1.5. 40-bit RC4 can be broken in seconds with modern hardware. 128-bit RC4 is substantially stronger but still vulnerable to certain attack types and is considered deprecated.

**AES-128** — Introduced in PDF 1.6. Strong encryption that remains computationally secure against brute-force attacks for typical passwords.

**AES-256** — Introduced in PDF 1.7 Extension Level 3 and mandated by PDF 2.0. Current gold standard. With a strong password, AES-256 encrypted PDFs cannot be brute-forced in any practical timeframe.

**Password strength matters more than algorithm** — A 256-bit AES encrypted PDF with the password "password" can be cracked in under a second using a dictionary attack. A 128-bit AES encrypted PDF with a randomly generated 20-character password is effectively unbreakable. The algorithm sets the ceiling; the password determines the actual security.',

PDF permissions flags

When an owner password is set, the owner can configure a set of permission flags that restrict what a user can do with the document. The standard permission flags include:

**Printing** — Allow or disallow printing. Can be further split into high-quality printing vs low-resolution printing only.

**Modifying the document** — Allow or disallow changes to page content, other than filling forms and adding signatures.

**Copying text and graphics** — Allow or disallow selecting and copying text or images from the document.

**Adding or modifying annotations and form fields** — Allow or disallow adding comments, filling forms, or adding digital signatures.

**Accessibility (screen reader) access** — Some implementations allow a separate flag for accessibility tools to extract content even when copying is otherwise disabled.

These flags are enforced by the PDF viewer. Compliant viewers respect them; non-compliant tools or direct file manipulation can ignore them. Permissions restrictions should be understood as a deterrent against casual misuse, not a cryptographic guarantee against a motivated adversary with access to a PDF manipulation library.

Frequently asked questions

What is PDF encryption?

PDF encryption applies a cryptographic lock to a document using a password. An encrypted PDF requires the correct password to open (if a user/open password is set) and can restrict operations like printing, copying, or editing via a permissions system controlled by a separate owner password.

What is the difference between a user password and an owner password in a PDF?

A user password (open password) must be entered to open the document at all. An owner password controls the document's permissions and encryption settings. A document can have one, both, or neither. If only an owner password is set, anyone can open the document but restrictions on printing, copying, and editing are enforced.

Which PDF encryption algorithm should I use?

Use AES-256, which is defined in PDF 2.0 and PDF 1.7 (Extension Level 3). Avoid RC4 (PDF 1.1–1.5) — 40-bit RC4 is broken and 128-bit RC4 is deprecated. AES-128 is acceptable but AES-256 is preferred for any documents requiring long-term protection.

Can PDF permissions be bypassed?

Permissions flags are enforced by the viewing software. Compliant viewers respect them, but PDF manipulation libraries and some tools can ignore permissions restrictions entirely — especially when no user/open password is set. Permissions are a deterrent against casual misuse, not a guarantee of security.

If I forget the PDF password, can I recover it?

Possibly — if the password is weak, dictionary and brute-force attacks can recover it. For short, common passwords on older RC4-encrypted PDFs, recovery tools are readily available. For AES-256 encrypted PDFs with a strong random password, recovery is computationally infeasible.