Premise: A project needs to store various password data, using the embedded SQLite database. The default SQLite database is not encrypted, which is quite unsafe. Look for ways to find a way ...
Method:
1. Encrypted using the SQLite manager.
Some SQLite managers have encryption capabilities for the SQLite database. This side dish is used by: SQLite Developer Management tool. The encryption is as follows:
The password is set to OK.
2.c# accessing the SQLite database with passwords
First of all, SQLite does not have a password to access the string format, just write to the database where the path can be:
String connstr= "Data source=f:/sqlitedb/test.db";
Access with password for more complex, the result is simple, add password parameters can:
String connstr= "Data source=f:/sqlitedb/test.db; Password=123 ";
Sample code, pro-Test valid:
string DB_PATH = "Data Source = F: /sqlitedb/test.db; Password = 123";
private void add_Click (object sender, RoutedEventArgs e)
{
using (SQLiteConnection con = new SQLiteConnection (DB_PATH))
{
con.Open ();
string sqlStr = @ "INSERT INTO hero
VALUES
(
3,
‘Test works’
) ";
using (SQLiteCommand cmd = new SQLiteCommand (sqlStr, con))
{
cmd.ExecuteNonQuery ();
}
}
}
SQLite database--c# access to encrypted SQLite database