Originally Posted By: Virtual1
BUT... what it comes down to is this: it doesn't matter if files or memory are encrypted. SOMEWHERE the key has to exist. From what I've seen there are at least two interesting keys. The first is the one being used to encrypt the ram. it has to BE IN RAM somewhere to be getting used.

Nope. The key is stored in a special-purpose processor register. It is not stored in RAM.

When you lock the device, the key is discarded. When you enter your passcode, the key is recalculated, as a function of the passcode you entered and a device-specific 256-bit unique identifier burned into the silicon during the manufacturing process.

The code to calculate the key uses special instructions that use the unique identifier without revealing what it is. Even the OS cannot determine the unique id.
Consequently, the unique ID is not and cannot be saved in any backup, sent across any network to anywhere, nor stored in RAM. The unique ID is generated randomly at the factory in a cryptographically secure manner, so even Apple does not and cannot know even what IDs have ever been used, let alone on which devices.

The function that computes the key from the passcode MUST run on the phone itself. It cannot be offloaded to a supercomputer or gate array or anything like that, because no such device has access to the unique ID. Even on the phone, the calculation takes on the order of 5 seconds, to discourage brute force attacks. (Apple achieves this by iterating the function several thousand times, with the output of each iteration being fed as input to the next. The passcode goes into the first iteration, and the final key is the output of the final one. The unique ID is used on each iteration.) The final key is then used to decrypt the SSD's encryption key into a machine register.

Even if you made an exact copy of all of RAM and all of the SSD onto another iPhone of the same exact model, and entered the same passcode, it would not work. The other iPhone would have a different unique ID, so the final key would come out wrong, and decrypting would yield only useless garbage.

On the iPhone 5s, Apple pushes this work onto the Secure Enclave, a separate processor (on the same chip as the CPU but not sharing any registers or RAM with it). The Secure Enclave has its own independent on-chip NVRAM where it stores its own secrets (like your fingerprint data). The Secure Enclave talks to the rest of the system only over serial communications lines, and does not divulge any of its secrets. It will encrypt/decrypt data on request, but will not reveal the keys it's using to do that. For extra security, even the Secure Enclave discards keys that are not needed but can be recalculated.

Peeling the Secure Enclave apart an atom at a time would destroy the unique ID; it would not reveal it. Well, it might, if it were really an atom at a time, but "atom at a time" is hyperbole. No one has the capacity to store that much data, let alone interpret it. There are a lot of atoms in even a single logic gate. What's really being described is a process wherein the chip is peeled back in layers, each a few atoms thick, and each newly exposed layer is examined under an electron microscope to try to discern where the transistors are and how they're connected. But if the data is stored as a doping differential, say N-doping for a "0" and P-doping for a "1", there would be nothing for the electron microscope to see.