Skip to content

Instantly share code, notes, and snippets.

@4ndrej
Last active March 22, 2018 17:56
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