我知道這個問題多次問,我也搜索了它,但沒有找到任何工作的答案。有什麼辦法來保護我的應用程序從根植電話
我正在開發一個帶有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