Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

certificate and private key for push notification

I need cert.pem and key.pem for API(in my node js backend) but I just download .cert file from App IDs -> Edit -> Download. How can I get it, I can extract it from .cer file?

like image 807
Slow Harry Avatar asked Jan 07 '14 07:01

Slow Harry


People also ask

How do I Create a push certificate?

From your Admin console, click Apple Push Certificates Portal and sign in to the portal with your Apple ID and password. Click Create a Certificate and accept the terms of use. Click Choose File and select the certificate signing request (. csr) file you saved earlier.

How do I update my push notifications certificate?

Click Apple Push Certificates portal. In the new tab, sign in to the Apple portal with the Apple ID and password you used when you created the certificate. Next to the certificate you want to renew, click Renew and accept the terms of use.

Why do I need an Apple Push certificate?

Apple Push Certificate helps APNs to identify the provider of the push notifications and the application that receives the push notifications. Apple's terms of service require that each legal entity that manages Apple devices, must acquire its own certificate.

What is an Apple Push Notification Service certificate?

Apple Push Notification Service (commonly referred to as Apple Notification Service or APNS) is a platform service created by Apple Inc. that enables third party application developers to send push notifications to iOS users. You must have Paid Apple Developer account to create certificates.


2 Answers

Generate a Push Certificate To generate a certificate on a Mac OS X:

  1. Log-in to the iPhone Developer Program Portal

  2. Choose App IDs from the menu on the right

  3. Create an App ID without a wildcard. For example 3L223ZX9Y3.com.armiento.test

  4. Click the Configure link next to this App ID and then click on the button to start the wizard to generate a new Development Push SSL Certificate (Apple Documentation: Creating the SSL Certificate and Keys)

  5. Download this certificate and double click on aps_developer_identity.cer to import it into your Keychain

  6. Launch Keychain Assistant (located in Application, Utilities or search for it with Spotlight) and click on My Certificates on the left

  7. Expand Apple Development Push Services and select Apple Development Push Services AND your private key (just under Apple Development Push Services)

  8. Right-click and choose "Export 2 elements..." and save as server_certificates_bundle_sandbox.p12 (don't type a password).

  9. Open Terminal and change directory to location used to save server_certificates_bundle_sandbox.p12 and convert the PKCS12 certificate bundle into PEM format using this command (press enter when asked for Import Password):

    openssl pkcs12 -in server_certificates_bundle_sandbox.p12 -out server_certificates_bundle_sandbox.pem -nodes -clcerts

  10. Now you can use this PEM file as your certificate in ApnsPHP!

like image 134
M.B Avatar answered Sep 18 '22 12:09

M.B


Copied from: http://www.pressmatrix.de/product-blog/apple-ios-push-notification-setup-guide/

  1. Launch the Keychain Access tool and select My Certificates in the left hand panel.

  2. Locate the certificate you wish to install and reveal its contents. There should be both a certificate and a private key inside.

  3. Select both the certificate and private key, then click File and Export Items. Select Personal Information Exchange (.p12) as the output file format.

  4. Move the CSR file, .p12 file and xxx.cer files into the same folder and navigate to that location within the terminal window.

  5. Convert the xxx.cer file into a cert.pem file using the following command:

    openssl x509 -in xxx.cer -inform der -out cert.pem

  6. Convert the private key xxx.p12 into a key.pem file:

    openssl pkcs12 -nocerts -out key.pem -in xxx.p12

Or refer to: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ProvisioningDevelopment.html#//apple_ref/doc/uid/TP40008194-CH104-SW5

like image 24
Popeye Avatar answered Sep 18 '22 12:09

Popeye