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:
1 stringDb_path ="Data source=f:/sqlitedb/test.db; Password=123";2 3 Private voidAdd_click (Objectsender, RoutedEventArgs e)4 { 5 using(Sqliteconnection con =Newsqliteconnection (db_path))6 {7 con. Open ();8 stringSqlstr =@"INSERT into Hero9 VALUESTen ( One 3, A ' test effective ' - )"; - using(Sqlitecommand cmd =NewSqlitecommand (Sqlstr, con)) the { - cmd. ExecuteNonQuery (); - } - } +}
View Code
C # Access an encrypted SQLite database