Reputation: 9827
I'm using the below code to attempt to load a keystore file and I'm getting an java.io.IOException: Invalid keystore format Exception. Any ideas on how to troubleshoot this or what is causing the issue?
Load Keystore File:
final FileInputStream keyFile = new FileInputStream(filePath
+ "key.p7b");
final KeyStore keyStore = KeyStore.getInstance("JKS");
String storepass = "pwd";
keyStore.load(keyFile, storepass.toCharArray());
Exception:
java.io.IOException: Invalid keystore format
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:633)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:38)
at java.security.KeyStore.load(KeyStore.java:1185)
Upvotes: 0
Views: 2936
Reputation: 75346
On request, my comment as an answer:
p7b is a certificate file, not a keystore file. You must convert it first. Apparently OpenSSL can help with that.
Upvotes: 1
Reputation: 320
I have a problema like that when I try to create a keystore file with a Sun/Oracle JDK in Portuguese... The portuguese version of JDK (or my Windows PT-BR, I don't know yet) have this bug... I needed to make the keystore file in an English operational system.
Upvotes: 0