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!

Problem loading keystore file into java keystore object

843811Nov 25 2002 — edited Nov 26 2002
Hello all,

I have a problem loading "pkcs12" format keystore into the Keystore object, following is the code

---code------

InputStream is = new FileInputStream("c:/keystore/my_keystore");
KeyStore ks = KeyStore.getInstance("PKCS12");
System.out.println("KeyStore instance created.....");
ks.load(is,"password".toCharArray());
System.out.println("KeyStore loaded.....");
is.close();

--------------------------------
At runtime i am getting the following Exception

-----Error----------------------

KeyStore instance created.....
java.io.IOException: toDerInputStream rejects tag type 2
Exception in thread "main" java.lang.NullPointerException

--------------------------------

I have no clue on why this exception is thrown even after the keystore name, keystore file path and keystore passward being correct.

Any help in this regard will be appreciated.

I am running out of time, somebody please send me a reply on this topic as early as possible

Thanks in advance

Raju Ponnam

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 24 2002
Added on Nov 25 2002
2 comments
570 views