Converting your .p12 certificates to .pem (EasyAPNs Tutorial)

In order to setup your APN server to work with the Apple Push Notifications server, you’ll need to convert your Push Service certificates to .pem files. Some might not know how to properly go about doing this, so here we go!

First thing you’ll want to do is open up Keychain Access

On the left hand side you’ll see the “Certificates” section, click on it

You should see your Apple Push Services certificates on the right hand side



Right click it, and click the Export option given to you. Name the this “apns-dev-cert”

Now, click on the side arrow next to the name of your certificate and you should see a little key icon


Right click the key icon, and export the key as “apns-dev-key”

Now, open up Terminal and go to the directory you exported the certificates to.

Type in the following commands (in order), providing your password when prompted.

openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.
openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
cat apns-dev-cert.pem apns-dev-key-noenc.pem > apns-dev.pem

Go ahead and close Terminal, you’re all done.

About Raphael Caixeta
I've been programming ever since I was 13, learning Visual Basic. After a while, Visual Basic got really boring. A friend of mine started learning PHP and showed me some cool little sites he was making. I started learning PHP the weekend after. 4 years later, I'm was able to create amazing websites using PHP, MySQL and jQuery. I started iPhone development a few months after the SDK was out, and that's how I became an app developer.