Created
May 25, 2023 10:39
-
-
Save NjengaFelix/021fe594c29b58be00807b26c69d778d to your computer and use it in GitHub Desktop.
How to extract a private key from a java keystore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#First save the key in a p.12 file | |
#The p.12 file is password protected it shall prompt you to key in a new password | |
#You shall require to also key in the keystore password | |
keytool -v -importkeystore -srckeystore /path/to/keystore.jks -srcalias <alias> -destkeystore /path/to/output.p12 -deststoretype PKCS12 | |
#Use openssl to store the private-key in a .pem file | |
openssl pkcs12 -in /path/to/output.p12 -out /path/to/private-key.pem -nodes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment