Android bouncy castle: IOException

谁说胖子不能爱 提交于 2019-11-28 21:53:55

It seems the version of BouncyCastle shipped with Android 4.0.3 (API version 15) fails when trying to open keystores produced using the most recent BouncyCastle library. When I created a keystore using bcprov-jdk15on-147.jar, my sample Android app failed with the java.io.IOException: Wrong version of key store error.

However, if the keystore was created with the bcprov-jdk16-146.jar library, then it could be loaded by the application. My solution was to create the keystore with this older library.

Presumably this will also be the case for older API versions; try older versions of BouncyCastle when creating the keystore.

Resolved. The keytool command was missing the "-storetype BKS" argument, so although the BKS keystore file was generated, it was probably invalid.

This problem is due to your BKS-certificate password length, it must be less than or equal to 7 characters. This is a matter of U.S. policy and U.S. export controls (not due to technical reasons).

Re-export your certificate using a 7-character lenght and it will work.

Hope it helps

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