Details
-
Bug
-
Resolution: Fixed
-
P3
-
11.0.5-oracle, 13.0.1
-
b26
-
generic
-
generic
-
Verified
Description
Create a PKCS12 keystore. Initialize as empty then attempt to load from a empty file. The load fails as expected. If you then write the keystore with KeyStore.store(OutputStream, char[]) you end up with a JKS keystore. The reverse also happens - if you start with a JKS keystore you end up with PKCS12 after the store.
Here's a small test:
public class ksload {
public static void main(String ... args) throws Exception {
File file = new File(args[0]);
char [] pw = {'x'};
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(null, null);
try (InputStream in = new FileInputStream(file)) {
ks.load(in, pw);
} catch (Exception e) {
System.out.println(e);
}
try (OutputStream out = new FileOutputStream(file)) {
ks.store(out, pw);
} catch (Exception e) {
System.out.println(e);
}
}
}
Run it with an argument naming an empty file.
Seems OK in Java 1.8.
Here's a small test:
public class ksload {
public static void main(String ... args) throws Exception {
File file = new File(args[0]);
char [] pw = {'x'};
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(null, null);
try (InputStream in = new FileInputStream(file)) {
ks.load(in, pw);
} catch (Exception e) {
System.out.println(e);
}
try (OutputStream out = new FileOutputStream(file)) {
ks.store(out, pw);
} catch (Exception e) {
System.out.println(e);
}
}
}
Run it with an argument naming an empty file.
Seems OK in Java 1.8.