aspose file tools*
The moose likes Java in General and the fly likes Create keystore and truststore programatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Create keystore and truststore programatically" Watch "Create keystore and truststore programatically" New topic
Author

Create keystore and truststore programatically

Marcelo Tataje
Ranch Hand

Joined: Jan 31, 2011
Posts: 64

Hello everybody, I want to make a Java App to manage certificates.

For example, for a keystore, in the requirements I've received, I need two files that I've already have:
1. Certificate (.cer or .pem extension),
2. the private key file (.key extension).
I wonder to know how can I create my own keystore with these files, how do I set the alias, password and all what my keystore needs.

Now, what I've also been asked for is to create a truststore based on the keystore:
- Generate a .CER file from keystore.jks
- Import .cer file into a new file named truststore.jks
- Import Root certificate (which I already have)
- Import Intermediate certificate (which I already have)


And I know that all what I want is possible with the "keytool" java offers, but I need an application that can do all this process. I've been thinking on using the Runtime class to execute keytool commands, but for some of the commands I need a confirmation and I couldn't manage to find how to accept or decline a command executed from java.

Is there maybe a framework for this kind of job. I'd really appreciate your help and thanks in advanced.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19723
    
  20

How about KeyStore? (<= click on it)


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create keystore and truststore programatically