Hello,
I'm developing a swing application to produce certificates easily, for
users who don't like typing commands into the console.
I'm trying to write some java code which let me do something equivalent
to the following command:
C:\Documents and Settings\tremalnaik>keytool -genkey -alias
server.alias.com -keyalg RSA -keypass pass1 -storepass pass2 -keystore
keystore.jks -validity num_days
I searched the JAVA cryptographic API but they gave me the impression
they don't let you create a keystore, but only load it from a file.
Alternatively, I may use the Runtime.exec(), but I don't like very much
this solution.
Can you help me?
TREMALNAIK
Tommy Grändefors - 03 Nov 2005 18:31 GMT
Hi,
Don't use Runtime.exec().
You can create a new key store from the method
'KeyStore.load(InputStream stream, char[] password)' by using null as
input parameters (please read the javadoc for that method). When you
have finished working with your key store, then you have to use method
'KeyStore.store(OutputStream stream, char[] password)' to save it on
disk.
Here's how to create a new jks key store:
KeyStore ks = KeyStore.getInstance("JKS");
ks.load(null, null);
Good luck with your application.
Regards,
Tommy Grändefors
www.pheox.com
> Hello,
> I'm developing a swing application to produce certificates easily, for
[quoted text clipped - 16 lines]
>
> TREMALNAIK