Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Keystore java.io.IOException

843810Mar 31 2003 — edited Apr 1 2003
Hi all, when i try to generate a secretkey and store it in a keystore, but i get an io exception for some reason.
it says:
Exception in thread "main" java.security.KeyStoreException: java.io.IOException:
Error initialising store of key store.

i really don't know what i'm doing wrong, a little bit of help would be usefull

this is a piece of my code:

private static String FILENAME = "keystore.ks";

private void registerUserKey(char[] password) throws Exception{
// Generate secret key for HMACRIPEMD160
KeyGenerator kg = KeyGenerator.getInstance("HMACRIPEMD160");
SecretKey sk = kg.generateKey();
// Create a keystore and place the key in it
// I use an UBER keystore, which is provided by Bouncycastle.
KeyStore keyStore = KeyStore.getInstance("UBER");
keyStore.load(null, null);
String alias = "exampleKey";
keyStore.setKeyEntry(alias, sk, password, null);
FileOutputStream fos = new FileOutputStream(FILENAME);
keyStore.store(fos, password);
fos.close();
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2003
Added on Mar 31 2003
3 comments
187 views