I would like to export my private key from a Java Keytool keystore, so I can use it with openssl. How can I do that?
|
Since Java 6, you can import/export private keys into PKCS#12 ( For example:
The |
|||
|
|
|
There is a format that allows the moving of private keys is called PKCS#12. This format came later in the evolution of PKI certificates and related keystores as the need evolved. If you consider the chain of trust issues created by accessing and transporting the private key you can see why it was not included in the initial features but rather came after pressure by operational need. This is the core reason for the challenge. Java keystores were one of the initial users of the PKCS#12 format but as importers not exporters. It appears the security design of Java keystores still does not support exporting private keys as a standard feature. Again, there are good security reasons for this fact. That said, private routines have been written as referenced here: http://www.startux.de/index.php/java/44-dealing-with-java-keystoresyvComment44 If at all possible I would consider creating a new keystore in OpenSSL and new keys rather than trying to pry out the private key from the Java keystore. By opening the Java keystore and extracting the private key one is moving beyond the designed security features. The export PKCS#12 feature has been desired for many years but still is not supported in Java. My thinking is that is for very good cryptologic reasons thus I would be leary of taking that step unless it was absolutely necessary. |
|||||||||||||||||
|
|
I agree with Bruno. Keytool is ultimate tool when dealing with java keystore, but there is one fancy and quite powerful free tool: Keystore explorer I use it a lot and never had a need for something else. |
|||
|
|