We have an application that creates KeyStore program code. We create a KeyStore as follows (sample code that suppresses exception handling for brevity),
KeyStore ks = KeyStore.getInstance( "JKS" ); ks.load( null, null ); ... // Add crypto material here keystore.store( new FileOutputStream( "keystore.ks" ), "password" );
The store(OutputStream stream, char[] password) method throws the following exception,
java.lang.NullPointerException at sun.security.provider.JavaKeyStore.engineStore(Unknown Source) at sun.security.provider.JavaKeyStore$JKS.engineStore(Unknown Source) at java.security.KeyStore.store(Unknown Source)
The keystore.ks file is created on the file system. But when we try to test it with keytool , we get
keytool -list -keystore nms.keystore keytool error: java.io.EOFException
It's funny that the same code works fine on all the other machines that we tested. In the actual code, none of the arguments passed to the store method is null , we checked three times.
Some details about a bad car,
- CentOS 5.8 32 bit
- Sun JRE 1.6.0_43
source share