Skip to content

Instantly share code, notes, and snippets.

@Mistobaan
Created June 28, 2012 23:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mistobaan/3014725 to your computer and use it in GitHub Desktop.
Save Mistobaan/3014725 to your computer and use it in GitHub Desktop.
Convert Apple keys to openssl certificates
#!/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