mercredi 8 avril 2015

How to check if SQLite database is encrypted

I'm encrypting my SQLite database with a password after I create and populate it on first execution of my project (Win Forms with C#). The code I'm using is the following:




var connection = new SQLiteConnection(_connectionString);
try
{
connection.Open();
connection.SetPassword(password);
}
finally
{
connection.Close();
connection.Dispose();
}


Now I need to check if the database is already encrypted to change the connection string adding the password. So, I found this how-to-know-a-sqlite-database-is-encrypted-or-not, but this is applied to an Android app and my case is a WinForms app. Is there another way to achieve this instead of inspecting the first bytes?


Thanks!


Aucun commentaire:

Enregistrer un commentaire