- Published on
generate iOS pem push certificates and pfx package files for node apn library
- Authors
- Name
- Peter Peerdeman
- @peterpeerdeman
As a future reference to myself, this is how we transformed iOS pem certificates into PFX packages for use with nodes apn library
- Use this guide by Ray Wnederlich to create the push certificates
- create keys through app id preferences screen in https://developer.apple.com interface.
- export certificate and keys to
.p12
from keychain using following commandsopenssl pkcs12 -in PushProdKeys.p12 -out PushProdKeys.pem -nodes -clcerts
openssl pkcs12 -in PushDevKeys.p12 -out PushDevKeys.pem -nodes -clcerts
- Test the prod certificates with
openssl s_client -connect gateway.push.apple.com:2195 -cert PushProd.pem -key PushProdKeys.pem
- Prepare
.pem
certificates using the guide at node-apn githubopenssl x509 -in aps.cer -inform DER -outform PEM -out PushProduction.pem
openssl x509 -in aps_development.cer -inform DER -outform PEM -out PushDev.pem
- Create pfx package by following this guide on stackoverflow
openssl pkcs12 -export -out pushprod.pfx -in PushProd.pem -inkey PushProdKeys.pem
openssl pkcs12 -export -out pushdev.pfx -in PushDev.pem -inkey PushDevKeys.pem
- Create base64 pfx package for use in env vars:
cat pushprod.pfx | base64 > pushprod.pfx.txt
cat pushdev.pfx | base64 > pushdev.pfx.txt