Your phone and your laptop
Your phone gets nicked on the tram. Everything is on it: your photos, your chats, your mail, the banking app. And you've protected it with … four digits. Yet the thief doesn't get in, not even if he unsolders the chip and sticks the memory into his own computer. That sounds too good. This chapter explains why it's true anyway, and exactly when it stops being true.
Words you might need
- Full-disk encryption
- Encrypting not one file but the whole storage. Whoever reads out the chip sees only noise. Including the names of your files.
- Security chip
- A second, tiny computer in your device with only one job: keeping keys and checking PIN codes. It has its own memory and its own program, and the ordinary processor can't get into it.
- Throttling
- After a number of wrong attempts that chip waits, and with every further mistake it waits longer. You can't skip past it by restarting the device.
- BFU and AFU
- Before First Unlock and After First Unlock: has the device been unlocked once since it was switched on, or not yet? That distinction decides almost everything on this page.
Everything on the disk sits there as ciphertext
Your device's storage is encrypted from beginning to end with AES, the same cipher from chapter 4. That isn't an extra program running along: there's a piece of hardware between the storage chip and the working memory that decrypts every block on reading and encrypts it on writing. You don't notice a thing, and that's the intention.
| System | What it's called | Is it on by default? |
|---|---|---|
| Windows | BitLocker, and Device Encryption for the automatic variant | Device Encryption comes on by itself on devices that qualify, straight out of the box, with XTS-AES-128. Since Windows 11 version 24H2 many more devices qualify. |
| macOS | FileVault | A Mac with Apple silicon or a T2 chip always encrypts its storage. You add FileVault yourself; that ties the key to your login password. |
| Linux | LUKS | No, you choose it during installation. Virtually every installer offers it with a single tick box. |
| Android | file-based encryption | Yes, and you can't switch it off. Devices that come to market with Android 10 or higher have to use it. |
| iOS | Data Protection | Yes, always. The storage is encrypted from the moment you switch the device on. |
So where is the key?
Here's the real insight. An AES key is 256 bits: a number out of 2256 possibilities, a number with 78 digits. Your code is four digits. Those two can't possibly be the same thing.
Work it out with me. Four digits from 0 to 9 give 10 × 10 × 10 × 10 possibilities:
104 = 10 000
Ten thousand. Expressed in bits that's log2(10 000) ≈ 13.3 bits — a little more than 213 = 8192, a little less than 214 = 16 384. A computer gets through ten thousand possibilities in less than a second. If your PIN were the key, your device would be open in the blink of an eye.
So the PIN isn't the key. The real key is random and 256 bits long, and it lies in a separate chip that checks the PIN and only then releases it.
| Where | What the chip is called |
|---|---|
| iPhone, iPad, Mac | Secure Enclave |
| Windows PC | TPM, Trusted Platform Module |
| Android | StrongBox, the secured key storage. On Google's Pixel devices that's a separate chip called Titan M2. |
That chip also keeps a unique number that was fixed into the silicon at the factory and never comes out of it. The key to your storage is derived from that number and your PIN together. Consequence: unsoldering the storage chip and sticking it in another computer gets you nothing. The unique number stays behind in the device, and without that number there's no key, no matter how many PINs you try.
Why four digits are enough here
In chapter 3 slowness was the weapon: a hash function deliberately turning hundreds of thousands of rounds, so that the attacker takes a fraction of a second per guess instead of a billionth. The same thing happens here, but more radically, and not with calculation but with a clock.
The security chip counts the wrong attempts and simply refuses to answer. Restarting doesn't help — the counter is in the chip, not in the operating system, and after a restart the waiting time even starts running again. These are the real schedules:
| Wrong attempt | iPhone / iPad | Android |
|---|---|---|
| 1–3 | no waiting time | no waiting time |
| 4 | 1 minute | no waiting time |
| 5 | 5 minutes | 1 minute |
| 6 | 15 minutes | 5 minutes |
| 7 | 1 hour | 15 minutes |
| 8 | 3 hours | 30 minutes |
| 9 | 8 hours | 90 minutes |
| 10 | device locked, only recoverable through a computer | 4 hours |
| 12 | — | 36 hours |
| 15 | — | 41 days |
| 19 | — | 9 years |
| 20 | — | no further attempts at all |
Count up what that means. There are ten thousand codes. On an iPhone the thief gets nine of them, and then it's over. On Android he gets nineteen, the last of which costs him nine years. Nineteen out of ten thousand: he has one chance in about 526 if he guesses well, and 1234 or your year of birth are sadly not a good guess.
That is why four digits are enough here and not on a website. On a website the attacker can copy the whole list and guess billions of times a second at home, and the defender has only slowness per guess. Here he can't copy: there's one copy of the key, it sits in one chip, and that chip is counting. Slowness is no longer a delay but a wall.
On the iPhone you can also switch on Erase Data in the passcode settings. The device then wipes itself after ten wrong attempts in a row. Weigh that up against a little brother who likes pressing buttons.
On or off makes a big difference
A device that's completely switched off has the key nowhere. It still has to be worked out from your PIN and the chip number, and until that happens everything in the storage is noise. That's the state before the first unlock: BFU.
But as soon as you've typed in your code once after switching on, the key is in the working memory, and it stays there — even when you lock the screen again. It has to: your phone still has to set off alarms, pull in messages and take calls with a locked screen. That's AFU, after the first unlock, and it's the state your device is in almost all of the time.
Apple makes that explicit with protection classes. The strictest one throws the key away as soon as you lock the screen. The default class for data from third-party apps is called Protected Until First User Authentication and doesn't do that: that key stays in memory until you switch the device off.
In practice: a stolen phone that was switched off is a brick. A stolen phone that was on and had already been unlocked that day is a safe with the key lying on the table inside — still difficult, but this is exactly the difference that forensics companies make their money on. Hence the advice you sometimes hear, which isn't superstition: switch your device fully off if you're really handing it over, or if you're worried about losing it. Restarting is enough — after a restart it's BFU again.
What it doesn't protect against
Disk encryption protects against one thing: someone getting hold of your device while it's locked. Nothing more. If your laptop is open and logged in, everything is simply readable — for you, for the friend who slips in behind it, and for a program you installed by accident. The key is in use at that moment, so everything is neatly decrypted for everybody. The same goes for someone looking over your shoulder, for a screenshot, and for a file you send to a cloud yourself: that leaves decrypted and falls under that cloud's encryption, not your disk's. The key you printed out from chapter 8.1 is just as readable on an unlocked laptop as it is on paper.
This is maths: entropy, or what a secret is worth
How do you measure how secret something is? Not in digits or letters, but in bits: the number of times you have to halve the possibilities to be left with one. A coin toss is 1 bit. A dice is log2(6) ≈ 2.58 bits. Your PIN is log2(10 000) ≈ 13.3 bits. An AES key is 256 of them.
That number is the fairest judgement on a secret, because it doesn't depend on how long it looks. A six-digit code sounds one and a half times as strong as a four-digit one, but it's log2(1 000 000) ≈ 19.9 bits: six and a half bits more, so a hundred times harder. The chip in your phone adds nothing itself — it supplies no extra bits, it limits the number of times you're allowed to guess. That's a different defence, and that's why it only works as long as the chip is playing along.
Counting bits as a measure of uncertainty comes from Claude Shannon, who wrote it down in 1948 in A Mathematical Theory of Communication. That field is called information theory, and it's just as much about how you compress a photo or how a radio signal gets through the noise. Encryption is only one corner of it.