certificate and private key for push notification
Solution 1
Generate a Push Certificate To generate a certificate on a Mac OS X:
Log-in to the iPhone Developer Program Portal
Choose App IDs from the menu on the right
Create an App ID without a wildcard. For example 3L223ZX9Y3.com.armiento.test
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)
Download this certificate and double click on aps_developer_identity.cer to import it into your Keychain
Launch Keychain Assistant (located in Application, Utilities or search for it with Spotlight) and click on My Certificates on the left
Expand Apple Development Push Services and select Apple Development Push Services AND your private key (just under Apple Development Push Services)
Right-click and choose "Export 2 elements..." and save as server_certificates_bundle_sandbox.p12 (don't type a password).
-
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
Now you can use this PEM file as your certificate in ApnsPHP!
Solution 2
Copied from: http://www.pressmatrix.de/product-blog/apple-ios-push-notification-setup-guide/
-
Launch the Keychain Access tool and select My Certificates in the left hand panel.
-
Locate the certificate you wish to install and reveal its contents. There should be both a certificate and a private key inside.
-
Select both the certificate and private key, then click File and Export Items. Select Personal Information Exchange (
.p12
) as the output file format. -
Move the CSR file,
.p12
file andxxx.cer
files into the same folder and navigate to that location within the terminal window. -
Convert the
xxx.cer
file into acert.pem
file using the following command:openssl x509 -in xxx.cer -inform der -out cert.pem
-
Convert the private key
xxx.p12
into akey.pem
file:openssl pkcs12 -nocerts -out key.pem -in xxx.p12
Slow Harry
Updated on June 09, 2022Comments
-
Slow Harry about 2 years
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?