Android SQLite文件加密

Android SQLite file encryption

我正在构建一个用于托管应用程序的 SDK。此 SDK 包括使用 SQLite 处理数据库。

要求之一是数据库将被加密以防止 从设备中提取 SQLite 数据库并使用用户私人信息。

我开始使用SQLCipher,但不支持64位架构设备,导致应用程序崩溃。

我检查了其他一些可能性,但所有这些都导致了其他问题,我决定尝试自己处理。

我的问题:

  1. Android是否有一些数据库文件的加密机制?
  2. 我可以在应用程序启动时加密文件,并在应用程序关闭时再次解密吗?我知道在 iOS 中有一种叫做 NSFileProtection
  3. 的可能性
  4. 您知道其他可以处理 DB 加密并支持 64 位设备的库吗?
  5. 您知道是否有 Android 解决方案,而不使用 JNI(javax.crypto)?

我很乐意获得任何信息或帮助。

there is no support for 64bit architecture devices

SQLCipher 在我使用过的 64 位设备上运行良好。我似乎回想起一些具有多个 NDK libraries/code 的应用程序的一些问题,其中一些有 64 位库而一些没有,其中存在问题。我建议您打开单独的 Stack Overflow 问题,或使用其他支持资源(例如,SQLCipher 的支持板),以查明您遇到的困难。

Does Android have some encryption mechanism for DB files?

没有

Can I encrypt the file when the application starts, and decrypt it again when the application is closing?

不,有几个原因,其中最重要的是应用程序不会在 Android 关闭。

Do you know other library that can handle the DB encryption, that supports 64bit devices?

不,无论如何,请求 off-site 资源被认为是 off-topic 用于 Stack Overflow。

Do you know if there is an Android solution for this, without using JNI(javax.crypto)?

这个和第一、三题一样

您需要使用最新版本的android-database-sqlcipher here. Am using 3.5.4 it solved "java.lang.UnsatisfiedLinkError: dlopen failed: library "libutils.so" not found". Please check it here