无限强度Jce和Android(Unlimited Strength Jce and Android)

编程入门 行业动态 更新时间:2024-10-25 18:27:56
无限强度Jce和Android(Unlimited Strength Jce and Android)

我正在使用SpongyCastle(为Android完全实现BouncyCastle的加密函数),并且我有一个包含大小为384的密钥的bks。我尝试使用方法KeyStore.getKey(别名,密码)提取该密钥,就像密钥库中的任何密钥。 但我遇到的是错误

java.security.UnrecoverableKeyException: no match 。

做一点研究表明,这可能是因为Android的密钥太大,无法处理,这是有道理的,因为我的程序获得128和256大小的其他密钥没有问题。 通常在Java中,这可以通过将“Unlimited Strength”JCE导入Java安全文件夹来解决,但android呢? 我可以将无限强度的JCE导入到android中(我的直觉是否定的)如果没有,是否有关于如何提取密钥的建议? SpongyCastle解决了很多其他问题,我希望这里也有SpongyCastle解决方案。

谢谢!

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: no match.

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.

Thanks!

最满意答案

所以经过多次摔角之后,我发现了这个问题。

我没有指定提供程序,所以我的程序默认为默认的Android BouncyCastle。 我做的那一分钟

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

而不是

KeyStore ks = new KeyStore("BKS");

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

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

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

as opposed to

KeyStore ks = new KeyStore("BKS");

it worked just fine and did not complain.

更多推荐

本文发布于:2023-08-07 16:48:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465515.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:强度   Jce   Android   Unlimited   Strength

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!