1 Reply Latest reply on Dec 21, 2005 7:33 PM by Atul Kshatriya

    java.io.StreamCorruptedException accessing Keystore

    Atul Kshatriya Newbie

      I am getting java.io.StreamCorruptedException when I try to access a keystore file. The keystore was generated using JDK 1.2.2 (old application) and I am trying to access the same code that ran in Weblogic 5.1 under JDK 1.2.2 in JBoss 4.0.2 using JDK 1.4.2. The JCE jar version that I am using with JDK 1.2.2 is JCE 1.2.

      I did a test where I tried to invoke an independant java program which loads the keystore under JDK 1.4.2 and it worked absolutely fine. The code that I used in this small program is the same exact one that gets invoked inside the web application.

      The exception I am getting is -

      at java.io.ObjectInputStream.readTypeString(ObjectInputStream.java:1372)
      at java.io.ObjectStreamClass.readNonProxy(ObjectStreamClass.java:607)
      at java.io.ObjectInputStream.readClassDescriptor(ObjectInputStream.java:778)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1528)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      at com.sun.crypto.provider.JceKeyStore.engineLoad(DashoA12275)
      at java.security.KeyStore.load(KeyStore.java:1150)

      The code that is being used is -

      Provider sunJce = new com.sun.crypto.provider.SunJCE();
      KeyStore ks = KeyStore.getInstance("JCEKS", "SunJCE");
      FileInputStream is = new FileInputStream(keyStoreFile);

      What can be the problem. Please help. I am really stuck here.