Can i password encrypt SQLite database?

I am using SQLite database version 3 with C# Windows application.. i want to encrypt the SQLite database file using password or any other encryption way in order to prevent clients to open it from program files folder.

i don't want any runtime encryption ways, i just want to make the database file show password field when a client try to open it from the program files .. thanks

Edit

and if i encrypted it from code,the client can open it when the installation complete and db file transferred to the program files before opening the program to perform the encryption isnt it?

Answers


I use SQLite version 3 works perfectly! You have to do that:

//if the database has already password
try{
            string conn = @"Data Source=database.s3db;Password=Mypass;";
            SQLiteConnection connection= new SQLiteConnection(conn);
            connection.Open();
            //Some code
            connection.ChangePassword("Mypass");
            connection.Close();
    }
//if it is the first time sets the password in the database
catch
    {
            string conn = @"Data Source=database.s3db;";
            SQLiteConnection connection= new SQLiteConnection(conn);
            connection.Open();
            //Some code
            connection.ChangePassword("Mypass");
            connection.Close();
    }

thereafter if the user tries to open the database. will say protected by Admin or the database is encrypted or is not a database or corrupted file!


Found in this forum an post indicating that ..

Standard SQLite3 API doesn't offer any form of protection and relies only on underlying OS privileges mecanism (if any) for "security". If you have an existing SQLite-style database which uses a specific API to gain access, then you should use this particular (non-standard) API.

If you can/want to use some kind of extension for SQLite you can also try SQLite Encryption Extension (SEE) or SQLite Crypt

But you can change/set a password for your database using SQLite.Data as shown in this article.


Try sqlitestudio.pl as editor. For Database Type, choose System.Data.SQLite while connecting.


Unfortunately, password in SQlite file can be added or removed or changed only from code. For that you need System.Data.SQLite namespace which will give you methods as well as Adapters and connections stuff to do so.


You can use the built-in encryption of the sq-lite .net provider (System.Data.SQLite). try this:

http://sqlite.phxsoftware.com/forums/t/130.aspxenter link description here

Or use:

SQLiteCrypt API


Need Your Help

Access 2010 VBA query a table and iterate through results

vba ms-access access-vba ms-access-2010

I have a query that I want to execute against a table. With the results I want to do something. In my head the pseudo code is:

Full-screen desktop application with QML

qt4 fullscreen qml

I have experience with developing rich user interface application with flex and AS3. However the issue is its very hard to use existing c++ business logic with these flex apps. With the advent of Q...