Created
June 28, 2012 23:33
-
-
Save Mistobaan/3014725 to your computer and use it in GitHub Desktop.
Convert Apple keys to openssl 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 | |
set -e | |
if [[ $# -lt 2 ]] | |
then | |
echo "Usage: $0 <filename.p12> <key-name: ie. app-free-dev>" | |
exit | |
fi | |
function convert_cert() { | |
p12_file=$1 | |
name=$2 | |
openssl pkcs12 -clcerts -nokeys -out $name.cert -in $p12_file | |
openssl pkcs12 -nocerts -out $name.enc.pem -in $p12_file | |
openssl rsa -in $name.enc.pem -out $name.pem | |
rm $name.enc.pem | |
echo "Created $name.pem and $name.cert" | |
} | |
convert_cert $1 $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment