简体   繁体   中英

Is there any possibility to Exporting the private key from the PKCS12 format by using Java Keytool?

I have created keystore by using Java Keytool . Below are the steps i tried.

Preparing the certificate:

keytool -genkey -keyalg RSA -alias selfsigncert -keystore "C:\path\keystore.jks" -validity 365 -keysize 2048

Convert the JKS keystore to industry standard PKCS12 keystore

keytool -importkeystore -srckeystore C:\path\keystore.jks -destkeystore C:\path\keystore.p12 -deststoretype pkcs12

Export the client certificate

keytool -export -alias selfsigncert -keystore C:\path\keystore.p12 -rfc -file C:\path\my_self_cert.crt

Next step is to export unencrypted private key, To achieve this I could not find any command on Java keytool

I found openssl related commands only to generate private key like below

openssl pkcs12 -in identity.p12 -nodes -nocerts -out private_key.pem

Note:

  • openssl is not installed in my system ie windows 11
  • Git is not installed in my machine

Can we able to achieve this by using same Java keytool rather than go with openssl ?

I'm recommend you to use free GUI program. https://keystore-explorer.org/index.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM