Created
November 14, 2014 11:56
-
-
Save mixdesign/3d48560162d45eb14617 to your computer and use it in GitHub Desktop.
The command line shell scripts to generate APNS pem file for push notification.
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 | |
# Created by Almas Adilbek 2014 | |
echo Project name \"without space\": | |
read PROJECT_NAME | |
echo Certificate filename \".cer\": | |
read CER_FILE | |
# Convert the .cer file into a .pem file | |
openssl x509 -in $CER_FILE.cer -inform der -out $PROJECT_NAME"Cert".pem | |
# Convert the private key’s .p12 file into a .pem file | |
echo Private key filename \".p12\": | |
read PKEY_NAME | |
openssl pkcs12 -nocerts -out $PROJECT_NAME"Key".pem -in $PKEY_NAME.p12 | |
# Finally, combine the certificate and key into a single .pem file | |
cat $PROJECT_NAME"Cert".pem $PROJECT_NAME"Key".pem > $PROJECT_NAME.pem | |
echo $PROJECT_NAME.pem file created! | |
# Remove certificate and private key .pem files | |
rm -f $PROJECT_NAME"Cert".pem | |
rm -f $PROJECT_NAME"Key".pem | |
echo Use $PROJECT_NAME.pem to send push notifications. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very useful , thank you