Generate .pem file for PUSH Notification

You can also find older version of this tutorial on Stack overflow which I answered Here

First of all login into your developers account  –  https://developer.apple.com/account/

Generate-PEM-file-for-PUSH-notification_1

you will be redirected to following screen, Click on “Certificates”.

Generate-PEM-file-for-PUSH-notification_2

Step 1 : Click “+” button

Generate-PEM-file-for-PUSH-notification-3

 

Step 2 : Select “Apple Push Notification service SSL (Production)” and click “Continue”

Generate-PEM-file-for-PUSH-notification-4

 

 

Step 3 : Now, Select the app ID drop Drop down list and click on “Continue” to go to the next step.Generate-PEM-file-for-PUSH-notification-5

 

Step 4: Follow the steps under “About Creating a Certificate Signing Request (CSR)” for Creating Certificate Signing Request

Generate-PEM-file-for-PUSH-notification-6

In addition to the instructions provided by Apple, Here are some additional screenshots to guide you creating required certificate.

 

Step 4.1 Select “Request a Certificate From a Certificate Authority” by navigating “Certificate Assistance” from toolbar options for keychain.

Generate-PEM-file-for-PUSH-notification-7

 

Step 4.2 Fill the required certificate Info. – select  “Saved to disk” and select “Continue”

Generate-PEM-file-for-PUSH-notification-8

 

Step 5: Upload  “.certSigningRequest” file which was generated (in Step 4), then click “Generate”.

Generate-PEM-file-for-PUSH-notification-9

 

Step 6: Now Click “Done” to finish the registration,the page will be refreshed and you will see this screenGenerate-PEM-file-for-PUSH-notification-10

Then Click “Download” button to download the certificate (.cer file) you’ve created just now and then double click the downloaded file to install the certificate into Keychain Access on your Mac.

 

Step 7: Now go to “Keychain” on you mac system, look for the certificate you have just installed. If you are unsure which certificate is the correct , it should start with “Apple Production IOS Push Services”and  followed by app’s bundleID.

Generate-PEM-file-for-PUSH-notification-11

 

 

Step 8: Expand the certificate, you should see the private key with either your name or your company name. Select both items by using the “Select” key on your keyboard, right click (or cmd-click if you use a single button mouse), choose “Export 2 items”, like Below:

Generate-PEM-file-for-PUSH-notification-12

Then save the p12 file with name “pushcert.p12″ to your Desktop – now you will be prompted to enter a password to protect it, you can either click Enter to skip the password or enter a password you desire.

Step 9: Now the most difficult part – open “Terminal” on your Mac, and run the following commands

1
2
3
cd
cd Desktop
openssl pkcs12 -in pushcert.p12 -out pushcert.pem -nodes -clcerts

Step 10: Remove pushcert.p12 from Desktop to avoid mis-uploading it to Build Your Own area. Open “Terminal” on your Mac, and run the following commands:

1
2
3
cd
cd Desktop
rm pushcert.p12

Okay then, we are done with this tutorial. we successfully generated .pem file, If you find any difficulties generating .pem please do comment and we will be happy to help.