How PDF Encryption Works: Keys, Passwords and AES
Understand what a PDF password actually protects: the separate encryption key, user and owner passwords, and why AES-256 is the safe choice.

On this page (14 sections)โผ
TL;DR: A PDF password does not encrypt the file by itself. The file is encrypted with a random key, and the passwords protect that key. Choose AES-256, remember that restrictions are enforced by software, and treat the algorithm, the password and the key handling as three separate decisions.
Why it helps to understand the machinery
Most people meet PDF encryption as a dialog box with a password field. Behind that box sits a design that explains several puzzling behaviors: why a file can be encrypted yet open with no password, why changing a password may not mean the content is safe from someone holding an old copy, and why permission restrictions can be ignored by some software. Understanding the design takes about ten minutes and makes every later decision easier.
This guide explains the concepts in plain language, using the documentation of qpdf, an open-source PDF tool, as its main source, along with NIST's description of the Advanced Encryption Standard and the Library of Congress description of PDF 2.0. It is general information, not security-engineering advice. It is part of a cluster that starts with the PDF security guide.
Encryption: clear text becomes ciphertext

The qpdf documentation defines encryption as the replacement of clear text with encrypted text, known as ciphertext, from which the clear text can be retrieved if the encryption key is known. It explains that a PDF file is made of objects such as numbers, strings, arrays, dictionaries and streams, and that only strings and streams are encrypted. That detail matters because the file's overall structure, such as the number of pages or the presence of an encryption dictionary, remains visible to software that opens it, even though the readable content is protected.
For a reader this means two things. A tool can tell that a file is encrypted without knowing the password, which is how a check of whether a PDF is encrypted works. And encryption protects the content of strings and streams, not the fact that the file exists or its size, so file names and storage locations still need care.
The key is not the password
The most useful idea in the documentation is that the encryption key is distinct from the password. The main key is generated at random and stored, encrypted, inside the PDF. The passwords are used to protect that key. As a result, different passwords can retrieve the same key, and it is possible to change the password on a file without changing the key.
This design has a consequence that surprises people. If a tool changes a password without generating a new key, anyone who already holds an earlier copy of the file and knew the old password can still recover the key from that earlier copy. Changing the password on a file you share is therefore not the same as re-protecting the content. The article on what to do when a PDF password leaks turns this into a response plan.
User passwords and owner passwords

The standard security handler is password based and, according to the documentation, intended to have two passwords: a user password and an owner password. Either can be used to retrieve the key. A conforming reader is supposed to obey the security restrictions if the file is opened with the user password, but not if it is opened with the owner password.
Because of this, it is common to see files encrypted with no password protection at all. The author sets the user password to the empty string and the owner password to a secret string. When someone opens the file, the empty string retrieves the key, the file displays, and a well-behaved reader restricts certain operations. If you want only people with a password to open the file, you need a real user password. The existing guide on open and permissions passwords shows how to tell which you have.
Restrictions are enforced by software
The qpdf documentation is direct about what restrictions can and cannot do. Since the user password and the owner password are both used to recover the single encryption key, there is fundamentally no way to prevent an application from disregarding the restrictions on a file. Any software that can read the encrypted file at all has the encryption key, so the restrictions are enforced solely by software, and an open-source reader could be trivially modified to ignore them. For files without a password to open them, restrictions only restrict users who do not know how to circumvent them.
The restrictions themselves are stored as a field of permission bits. The documentation lists permissions for printing, printing at full resolution, modifying the document, extracting text and graphics, adding annotations or filling in forms and assembling pages. It notes that the specification now disallows restricting accessibility, so readers treat that permission as granted. If you need to stop a recipient from copying content, a permission bit is not the right tool; see the article on stopping people downloading a shared PDF for realistic options.
Algorithms: 40-bit, RC4 and AES

The documentation describes the history of the standard security handler through parameters called V and R. The original algorithm used 40-bit keys; later revisions allowed longer keys; V equal to 5 supports 256-bit keys and is the encryption system in the PDF 2.0 specification. It states that PDF files may be encrypted with the obsolete, insecure RC4 algorithm or with the more secure AES algorithm. Forty-bit encryption always uses RC4, 128-bit encryption can use RC4 or AES, and 256-bit encryption always uses AES.
It then gives the security assessment. A 40-bit key is only five bytes long and can be easily brute-forced, so such files are not secure regardless of password strength. With 128-bit keys the default handler uses RC4, which is also known to be insecure. As of the chapter's last review in 2022, the only secure way to encrypt a PDF with the standard security handler is AES. The documentation adds that there is no reason to use 128-bit AES when 256-bit is available, and that the security of a 256-bit AES-encrypted PDF with a strong password is comparable to using a general-purpose tool such as gpg or openssl with the same password, with the advantage that only a normal PDF viewer is needed.
What AES is
NIST's Federal Information Processing Standard 197 specifies the Advanced Encryption Standard. NIST's page explains that in 2000 NIST announced the selection of the Rijndael family of block ciphers as the winner of the AES competition, that three members are specified, AES-128, AES-192 and AES-256, that each transforms data in blocks of 128 bits and that the numerical suffix indicates the bit length of the keys. The standard was first published on November 26, 2001 and updated on May 9, 2023. See NIST's FIPS 197 page.
You do not need to understand the mathematics to use it well. What matters is that AES is a long-established, openly specified algorithm, that the longer key size is preferred for new files and that the strength of the result still depends on the password that protects the key.
What PDF 2.0 changed
The Library of Congress description of PDF 2.0, defined in ISO 32000-2, says that weak encryption schemes and algorithms are deprecated and that only AES-256 used in a secure scheme is encouraged. The qpdf documentation adds that of the revisions of the standard handler, revision 6 is the only one that is not deprecated in the PDF 2.0 specification. The PDF 2.0 article explores what that means in practice for older files and tools.
Putting it together: a decision sequence
When you protect a PDF, make four decisions in order.
- Should the file need a password to open? If yes, set a real user password. If the goal is only a courtesy restriction, say so honestly.
- Which algorithm? Choose AES-256 whenever your tool offers it, and avoid any option labelled 40-bit or RC4.
- Which password? Use a long passphrase generated and stored in a password manager; see the guide on PDF password length and storage.
- How will the file and password travel? Send them separately and prefer a controlled link to an attachment; see the password channel guide.
Writing the sequence on one page and attaching it to your handling policy turns understanding into habit.
A hypothetical example
This scenario is invented for illustration. A bookkeeper receives a request from a client to protect a quarterly report. Their software offers three encryption choices labelled 40-bit, 128-bit and 256-bit. Using what they have learned, they pick 256-bit, set a user password generated by their password manager and leave the owner password also set to a separate generated value. They test the file by opening it in two different readers, then send the file through a client portal and the password by phone. A year later the client asks for an updated copy. The bookkeeper creates a new file from the source with a new password rather than editing the old protected file, because a new file gets a new key.
Testing what you made
Always test an encrypted file as a recipient would. Open it in at least two readers, including the free reader your recipients are most likely to use. Check that it asks for the password, that the restrictions you expect appear in the document properties and that nothing unexpected, such as a different title, is visible before the password is entered. If your tool offers an option to encrypt metadata, note what it does and test it. The existing guide on password protecting a PDF offline describes a local workflow that avoids uploading the file to an unknown service.
Common mistakes
- Believing that the password and the key are the same thing.
- Choosing 128-bit settings because they are the default.
- Using only an owner password and expecting people to need a password to open the file.
- Changing the password on a file that has already been distributed and assuming it is safe.
- Sending the file and password in the same message.
- Testing only in the reader you used to create the file.
Official references
The open-source qpdf project's chapter on PDF encryption is the main technical reference used for the statements about keys, passwords, restrictions and algorithms in this guide. What changed in the newer standard is summarized in the Library of Congress page on PDF 2.0 (ISO 32000-2).
Frequently asked questions
Does a PDF password encrypt the file directly?
Not exactly. The file is encrypted with a randomly generated key, and the password is used to protect that key. That is why different passwords can unlock the same content.
Can a file be encrypted without a password to open it?
Yes. A file can have an empty user password and a secret owner password, so anyone can open it while readers apply the restrictions.
Is AES-256 always better than AES-128?
For PDF files, the qpdf documentation says there is no reason to use 128-bit AES when 256-bit encryption is available.
Are permission restrictions secure?
They are enforced by software, so a tool that ignores them can bypass them. Treat them as a courtesy.
Why shouldn't I just change the password after a leak?
Because changing a password may not change the key, someone with an earlier copy and the old password may still be able to read it. Create a new protected file from the source instead.
Does encryption hide that a file exists?
No. It protects the content of strings and streams, not the file's existence, name or approximate size.
Keep reading: PDF security
Sources and editorial disclosure
The pages below were opened and read on November 22 and 23, 2026 for the factual statements attributed to them. Agency guidance, standards descriptions and tool documentation change, so check the current text before relying on a version number, a setting or a recommendation.
VDR Directory is published by the SendNow team. This guide is general information about protecting documents, not legal or security-engineering advice; your counsel, security lead and the software you use decide what applies to your situation. Scenarios marked as hypothetical are invented for illustration and are not drawn from real clients or transactions. Stock photos illustrate the topic and do not show real files, systems or accounts.
More on PDF security
Encryption, passwords, hidden data, safe sharing, backups and disposal for confidential PDF files.
PDF Security Guide: Encryption, Passwords and Sharing
A practical guide to protecting PDF files: how encryption and passwords work, what restrictions can and cannot do, hidden data, safe sharing and disposal.
Keeping PDF Readers and Software Updated
Why updates matter for the software that opens your PDFs, how to turn on automatic updates, and how to track what your team actually runs.
Can Recipients Edit a PDF You Share?
Sharing a file as a PDF does not stop editing. What recipients can still do, what restrictions really enforce, and how to choose controls that fit.
PDF/A for Archiving: What It Forbids and Why
PDF/A is built for long-term preservation, so it bans encryption, JavaScript and external dependencies. Learn what that means for confidential files.
PDF Security Glossary: Terms Teams Mix Up
Plain-language definitions of the terms that cause confusion in PDF security: encryption, key, user and owner password, restrictions, PDF/A and more.
Handle Encrypted Files Your Scanner Cannot Check
An encrypted attachment your scanner cannot inspect is not a clean file. Use a controlled hold, verify the sender, and arrange authorized review.

About the Author: Ben Wallace
Ben Wallace is an SEO analyst with hands-on experience in virtual data rooms and sales enablement. He writes about how data rooms are used, how document sharing supports sales teams, and how to compare providers.
