iOS Mail and Self-Signed Certificates

I've recently been getting warnings on my iPhone and iPad telling me that my email server is using a self-signed certificate. Now, normally this wouldn't be a problem, I'd just tap the button to "Trust" my certificate and carry on. Strangely, there is no longer an option to do this. I'm not sure when this changed, or if indeed it has changed.

There are a bunch of folks discussing it on the Apple Support Forums, with various fixes and workarounds, none of which worked for me. I did, however, find a way to fix my particular problem...

  • Load up Keychain Access on your Mac, select the "System" keychain, and choose "Certificates" from the Category panel.
  • Find the certificate for your mail server in the list, and double click it.
  • In the information window that should open, Option/Alt-drag the certificate image from the top-left corner into a new message in Mail. (You'll know it's done it right if you have a .PEM attachment, not a .CER one.)
  • Send that email to yourself.

Now, on the iOS device, open the email and tap on the certificate. It should take you into Settings and allow you to install the certificate. You can check it's worked by going into Settings, General, Profiles. If you can see the certificate in there, and it says "Trusted" in green, you should be good to go!

Update 2011-05-24: Matt Doyle has written a more comprehensive version of the above on his website.