Skip to content

Instantly share code, notes, and snippets.

@acosonic
Last active December 16, 2022 10:24
Show Gist options
  • Save acosonic/280679afc870aac08f7c86e0f17a495f to your computer and use it in GitHub Desktop.
Save acosonic/280679afc870aac08f7c86e0f17a495f to your computer and use it in GitHub Desktop.
Openssl PFX to PEM convert with chain and decyphered key usage ( ./pfx_pem_convert.sh filename)
#!/bin/bash
outfile=${1::-4}
echo "converting to pem with chain"
openssl pkcs12 -in $1 -clcerts -nokeys -out $outfile.pem
echo "extracting key only"
openssl pkcs12 -in $1 -nocerts -out tmp_wk.key
echo "removing passphrase from key"
echo openssl rsa -in tmp_wk.key -out $outfile.key
rm tmp_wk.key
echo "done, CHECK YOUR CHAINS!!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment