Skip to content

Instantly share code, notes, and snippets.

@m1entus
Last active March 12, 2018 19:36
Show Gist options
  • Save m1entus/11170024 to your computer and use it in GitHub Desktop.
Save m1entus/11170024 to your computer and use it in GitHub Desktop.
Generating apple push notifications
#!/bin/sh
if [ "$#" != 3 ]; then
echo "Illegal number of parameters, usage: ./make_cert.sh apn_file key_file output_filename"
fi
eval "openssl x509 -in $1.cer -inform DER -out $1.pem -outform PEM"
eval "openssl pkcs12 -nodes -export -inkey $2.key -in $1.pem -out $1.p12"
eval "openssl pkcs12 -nodes -nocerts -out $2.pem -in $1.p12"
eval "cat $1.pem $2.pem > $3.pem"
eval "rm $1.pem"
eval "rm $2.pem"
eval "rm $1.p12"
Converting p12 to key:
openssl pkcs12 -in Railwaymen2014Dev.p12 -nodes -out Railwaymen2014Dev.key -nocerts
iOS Push certificate instruction:
To create distribution certificate call on terminal:
1. openssl genrsa -out ios_distribution.key 2048
2. openssl req -new -key ios_distribution.key -out CertificateSigningRequest.certSigningRequest
3. Upload the newly created CertificateSigningRequest.certSigningRequest at: https://developer.apple.com/ios/manage/certificates/team/distribute.action
4. Download ios_distribution.cer from developer.apple.com
6. openssl x509 -in ios_distribution.cer -inform DER -out ios_distribution.pem -outform PEM
7. openssl pkcs12 -export -inkey ios_distribution.key -in ios_distribution.pem -out ios_distribution.p12 -passout pass:'YOUR_PASSWORD'
8. openssl pkcs12 -nodes -nocerts -out ios_distribution_key.pem -in ios_distribution.p12
9. cat ios_distribution.pem ios_distribution_key.pem > certifacate.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment