Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4887561

1.4.2 cannot read keystore written with 1.4.1

    Details

    • Subcomponent:
    • Resolved In Build:
      05
    • CPU:
      generic, x86
    • OS:
      generic, linux, solaris_8, windows_xp

      Backports

        Description

        Name: gm110360 Date: 07/08/2003


        FULL PRODUCT VERSION :
        java version "1.4.2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
        Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)


        FULL OS VERSION :
        Microsoft Windows XP [Version 5.1.2600]

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        Unlimited-strength encryption jars are installed.

        A DESCRIPTION OF THE PROBLEM :
        I use 1.4.1 to write a keystore to a file, and have no problems reading it back with 1.4.1 (any version of 1.4.1, i.e. 1.4.1_01 through 1.4.1_03). When I try reading it with 1.4.2, I get a StreamCorruptedException.

        I found similar problems described in two forum messages, without resolutions.


        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        (line number in Main.main may be incorrect)
        java.io.StreamCorruptedException: invalid stream header
        at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
        at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
        at com.sun.crypto.provider.JceKeyStore.engineLoad(DashoA6275)
        at java.security.KeyStore.load(KeyStore.java:652)
        at Main.main(Main.java:16)


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        // sample code for reading from keystore;
        // use similar code to generate the keystore and put some keys in it
        import java.io.*;
        import java.security.*;

        public class Main {
          public static void main(String[] args) {
            try {
              final String keyStoreType = "JCEKS";
              final Provider provider = Security.getProvider("SunJCE");
              final char[] keystorePW = ...; // put a password here
              File keyStoreFile = new File("keystore"); // put a filename here
              KeyStore keyStore = KeyStore.getInstance(keyStoreType, provider);

              final InputStream keyStoreStream = new FileInputStream(keyStoreFile);
              keyStore.load(keyStoreStream, keystorePW);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Use 1.4.1
        (Review ID: 189941)
        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  valeriep Valerie Peng
                  Reporter:
                  gmanwanisunw Girish Manwani (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: