I am looking for help in programmatically accomplishing the following tasks in Java.
Open a key store or create it if it does not yet exist. This one was fairly easy to accomplish, however to make sure I have not erred the code is in the code box below.
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
char password = privateKeyPassword.toCharArray();
java.io.FileInputStream fis = null;
fis = new java.io.FileInputStream(keyStoreName);
Generate a public / private key pair. Again not difficult. Code is below.
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
KeyPair keyPair = keyGen.genKeyPair();
Store the key pair in the key store. Here is where I need some help. The private key needs to be run through a CA. Okay, no problem. I'll generate a cert request and send it to a CA, but what do I do with the key pair in the mean time? I don't want to write it out to a file for a number of reasons. Is there a way to put it into the key store pending issuance of the cert?
Thanks for your help.