我知道这个问题多次问,我也搜索了它,但没有找到任何工作的答案。有什么办法来保护我的应用程序从根植电话
我正在开发一个带有sqlite数据库的android应用程序,并且想要从根源手机中保护我的database.db文件,我已经应用了使用下面的代码检查根设备,但是它在某些Samsung
和Redmi
上不工作。
public class CheckRooted {
public static boolean isRooted() {
// get from build info
String buildTags = android.os.Build.TAGS;
if (buildTags != null && buildTags.contains("test-keys")) {
return true;
}
// check if /system/app/Superuser.apk is present
try {
File file = new File("/system/app/Superuser.apk");
if (file.exists()) {
return true;
}
} catch (Exception e1) {
// ignore
}
// try executing commands
return canExecuteCommand("su");
}
// executes a command on the system
private static boolean canExecuteCommand(String command) {
boolean executedSuccesfully;
try {
Runtime.getRuntime().exec(command);
executedSuccesfully = true;
} catch (Exception e) {
executedSuccesfully = false;
}
return executedSuccesfully;
}
}
还建议我如何保护我的database.db文件从根植电话,我不能使用像GreenDao或任何其他有偿服务。
数据在客户端,所以假设它不可信。作为拥有扎根电话的人,以及与应用程序数据库混淆的人,我可以告诉你这很容易做到。 – Carcigenicate
其实我正在开发一个应用程序,它在本地sqlite数据库中存储一些机密数据,在生成这个之前,我们必须清除安全测试和安全团队能够从我的应用程序中提取.db文件。并且据我了解android不可能没有root,所以这就是为什么我要求根源设备检查哪些适用于所有设备。 –
您是否正在保护设备所有者的数据?数据是随应用程序提供的,还是在用户获得应用程序后添加的? – zaph