错版密钥存储在Android的电话密钥、电话、Android

2023-09-04 04:52:49 作者:不想控诉

我想打一个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  

和的密钥列表命令返回正确的值。

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());

我有一个错误:

i have a error :

wrong version of keystore

我试图用几个版本bouncycast的,但结果是一样的。我也试图定义密钥长度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.

任何想法?

推荐答案

看看它的安卓信任的SSL证书

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

和创建密钥库时使用这个版本:版本1.46 这里找到

愿它可以帮助...