Extract private key from pkcs12 file

Posted on October 14, 2013
ssl

It’s surprisingly involved:

openssl pkcs12 -in NAME.p12 -nodes -nocerts -nomacver | perl -ne '$print=1 if /^-/; print if $print;' > NAME.key

Enter the password the pkcs12 container is encrypted with. It will then prompt you for a password to encrypt the key with. You probably want to leave that empty.