Skip to content

Instantly share code, notes, and snippets.

@4ndrej
Last active March 22, 2018 17:56
Show Gist options
  • Save 4ndrej/72b6e9423e2c63ce4e129ce0997feda3 to your computer and use it in GitHub Desktop.
Save 4ndrej/72b6e9423e2c63ce4e129ce0997feda3 to your computer and use it in GitHub Desktop.
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