Subscribe to
NSLog(); Header Image

How Secure is iMessage?

More than people thought.

TL;DR version:

Too long, didnt read? Basically: Unless Apple is omitting something or there's some backdoor tucked into their many-layers-deep encryption (which, while unlikely, isn't inconceivable) they really can't read your iMessages without a fairly insane amount of effort. Sure, they could theoretically brute force their way past your private key. Or they could scrap the entire system and replace it with something with glaring security holes, and hope no one notices.

The details are in the full post.

  • When a user first enables iMessage, your device creates two sets of private and public keys: one set for encrypting data, and one set for signing data (read: signing data is a secondary blurp of data that helps to verify that the encrypted text hasn't been modified after it was sent to the server. If these two things ever don't match up, red flags start going off.)
  • Your public keys are sent to Apple's servers. Your private keys are stored on your device. Apple never sees your private keys.
  • When someone starts an iMessage conversation with you, they fetch your public key(s) from Apple's servers. Before that message leaves the sender's device, it's encrypted into something that only your device knows how to decrypt.
  • So if Apple never has your private key, how do messages arrive at all of your devices in a readable form? How do your private key(s) get from one device to the other?
  • Simple answer: they don't. You've actually got one set of keys for each device you add to iCloud, and each iMessage is encrypted independently for each device. So if you have two devices — say, an iPad and an iPhone — each message sent to you is actually encrypted (AES-128) and stored on Apple's servers twice. Once for each device. When you pull down a message, it's specifically encrypted for the device you're on.
  • Some data ("such as the timestamp and APN routing data", says Apple) is not encrypted.
  • All of this independently encrypted/non-encrypted data is then encrypted as a whole package, on the trips between your device and Apple's servers. This makes it considerably tougher for attackers sitting between you and Apple's server to figure out what data is what, and what they should actually try to decrypt.
  • Things change around a bit for long messages and pictures, allowing Apple to hold photos and other media on the iCloud servers without being able to view them. In those case, your device generates a new, random key and a URI (read: address for something on a server) which catalogs where on the iCloud servers the image/media is stored. Apple sends your device the key and URI (which again, only your private key can decrypt), and your device pulls that image down from Apple's servers and turns it into something readable.
  • Once your device has retrieved a message, that encrypted copy of the message is deleted from Apple's servers. If you have multiple devices, another encrypted copy meant for another device might sit on their servers until it expires. Messages are stored for up to seven days.