To further aid this, threw together a little shell script that takes two arguements, the certificate.p12 file and the private key.p12 file and creates a apns_certificate.pem file. Saves a bit of typing and also gives you a hard copy of the commands needed to create the certificates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple script to convert p12 -> pem files | |
# Depends on openssl | |
# Params | |
# $1 Certificate File | |
# $2 Key File | |
if [ $# -lt 2 ] | |
then | |
echo "Bad number of arguments" | |
exit 1 | |
fi | |
openssl pkcs12 -clcerts -nokeys -out tmpcert.pem -in $1 | |
openssl pkcs12 -nocerts -out tmpkey.pem -in $2 | |
#Remove the passphrase | |
#openssl rsa -in $2 -out tmpkey.pem | |
#Combine files | |
cat tmpcert.pem tmpkey.pem > apns_certificate.pem | |
rm tmpkey.pem | |
rm tmpcert.pem | |
exit 0 |