-
Bug
-
Resolution: Fixed
-
P3
-
1.4.2, 5.0
-
05
-
generic, x86
-
generic, linux, solaris_8, windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2071780 | 5.0 | Valerie Peng | P3 | Resolved | Fixed | tiger |
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)
======================================================================
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)
======================================================================
- backported by
-
JDK-2071780 1.4.2 cannot read keystore written with 1.4.1
- Resolved
- duplicates
-
JDK-4887563 JCEKS keystore format incompatible with previous JDK versions
- Closed
-
JDK-4900235 Can not retrieve key entry from the JCE keystore which was created by keytool
- Closed
-
JDK-4900593 Keystore can not read RSA keys
- Closed