Skip to content

Instantly share code, notes, and snippets.

@jstrassburg
Created July 12, 2018 15:02
Show Gist options
  • Save jstrassburg/07161ea6e798a3059ec7d549852f159d to your computer and use it in GitHub Desktop.
Save jstrassburg/07161ea6e798a3059ec7d549852f159d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
usage() {
echo "Usage: $0 /path/to/thing.pfx"
exit -1
}
if [ "$#" -lt 1 ]; then
usage
fi
PFX=$(basename -- "$1")
FILENAME="${PFX%.*}"
PEM="$FILENAME.pem"
KEY="$FILENAME.key"
CERT="$FILENAME.crt"
openssl pkcs12 -in $PFX -out $PEM -nodes
openssl rsa -in $PEM -out $KEY
openssl x509 -in $PEM -out $CERT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment