Android 的 sqlite 加密
我正在努力寻找在 Android 设备上加密我的 sqlite 数据库的可能性,但我无法找到令人满意的解决方案。
我需要类似库之类的东西来引用,以便在使用正常的 sqlite 函数时对我的数据库进行“动态”加密/解密。
我不想在存储之前加密数据。
我不想加密整个数据库文件,以便在使用之前对其进行解密。
我知道以下项目:
但我找不到这个东西的任何工作示例。
顺便说一句,我绝对愿意购买商业版本,但在花费几百美元之前我必须先进行测试。
有人自己解决这个问题吗?
i'm looking very hard for a possibility to encrypt my sqlite database on Android devices, but I was't able to find a satisfying solution.
I need something like a libary to reference, in order to have a "on the fly" encryption/decryption of my database, while using the normal sqlite functions.
I don't want to encrypt data before storing.
I don't want to encrypt the whole databasefile, in order to decrypt it before using.
I know about the following projects:
But I can't find any working example for this stuff.
Btw, I'm absolutly willing to purchase a commercial build, but I have to test ist before spending a few hundred dollars.
Did anyone solve this issue for his own?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
尝试SQLCipher 移植到 Android,而不是常规 SQLCipher。
Try the SQLCipher port to Android instead of the regular SQLCipher.
litereplica 支持 使用 ChaCha 密码进行加密,在便携式设备上比 AES 更快。
Android 有绑定。
要创建并打开加密数据库,我们使用如下 URI:
litereplica supports encryption using the ChaCha cipher, faster than AES on portable devices.
There are bindings for Android.
To create and open an encrypted database we use an URI like this:
如果有人仍在寻找:
重写
SQLiteOpenHelper
函数,如下所示:If anyone is still looking:
Override
SQLiteOpenHelper
function as below:我只是使用
加密
函数来加密密码。这里我使用用户的密码作为密钥。因此我不需要将密钥保留在应用程序内。当用户想要登录时,只需对密码进行加密并尝试与数据库中的加密密码进行匹配并允许其登录。I just used the
encrypt
function to encrypt the password. Here I used the user's password as a key. Therefore I don't need to keep the key inside the application. When the user wants to log in, simply encrypt the password and try to match with the encrypted password in the database and allow them to log in.