如何在我的应用程序中保护 SharedPreferences
数据?
我为此使用了 2 个步骤,但在安全审计中,黑客能够破解我的数据。
1 步-
SharedPreferences sharedPreferences = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("key", value);
editor.commit();
2 步 - 使用 SecureSharePreferences
SecurePreferences securePrefs = new SecurePreferences(context, "key", "my_user_prefs.xml");
SharedPreferences.Editor editor =securePrefs.edit();
editor.putString(key, value);
editor.commit();
处理此问题的任何其他方法。
阅读一些答案后,我用加密数据更新了我的代码,但问题仍然存在。安全审计员仍在从应用程序内存中获取应用程序 sharedpreference.file。
SharedPreferences sharedPreferences = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE);
String keyEncript = EncriptionDecriptionUtils.encriptionOfData(key).toString().trim().replaceAll("\r\n", "");
String value = sharedPreferences.getString(keyEncript, "").trim().replaceAll("\r\n", "");
String valuedecript = EncriptionDecriptionUtils.decriptionOfData(value).toString().trim().replaceAll("\r\n", "");
return valuedecript;
最佳答案
您可以使用 AES 算法加密和解密共享首选项数据。如果您明确打开共享首选项,您将仅获得加密信息。供您引用查看此 Securing SharedPreferences Data using AES algorithm
关于android - Security Auditor 如何保护我的应用程序中的共享首选项数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49671351/