加密/解密SQLite数据库并使用它“即时” [英] Encrypt/Decrypt SQLite-database and use it "on the fly"

查看:183
本文介绍了加密/解密SQLite数据库并使用它“即时”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里的东西:
在我的Qt4.6项目,我使用SQLite数据库。这个数据库不应该在我的硬盘上不加密。所以我想,在我的程序的每一个开始,用户被要求输入密码解密数据库。当然,数据库从来不应该在我的硬盘上出现清楚(未加密)。

所以有可能解密一个SQLite数据库即时,读写数据吗?什么算法在这里是最好的(也许AES)?

当不可能(或很慢),也许最好加密数据库中的每个字符串,并解密字符串,当密码是正确的

Here's the thing: In my Qt4.6-Project, I use a SQLite-Database. This database shouldn't be unencrypted on my harddrive. So I want, that on every start of my program, the user gets asked to enter a password to decrypt the database. Of course the database never should appear "in clear" (not encrypted) on my harddrive.
So is there any possibility to decrypt a SQLite-database "on the fly" and read and write data? What algorithm is here the best (maybe AES)?
When it's not possible (or very slow), maybe it's better to encrypt every string in the database and decrypt the string when the password was right (so that a user could open the database, but has no clue what all the entrys could mean)?

推荐答案

没有内置的支持,用户可以打开数据库,但不知道所有条目的意思。 ,你说你有选择。

There is no built in support, that being said you do have options.

1)你可以加密/解密所有的字符串你自己,但这是一个很大的工作,不透明,

1) You can encrypt/decrypt all of your strings yourselves, but this is a lot of work, is not transparent, and won't allow you to do things like searching in the database.

2) SQLiteCrypt SQLCipher 执行您所需的操作。

2) SQLiteCrypt and SQLCipher do what you're looking for.

您可以使用它们几乎完全透明,通常他们说只有大约5%的开销比没有加密。

You can use them almost entirely transparent and typically they are said to have only about 5% overhead compared without encryption.

这篇关于加密/解密SQLite数据库并使用它“即时”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆