wrong version keystore when doing https call

北慕城南 提交于 2019-12-01 03:03:06

Did you create your keystore with the Bouncy Castle format? All these 3 parameters are mandatory when creating the keystore with keytool (and especially the keystore type must be BKS):

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

Android uses version 1.46 of bouncycastle, make sure you use this version when creating your keystore Version 1.46 is found here

In case anyone stumbles upon this and @Jcs excellent answer does not solve it: I experienced exactly the same issues, and it turned out I didn't install the SSL certificates on my web server correctly. I got the idea when using digicert's SSL testing tool: My certificate provider used the common practice of signing server certificates with an intermediate CA. After installing the certificate chain (which links the issuer's intermediate CA to their root CA), everything worked fine.

An easy alternative is to use Portecle to generate the BKS:

  1. Download Boucycastle Provider 1.46
  2. Replace bcprov.jar in your Portecle install directory (example: C:\Program Files (x86)\Portecle\bcprov.jar). Same naming is required.
  3. Restart Portecle and generate your BKS truststore.

Remark: For me the issue was on Android 4.0.3 and that fixed it.

More explanations here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!