开发者

Unlimited Strength Jce and Android

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 res开发者_如何学Pythonolved 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜