背景
根据一篇新的Android开发人员博客文章(可用的),您应该使用一种新的技术来加密和解密存储在数据库或sharedPreferences中的敏感数据(例如密码),以便即使具有根权限的人也很难读取它。
新的方法是:
public static SecretKey generateKey() throws NoSuchAlgorithmException {
// Generate a 256-bit key
final int outputKeyLength = 256;
SecureRandom secureRandom = new SecureRandom()