Two Passwords, Two Different Jobs
A PDF can carry a user password, required to open and decrypt, and an owner password, intended to guard permissions. When the user password is empty, the file opens without a prompt and the owner password only controls whether the viewer enforces printing, copying and editing. Many unlock requests are this case: the content is readable, but the permission bits are restrictive.
The encryption dictionary names the security handler, usually /Standard for password security, the revision /R 2 through 6, the key length, and crypt filters for strings and streams. /O stores the owner validation value, /U the user validation value, and /P a signed 32-bit permission mask. A tool cannot invent the key; it derives one from a supplied password and checks it against /U or /O.