A PIN can protect encryption keys when an app uses the PIN to derive an unlocking key, then uses that unlocking key to decrypt or unwrap the separate random key that actually encrypts your files. In a sound design, the PIN is not itself the file-encryption key. It is one part of a local access-control system that should also use a unique salt, a deliberately costly key-derivation function, authenticated encryption, and meaningful limits on repeated guesses. Without those safeguards, a short PIN may only act as a screen lock—or may be vulnerable to rapid offline guessing if someone obtains the encrypted data and supporting key material.
This distinction matters because privacy should not require users to become cryptographers. A PIN is easy to use every day; the app’s job is to turn that convenient action into a carefully designed barrier around the cryptographic keys that protect local data.
The roles of the PIN, encryption key, and wrapped key
An encryption key is a high-entropy secret, usually generated randomly by software. A PIN is a short secret chosen or entered by a person. They serve different purposes: the encryption key protects data cryptographically, while the PIN can control access to that key.
- Data-encryption key (DEK): a random key used to encrypt a file, database, or local vault.
- PIN: a human-entered secret used to authorize access.
- Key-encryption key (KEK): a key derived from the PIN and used to protect the DEK.
- Wrapped key: the encrypted form of the DEK, stored alongside the encrypted data rather than in readable form.
Key wrapping means encrypting one key with another key. It lets an app encrypt data with a strong random DEK while allowing the user to unlock that DEK through a PIN-based process. The PIN does not need to be stored; the app derives the same KEK again when the correct PIN is entered.
For a broader explanation of why a password or PIN is not interchangeable with a cryptographic key, read our guide to encryption keys versus passwords.
How PIN-derived key protection works
A typical local design follows a sequence like this: