简体   繁体   English

密码保护的SQLite数据库

[英]Password Protected SQLite Database

I am trying to make my db file encrypted so no one can access it without having the password, so first thing came to my mind is using the built in SQLite encryption and here is the code i am using to create a password for a database 我试图使我的db文件加密,所以没有人可以访问它没有密码,所以我首先想到的是使用内置的SQLite加密,这里是我用来为数据库创建密码的代码

public void SetPassword(byte[] password)
{
    _dbConnection.SetPassword(password);
}

But what really i am surprised about is that any one could easily remove the password and see the content of the database using a very simple code like 但令我感到惊讶的是,任何人都可以轻松删除密码并使用非常简单的代码查看数据库的内容

public void RemovePassword(SQLiteConnection conn)
{
    conn.ChangePassword(null);
}

So i was wondering what is the use of that build in encryption if it can be removed that easy ?!. 所以我想知道如果可以轻松删除那么加密中的构建有什么用途?! Or am i wrong about something i have mentioned ? 或者我错了我提到过的事情?

Ok the solution is simply : 好的解决方案很简单:

When a password is set to the database using 使用时将密码设置为数据库

.SetPassword(password);

it can't be simply removed or changed using the changepassword function unless you have legally connected to the database using the old password {Or cracked the database somehow :D} 它不能简单地使用changepassword函数删除或更改,除非您使用旧密码合法地连接到数据库{或以某种方式破解数据库:D}

.ChangePassword(password);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM