Skip to content

Instantly share code, notes, and snippets.

@achesco
Created April 20, 2018 16:06
Show Gist options
  • Save achesco/c6c90440d26d53e6759568ec488860d0 to your computer and use it in GitHub Desktop.
Save achesco/c6c90440d26d53e6759568ec488860d0 to your computer and use it in GitHub Desktop.
p12/pfx <==> key+cert+ca

Assemble

openssl pkcs12 -export -out bundle.p12 -inkey user.key -in user.crt -certfile authority.crt

Disassemble

openssl pkcs12 -in bundle.p12 -nocerts -out user.encrypted.key && openssl rsa -in user.encrypted.key -out user.key
openssl pkcs12 -in bundle.p12 -clcerts -nokeys -out user.crt
openssl pkcs12 -in bundle.p12 -cacerts -nokeys -out authority.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment