Skip to content

Instantly share code, notes, and snippets.

@uhho
Created February 26, 2015 06:08
Show Gist options
  • Save uhho/481c20f093d56e1fe59c to your computer and use it in GitHub Desktop.
Save uhho/481c20f093d56e1fe59c to your computer and use it in GitHub Desktop.
Extracting private key and key certificate from .pfx file.
// create private key (any password is ok)
openssl pkcs12 -in xxx.pfx -nocerts -out example.key
// remove password
openssl rsa -in example.key -out example.key
// generate private/public pair
openssl pkcs12 -in xxx.pfx -out privpub.pem
// get public certificate from privpub
openssl x509 -inform pem -in privpub.pem -pubkey -out example.crt -outform pem
// remove files
rm privpub.pem
rm xxxx.pfx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment