如何加密SQLITE .db文件 [英] How to encrypt a SQLITE .db file
本文介绍了如何加密SQLITE .db文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发了一个在sqlite数据库上运行的Windows应用程序。我用安装程序打包.db文件。但我希望这个.db文件不应该被任何sqlite编辑器打开,比如SqliteAdmin等。不知道怎么做?
谢谢
Hi,
I've developed a windows application which runs on a sqlite database. I'm packaging that .db file with installer. But i want that this .db file should not be opened by any sqlite editor like SqliteAdmin etc.. ANy idea how to do this??
Thank you
推荐答案
阅读以下内容:
http://stackoverflow.com/questions/1381264/password-protect-a-sqlite-db-is-it-possible [ ^ ]
http:// stackoverflow .com / questions / 5669905 / sqlite-with-encryption-password-protection [ ^ ]
Read the following :
http://stackoverflow.com/questions/1381264/password-protect-a-sqlite-db-is-it-possible[^]
http://stackoverflow.com/questions/5669905/sqlite-with-encryption-password-protection[^]
设置密码:
To set the password:
public static void SetPassword ()
{
var con = new SQLiteConnection(connectionString);
con.Open();
con.ChangePassword(PASSWORD);
con.Close();
}
删除密码:
To remove the password:
public static void ReSetPassword()
{
var con = new SQLiteConnection(connectionString);
con.Open();
con.ChangePassword("");
con.Close();
}
要以编程方式打开加密数据库,请将密码附加到常规连接字符串:
To open the encrypted database programmatically, append the password to the regular connection string:
connectionString += "Password=" + thePassword + ";";
这篇关于如何加密SQLITE .db文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文