Bad Penguin Logo
Advertisement

Java GetKeyData Utility PDF Print E-mail
 

By TuxInvader, on 01-09-2008 20:49

Views : 1085

Published in : Technology, Security

Have you ever needed to extract a private key from a Java KeyStore? It's a pain, but Keytool only allows you to export the certificates, and not the RSA private keys. A colleague needed to do exactly that on Friday afernoon, so on Monday morning I wrote a little utility to do it.
 
The GetKeyData utility can be used to print both the certificate and private key of any PKI or SSL certificates you may have in a java keystore (as used by tomcat and other J2EE servers).
 
To use, simply download the class file and while in the same directory run:
 
java GetKeyData  <Keystore> <Key alias> <password> [<keypass>]
 
Where KeyStore is the filename of your keystore, and alias is the keys alias within the store. You also need to provide the password for the keystore, and optionally the password for the key itself, if it has one.
 
The utility will then print the public key / certificate and the private key to the console (stdout).
 
Instant private key liberation!
 
You may download the compiled java class here -> GetKeyData.class
And the source if you want to compile it yourself here -> GetKeyData.java
 
Enjoy ;-)
 
 

Last update : 01-09-2008 20:52

   

Keywords : Java KeyStore extract private keys SSL Certificate


Users' Comments  
 


Add your comment
Name
E-mail
Title  
 
Comment
 
Available characters: 600
 
  This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter what you see:

   
   

No comment posted

Next >