Wrong version of keystore on android call Wrong version of keystore on android call android android

Wrong version of keystore on android call


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


You need to change the type of the keystore, from BKS to BKS-v1 (BKS-v1 is an older version of BKS). Because the BKS version changed as said here

There is another solution, that is much much easier:

  1. Using Portecle:
  1. You may use KeyStore Explorer

The new file will be encoded with BKS-v1 and will not show the error anymore. To change the KeyStore type, open KeyStore Explorer and go to Tools -> Change KeyStore Type and then save the file.

Note:
Android works with different BKS versions: for instance, API 15 will require BKS-1 contrary to API 23 which requires BKS, so you may need to put both files in your app.

You can use this code to switch between them depending on the API level:

int bks_version;if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {    bks_version = R.raw.publickey; //The BKS file} else {    bks_version = R.raw.publickey_v1; //The BKS (v-1) file}KeyStore ks = KeyStore.getInstance("BKS");InputStream in = getResources().openRawResource(bks_version);  ks.load(in, "mypass".toCharArray());


Finally i used a graphic editor (KeyStore Explorer) under Windows and it's working.

Maybe the error was caused by Java/Mac version problems