Wrong version of keystore on android call

JuSchz picture JuSchz · Jun 20, 2012 · Viewed 22.2k times · Source

I want to make a https request.

I use bouncycastle to generate the keystore like this :

keytool -importcert -trustcacerts -alias ludevCA -file lu_dev_cert.crt -keypass mypass -keystore keystore.bks -storepass mypass -storetype BKS -providerclass org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath bcprov-jdk15on-146.jar  

And the keylist command return a correct value.

But when i do :

KeyStore ks = KeyStore.getInstance("BKS");
InputStream in = getResources().openRawResource(R.raw.keystore);  
ks.load(in, "mypass".toCharArray());

i have a error :

wrong version of keystore

I tried to use several version of bouncycast, but the result is the same. I also tried to define keysize 1024, but nothing change.

Any ideas ?

Answer

Strider picture Strider · Jun 20, 2012

Have a Look on it Android: Trusting SSL certificates

  -storetype BKS
  -provider org.bouncycastle.jce.provider.BouncyCastleProvider
  -providerpath /path/to/bouncycastle.jar

And use this version when creating your keystore: Version 1.46 found here

May it Helps...