Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong version of keystore on android call

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 ?

like image 814
JuSchz Avatar asked Jun 20 '12 10:06

JuSchz


People also ask

What is keystore used for Android?

The Android Keystore system lets you store cryptographic keys in a container to make it more difficult to extract from the device. Once keys are in the keystore, they can be used for cryptographic operations with the key material remaining non-exportable.

What keystore means?

A keystore can be a repository where private keys, certificates and symmetric keys can be stored. This is typically a file, but the storage can also be handled in different ways (e.g. cryptographic token or using the OS's own mechanism.) KeyStore is also a class which is part of the standard API.


1 Answers

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...

like image 94
Strider Avatar answered Sep 23 '22 22:09

Strider