android – 不应该使用ECB模式的密码

android – 不应该使用ECB模式的密码,第1张

概述我试图使用带有RSA密钥对的密码以及“ AndroidKeyStore”.在所有的Android文档中,我可以找到,示例显示 Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding")或 Cipher.getInstance("RSA/ECB/PKCS1Padding").这两个在Android Studio上都提出了相同的警告: ECB 我试图使用带有RSA密钥对的密码以及“ AndroidKeyStore”.在所有的AndroID文档中,我可以找到,示例显示 Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding")Cipher.getInstance("RSA/ECB/PKCS1Padding").这两个在AndroID Studio上都提出了相同的警告:

ECB Encryption should not be used

Cipher#getInstance should not be called with ECB as the cipher mode or without setting the cipher mode because the default mode on androID is ECB,which is insecure.

显然我不能省略,或将模式设置为None,因为默认为ECB.如果ECB模式不安全,应该使用哪种模式?

如果我使用任何其他模式(我知道),我得到一个NoSuchAlgorithmException:找不到RSA / {mode} / OAEPWithSHA-256AndMGF1padding的提供者.填充是否可以成为问题?

无论哪种方式,根据Android KeyStore System文档,ECB模式似乎是使用RSA时唯一支持的密码块模式.

解决方法 这看起来像AndroID Studio用于查找问题的AndroID lint中的错误.该警告的意图是警告关于使用具有对称密码(例如AES)的ECB块模式.然而,由于RSA / ECB / … Cipher接受/处理一个输入块,RSA没有任何警告.

我建议你在https://code.google.com/p/android/针对AndroID lint提交错误.

总结

以上是内存溢出为你收集整理的android – 不应该使用ECB模式的密码全部内容,希望文章能够帮你解决android – 不应该使用ECB模式的密码所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1131243.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存