I'm trying to understand an implementation detail of Apple's data protection in iOS: I know about the per-file encryption and the various key encryption classes and keybags; however, I don't understand how that works for file transfer over USB (e.g. for iTunes backups).

When backing up data to iTunes over USB, does the iOS device decrypt the file internally, or is it sent in its encrypted form, and iTunes performs the decryption (using the various class keys contained in the Escrow Keybag)?

The former possibility seems more plausible, since in newer versions of iOS, the Escrow Keybag is supposedly encrypted with a key only known to the iOS device, so I suspect that the procedure looks something like this:

  1. The host authenticates to the iOS device with its host key
  2. The host transfers the encrypted Escrow Keybag to the iOS device
  3. The iOS device decrypts the Escrow Keybag, thereby gaining access to the class keys of all security classes without the user having to unlock the device
  4. iTunes requests some files for backup purposes, writes others to synchronize music etc, and all encryption and decryption happens on the iOS device, using the keys provided by the Escrow Keybag.

Can anybody confirm that, or point out where I am mistaken?


An old question, but will try to answer.

OP is mostly correct. The process is like this:

  • iTunes connects to the device, passes the escrow record (that was established at the time of pairing with the device) and request backup;
  • Backup daemon uses that escrow record to 'unlock' the device. This unlocks system keybag and has same effect as entering passcode on the device;
  • Backup daemon reads all necessary files (and kernel takes care about decrypting them since system keybag is fully unlocked; the process is transparent to backup daemon), optionally encrypts them (if backup encryption is enabled) and sends to iTunes.

iTunes is actually not responsible for any encryption/decryption of device files, as far as I know.

Moreover, iTunes cannot decrypt files using escrow record because escrow record is essentially a set of content protection keys encrypted with random 256-bit key, and that key is stored on the device and is not known to the iTunes (at least that's how it was before iOS 7).

| improve this answer | |

Your hypothesis is most likely correct.

The Data Protection APIs indicate that data can be in one of three states:

  1. Unencrypted all the time
  2. Unencrypted after first PIN code entered after boot
  3. Unencrypted while unlocked (re-encrypts 10s after screen lock)

This information (along with the info you pointed out in your question) indicates that most likely iTunes is verified and determined to be trusted, then the data is unlocked/unencrypted for transport over USB by the device itself.

It is of course possible that Apple is using entirely different APIs to access the data for syncing, but it seems most likely that their APIs are at least similar to the system provided data protection APIs, if they aren't using exactly those.

More information on Data Protection is in the notes/video from WWDC 2012 Session 714 "Protecting The Users Data"

| improve this answer | |
  • this would tie in with my understanding of it. iTunes is authorised on an per installation basis the first time a given device is connected to it, but I don't think it has direct access to the device encryption keys, so backups would be decrypted on device and then transferred. – Rory McCune Aug 14 '13 at 16:00
  • Also, you are allowed to set your own password for locally encrypted backups in iTunes (or you used to be anyway) which would again indicate that the data is encrypted on the computer you are syncing with, not coming across the wire in encrypted form. – Jeff Aug 14 '13 at 16:14
  • 1
    @Jeff — As far as I know, the backup encryption passcode is actually set on the device, so the data that arrives from the device is already encrypted. If you set a backup passcode you can't change or remove it without knowing the original code (or restoring the device to factory settings) – Joel L Aug 14 '13 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.