I am trying to connect to server using keystore which is provided by server team.
While sending service call to server first i created KeyStore Instance by using following api
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
It’s returning the keystore type as “BKS”.
The Keystore what server team sent is of type “.jks”(somename.jks) So, I am getting exception “Wrong version of key store”.
I tried by passing “JKS” to getInstance() of KeyStore by following way
KeyStore keystore = KeyStore.getInstance("JKS");
But here I am getting exception “KeyStore JKS implementation not found”.
Here is the piece of code:
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
InputStream instream = mContext.getAssets().open("somename.jks");
try {
trustStore.load(instream, "password".toCharArray());
} finally {
try {
instream.close();
} catch(Exception ignore) {
}
}
Please guide me to solve this problem.