I just bought an iPhone 7, and I wanted to sync my Mail and Twitter accounts from my Mac. There used to be an option in iTunes to sync Mail accounts with your iOS device, but that option has been removed, unfortunately. So, what's the new "solution" for this problem? As far as I can tell, Apple now forces you to manually set up all Mail and Twitter accounts on your iOS devices. The account setup process is not particuarly complex, and you can follow your Mac settings as a guide. However, it can be a chore to type in passwords on your iPhone, especially if you follow the best practice of generating long, random passwords containing special characters. I wanted some way to get my passwords from my Mac onto my iPhone, and iTunes sync no longer works. The natural fallback solution is to use a password manager.
The two most popular password managers for Apple devices are 1Password and iCloud Keychain. Recently, 1Password switched over to a subscription business model. They still provide a non-subscription version, but it's uncertain how long it will be actively developed into the future, and the price was raised to heavily weight the financial incentives toward subscriptions. I understand that a lot of people are fine with subscription software, but I personally don't like it. I don't want to rent software. In general, rentals tend to be a bad deal for consumers. (Housing is a possible exception, for several reasons that I won't elaborate here.) Thus, I decided to look into iCloud Keychain.
Apple has published a security white paper with information about iCloud Keychain. There are also some discussions on the web by security professionals. It's important to note that the term iCloud Keychain is actually ambiguous, for it covers two very distinct services: keychain sync and keychain recovery. I'm not going to discuss keychain recovery here. Personally, I have no need for keychain recovery, because I already make my own encrypted off-site backups. Whether you want to use keychain recovery is up to you, but it is possible to use keychain sync without keychain recovery: when you enable iCloud Keychain, don't create an iCloud Security Code. The iCloud Security Code is used to recover a copy of your keychain from Apple if you lose your devices; if you don't create an iCloud Security Code, then Apple doesn't store a copy of your keychain at all.
In contrast to keychain recovery, keychain sync does not store a copy of your keychain items in iCloud, although it does rely on iCloud for transmission: "Keychain items are transferred from device to device, traveling through Apple servers, but are encrypted in such a way that Apple and other devices cannot read their contents." How does this work? When you enable iCloud Keychain on your device, the device generates a cryptographic key pair. The private key never leaves the device; it does not get synced to iCloud or to any other device. The public key does get sent to iCloud, and ultimately to your other devices that also enable iCloud Keychain. The public key is used to encrypt any keychain items that are synced to the device, so only that one device is able to decrypt the data. Without the private key, the data cannot be decrypted by Apple or by any other party. Only someone with physical access to the device could possibly get the private key.
Encrypting keychain items with the public key ensures that only the owner of the private key can decrypt them. But how do we ensure that the public key comes from one of your devices rather than from an attacker? The system does use iCloud, so that hopefully provides some level of security against Man-in-the-middle attacks and the like. Another problem, though, is that your iCloud account can be compromised. Perhaps by social engineering. What happens if you enable iCloud Keychain on your Mac, then an attacker compromises your iCloud account and uses it to enable iCloud Keychain on a device controlled by the attacker? What prevents your Mac from divulging its passwords to the attacker? Fortunately, an iCloud Keychain enabled device does not automatically start syncing with any device that asks. When you enable iCloud Keychain on your iPhone, it sends a sync request to your Mac, and that request appears as a notification on your Mac. You, the user, have to manually approve the sync request on your Mac in order to allow it to sync with your iPhone. When the request is approved, the Mac will save the iPhone's public key, and then the Mac can safely transmit keychain items to the iPhone. So if your Mac receives unexpected iCloud Keychain notifications, you know that your iCloud account has been compromised.
I'm satisfied that iCloud Keychain sync is reasonably secure. If you feel safe in enabling iCloud Keychain, the next question is, how do you use iCloud Keychain to sync your account passwords to your iPhone? Apple's support FAQ on iCloud Keychain gives the misleading impression of effortlessness:
iCloud Keychain keeps your Safari website usernames and passwords, credit card information, and Wi-Fi network information up to date across all of your approved devices that are using iOS 7.0.3 or later or OS X Mavericks 10.9 or later.
iCloud Keychain can also keep the accounts you use in Mail, Contacts, Calendar, and Messages up to date across all of your Mac computers. And when you sign in to Facebook, Twitter, LinkedIn, and your other Internet accounts, iCloud automatically adds your usernames and passwords to all of your devices.
The last sentence seems plain false to me. I signed into Twitter on my Mac, but that didn't do anything on my iPhone. The penultimate sentence is worth noting too, because it's too easy to gloss over the "all of your Mac computers" part. In other words, iCloud Keychain won't keep the Mail accounts on your iPhone up to date. This is despite the fact that if you open Keychain Access on your Mac and look at your iCloud keychain, your Mail and Twitter passwords are indeed there. But either they don't get transmitted to your iPhone, or if they do, your iPhone doesn't try to access those keychain items. There's no equivalent to Keychain Access on iOS, so you can't even check whether those keychain items get synced. Maybe you can on jailbroken devices, I don't know.
My solution was to use Safari passwords for everything. On the Mac, Google Chrome is my default browser rather than Safari, so I didn't have any Safari passwords initially, but I opened Safari, turned on password autofill, logged into the webmail interfaces of my email accounts, saving their passwords in Safari, and did the same for Twitter. Then those passwords got automatically synced to my iPhone by iCloud Keychain. On the iPhone, you can copy the passwords from Safari Settings and then paste them into Mail or Twitter Settings. You don't even have to enable Safari autofill on the iPhone, because the passwords are there from iCloud Keychain regardless.
Given the available options, iCloud Keychain is a reasonable and secure way to transfer your account passwords from your Mac to your iPhone. This convuluted process is nowhere close to "It Just Works" though. It's still absurd that we can't simply sync accounts directly from iTunes.