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.

 

  • kumar

    i’m confusing with p12 file, i’m created p12 file after generating CSR file with having privete key,
    and in another case created p12 file after creating APN service SSL certificate having private key,
    but in both cases push notification not works, in both cases i’m getting device token id but not getting
    notification.
    tell me any one where i did mistake, and which private key is used for generating p12 file.

    • AppTuitions

      Sometimes it takes few hours if you have freshly created the certificates.

  • anupam mishra

    hi thanks a lot for sharing such wonderful tutorial. it saved my lot of time .. nice.

  • Is it just me, or should this take less than 10 steps to complete!?

    • AppTuitions

      Yeah, not it only takes .p12 file for Push notification.

      • Bryan Lloyd Anderson

        can you please explain? Which p12 does it only require now? Documentation?

  • nvnguyen

    How can test pem file?

  • veeranji

    Hi

  • veeranji

    i follow above steps

  • veeranji

    for push notificatios

  • veeranji

    openssl pkcs12 -in pushcert.p12 -out pushcert.pem -nodes -clcerts this line i entered terminal

  • veeranji

    after that it’s asking pasword

  • veeranji

    i entered password but it’s not taking in terminal

  • veeranji

    please help me

  • veeranji

    cd

    cd Desktop

    openssl pkcs12 -in pushcert.p12 -out pushcert.pem -nodes -clcerts
    Here i converted p12 file into PEM file Then i have pem file zero bytes.
    How it is solving ?

  • Sameer

    Sir, you save my day. i got it what i exactly need. Thank you

  • suresh kumar

    how can i set ck.pem file in server side.plz reply

  • Željko

    Thanks, 1 simple line from terminal solved problem 🙂

  • Reginaldo do Prado

    HI. I just run all these steps… ok. But I dont know what to do with .pem file! Yes… I know that I have to upload it, but, to where?!? What is the “Build Your Own” area?!? Sorry if its a silly question, but I cant find this resource anywhere!

  • Gourav Sharma

    Anybody tell me
    I am following your step for creating creating .pem file it will showing eroor “Unable To Get Local Issuer Certificate (using Terminal)”

  • Gourav Sharma

    openssl verify Certificates7feb.pem
    Certificates7feb.pem: /UID=com.jeffrey.tipmama/CN=Apple Development IOS Push Services: com.jeffrey.tipmama/OU=XZ999Q599K/C=US
    error 20 at 0 depth lookup:unable to get local issuer certificate

    I am getting the same issue.I have followed your steps .I have created a pem file but still i am unable to verify it with apple server .Any help will be appreciated .Thanks in advance:)

  • Robert Parham

    The “select” key? shift?