SQLite with encryption/password protection

后端 未结 9 1103
遇见更好的自我
遇见更好的自我 2020-11-22 07:45

I\'m just learning to use SQLite and I was curious if such is possible:

  1. Encryption of the database file?

  2. Password protect opening of the dat

9条回答
  •  旧时难觅i
    2020-11-22 08:16

    You can password protect SQLite3 DB. For the first time before doing any operations, set password as follows.

    SQLiteConnection conn = new SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;");
    conn.SetPassword("password");
    conn.open();
    

    then next time you can access it like

    conn = new SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;Password=password;");
    conn.Open();
    

    This wont allow any GUI editor to view Your data. Later if you wish to change the password, use conn.ChangePassword("new_password"); To reset or remove password, use conn.ChangePassword(String.Empty);

提交回复
热议问题