Caused by:java.security.NoSuchProviderException:no such provider:Crypto - Android N [英] Caused by: java.security.NoSuchProviderException: no such provider: Crypto - Android N

查看:1873
本文介绍了Caused by:java.security.NoSuchProviderException:no such provider:Crypto - Android N的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎加密提供程序已在Android N中删除。

Seems like "Crypto" provider has been removed in Android N.

我的应用程序因为NoSuchProviderException而崩溃。

My application crashing because of NoSuchProviderException.

如果我更改提供程序和算法,那么它将影响所有使用该应用程序的用户。任何一个有想法?

If I change the provider and Algorithm then it will affect user who are all using the app currently. Any one have a idea?

KeyGenerator kGen = KeyGenerator.getInstance(KEY_GENERATOR_ALGORITHM);
SecureRandom sr = SecureRandom.getInstance(STR_SHA1PRNG, **CRYPTO**);
sr.setSeed(seed);
kGen.init(128, sr);
SecretKey sKey = kGen.generateKey();

04-30 04:07:02.872:E / AndroidRuntime(17386):Caused by:java。 security.NoSuchProviderException:no such provider:Crypto

04-30 04:07:02.872: E/AndroidRuntime(17386): Caused by: java.security.NoSuchProviderException: no such provider: Crypto

推荐答案

引用 Google


加密安全提供程序已删除。如果提供程序包含在APK的代码中,或者能够处理它的缺席,那么只有在提供程序列出的情况下才会调用Java Cryptography Extension(JCE)API。应用程序使用此提供程序的原因是利用其SecureRandom实现。如果您的应用程序依赖于setSeed()从字符串派生密钥,您应该切换到使用SecretKeySpec直接加载原始密钥字节或
使用真正的密钥导出函数(KDF)。

The "Crypto" security provider has been removed. Any call to the Java Cryptography Extension (JCE) APIs with a Provider listed should only be done if the provider is included in the code of the APK or be able to deal with it’s absence. The reason applications use this provider is to take advantage of its SecureRandom implementation. If your app was relying on setSeed() to derive keys from strings, you should switch to using SecretKeySpec to load raw key bytes directly OR use a real key derivation function (KDF).

因此,这是按预期工作。

Hence, this is working as intended.


If I change the provider and Algorithm then it will affect user who are all using the app currently.

似乎你正在使用该提供者只为你的随机数字生成。因此,切换到不同的随机数生成器,并且按照Google的说明,如果我理解正确,这不应该影响现有用户。

It appears that you are using that provider only for your random number generation. Hence, switching to a different random number generator, and you follow Google's instructions, this should not affect existing users, if I understand correctly.

如果我误解了您使用 Crypto (因为我很少直接使用JCE),开发一个迁移路径,将您的应用程序的现有用户升级为不同的算法。 Android N不应该以生产形式再运送几个月,即使这样也会慢一些。

And, if I am misunderstanding how you are using Crypto (as I rarely use JCE directly), develop a migration path to upgrade existing users of your app to a different algorithm. Android N should not ship in production form for another couple of months, and even then it will be a slow uptake.

这篇关于Caused by:java.security.NoSuchProviderException:no such provider:Crypto - Android N的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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