Importing iPhone Keys (P12 and PEM) into Snow Leopard’s Keychain

Assuming that you’ve just installed a fresh Snow Leopard on your Mac. If you want to use again your iPhone for developing you have to import your personal iPhone public and private development key into the keychain. (Given that you’ve hopefully created a backup of your keys before reinstalling :-)). Unfortunately it’s currently impossible to import these certificates via a double-click or a drag & drop action etc. The keychain always prints the following annoying error message:

An error has occurred. Unable to import an item. The contents of an item cannot be retrieved.

But don’t worry! There is a simple workaround available. Just start the and use the following commands to manually import both keys. Please replace priv_key.p12 and pub_key.pem with your personal key files. That’s it! :-)

security import priv_key.p12 -k ~/Library/Keychains/login.keychain
security import pub_key.pem -k ~/Library/Keychains/login.keychain