无限强度JCE和Android [英] Unlimited Strength Jce and Android

查看:582
本文介绍了无限强度JCE和Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用SpongyCastle(全面实施BouncyCastle的公司为Android加密功能),我有一个包含大小384.我试图使用方法KeyStore.getKey提取该键的键BKS(别名,密码)就像在一个密钥库任意键。但我遇到的是误差

I'm using SpongyCastle (full implementation of BouncyCastle's crypto functions for Android) and I have a bks that contains a key of size 384. I'm trying to extract that key using the method KeyStore.getKey(alias, password) as you would any key in a keystore. But what I'm running into is the error

java.security.UnrecoverableKeyException:没有匹配

做的一点点研究表明,这可能是因为密钥尺寸太大为Android来处理这有意义的,因为我的程序变得尺寸128和256没有问题的其他键。通常,在Java中,这将通过导入无限力量JCE到Java的安全文件夹,但什么关于Android解决?我可以导入无限强度JCE成机器人(我的直觉是没有)如果没有,是否有任何建议,如何提取的关键? SpongyCastle已经解决了很多我的其他问题,我希望能有一个解决方案SpongyCastle也在这里。

Doing a little bit of research indicates that it might be because the key size is too big for Android to handle which makes sense as my program gets the other keys of sizes 128 and 256 no problem. Normally in Java, this would be resolved by importing the "Unlimited Strength" JCE into the Java security folder but what about android? Can I import the unlimited strength JCE into android (my gut instinct is no) If not, are there any suggestions as to how to extract the key? SpongyCastle has solved a lot of my other issues, I'm hoping there's a SpongyCastle solution here too.

谢谢!

推荐答案

所以用它做摔跤之后,我想通了这个问题。

So after much wrestling with it, I figured out the problem.

我不指定供应商,所以我的程序默认为默认的Andr​​oid BouncyCastle的。那一刻我确实

I wasn't specifying a provider so my program defaulted to the default Android BouncyCastle. The minute I did

KeyStore ks = new KeyStore("BKS","SC");

,而不是

KeyStore ks = new KeyStore("BKS");

它工作得很好,没有抱怨。

it worked just fine and did not complain.

这篇关于无限强度JCE和Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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