Skip to content

Instantly share code, notes, and snippets.

@vineetchoudhary
Last active December 22, 2016 10:34
Show Gist options
  • Save vineetchoudhary/3672e43e965c804a31f8ef32ef22a18d to your computer and use it in GitHub Desktop.
Save vineetchoudhary/3672e43e965c804a31f8ef32ef22a18d to your computer and use it in GitHub Desktop.
Generate pem file for APNS
#Get the p12 file, it needs to be converted to the PEM format by executing this command from the terminal:
openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
#If you want to create pem file without passphase, use -nodes
openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12 -nodes
#If you wish to remove the passphrase, either do not set one when exporting/converting or execute:
openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
#Finally, you need to combine the key and cert files into a apns-dev.pem file we will use when connecting to APNS:
cat apns-dev-cert.pem apns-dev-key-noenc.pem > apns-dev.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment