Quantcast
Channel: How to create .pfx file containing only one of private/public key - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by Brian Gillespie for How to create .pfx file containing only one of private/public key

$
0
0

There may be a shorter way to do this without going through PEM, but I don't know it.

Extract the private key to PEM:

openssl.exe pkcs12 -in <pfx_file_name>.pfx -nocerts -out private_key.pem

Optional, if you don't want passwords in the PEM or PFX files:

openssl.exe rsa -in private_key.pem -out private_key.pem

Extract the public and private key to PEM:

openssl.exe pkcs12 -in <pfx_file_name>.pfx -out public_and_private_key.pem

Export the public key only to PFX:

openssl.exe pkcs12 -in public_and_private_key.pem -inkey private_key.pem -export -out public_key.pfx -nokeys

Export only the private key to PFX:

openssl.exe pkcs12 -in public_and_private_key.pem -inkey private_key.pem -export -out private_key.pfx -nocerts

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>