Skip to content

Instantly share code, notes, and snippets.

@4ndrej 4ndrej/pfx2cer-key.sh
Last active Mar 22, 2018

Embed
What would you like to do?
pfx to key/cer chain
# convert from pfx to passwordless key/crt chain
# based on https://gist.github.com/ericharth/8334664
# params
PFX="hostname.pfx"
PASSWORD="pfxpassword"
OUT="hostname-2018"
# key
openssl pkcs12 -in $PFX -password pass:$PASSWORD -nodes -nocerts -out $OUT.key
# crt
openssl pkcs12 -in $PFX -password pass:$PASSWORD -nodes -nokeys -clcerts -out host.crt
openssl pkcs12 -in $PFX -password pass:$PASSWORD -nodes -nokeys -cacerts -out ca.crt
cat host.crt ca.crt > $OUT.crt
rm host.crt ca.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.