0

I'm using sqlite-net-pcl to develop a xamarin forms application using C#. I want to protect my .db3 with password but no property or function was found that fulfill my requirements. I need to know is there any solution to protect my db3 file? I need a solution using "sqlite-net-pcl" library only. Not "Sqlite-net-sqlcipher" or any other library.

Requirement:

  1. Protect the .db3 file with password so that no one can see the db3 structure except those who knows the password.
  2. Ask password when I try to open db3.

I have tried the following:

    SQLiteAsyncConnection _database;
     var opt = new SQLiteConnectionString(dbPath, Flags, true, "password", postKeyAction: x =>
              {
                  x.Execute("PRAGMA cipher_compatibility = 3");
              });

            _database = new SQLiteAsyncConnection(opt);

After trying this I got a following result: enter image description here

  • The database file is locked because another app is already using the file. Windows shared files do not really allow dual access. Once a file is being used you can only get read permission. Database access need full read/write access. It is better to use a real database like SQL Server which allows full access. – jdweng Feb 11 '23 at 10:52

0 Answers0