android调用上的密钥库版本错误 [英] Wrong version of keystore on android call

查看:35
本文介绍了android调用上的密钥库版本错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想发出一个 https 请求.

I want to make a https request.

我使用 bouncycastle 生成这样的密钥库:

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  

并且 keylist 命令返回一个正确的值.

And the keylist command return a correct value.

但是当我这样做时:

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

我有一个错误:

wrong version of keystore

我尝试使用几个版本的 bouncycast,但结果是一样的.我也尝试定义 keysize 1024,但没有任何改变.

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

有什么想法吗?

推荐答案

看看 Android:信任 SSL 证书

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

并在创建密钥库时使用此版本:1.46 版 在这里找到

愿它有帮助...

这篇关于android调用上的密钥库版本错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆