I wrote some code to help me manage the keystores/SSLs that I use with my
J2EE application server. In two places, I run the keytool command, using Runtime.getRuntime(), but I am starting to see some java.io.IOException: Not enough space errors. The diskspace looks good, and the Heap size of the jvm looks good.
Anyways, I want to try and convert this so it does not fork and execute (and will remove the issue that I am seeing), but instead use java.security.Keystore instead (or something better).
Here are the parts of the code, I'd like to convert:
// KeyStore Generation
String params[]= {"/bin/keytool", "-genkey", "-keyalg", "RSA", "-alias", keyAlias, "-keystore", keyStore,
"-dname", keyDName, "-keypass", keyPassPhrase, "-storepass", StorePassPhrase};
Process keytool = Runtime.getRuntime().exec(params);
// SSL Cert Request Creation
String params[]= {"keytool", "-certreq", "-alias", keyAlias, "-keypass", keyPassPhrase, "-keystore", keyStore, "-storepass", StorePassPhrase, "-file", keyReqFile };
Process keytool = Runtime.getRuntime().exec(params);
Looking at information on using java.security.KeyStore (KeyStore.Builder, KeystoreSpi), I got lost rather quickly. Anyone else use these? or have some good examples I could use to help muddle my way into fixing this?
Thanks