android – 不应该使用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性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...