'Does the latest version of System.Data.Sqlite not support password encryption?

I've got a .Net Core appl and am using the System.Data.SQLite.dll package to connect to a SQLite DB.

I'm trying to encrypt the database with a password.

In version 1.0.93.0 of System.Data.SQLite.dll library I can set or change the password encryption of the database:

SQLiteConnection con = new SQLiteConnection($"Data Source=DBName;Version=3;");
conn.SetPassword($"{password}");
conn.ChangePassword($"{password}");
conn.Open();

In the latest version 1.0.113.7 the api's no longer to appear to be supported. Visual Studio throws a compiler error on the SetPassword() and ChangePassword() calls.

How do I password encrypt my databases? Is there another way to achieve this using this library (or something similar)?



Solution 1:[1]

Yes, it seems that starting with System.Data.SQLite version 1.0.113.0, support for encryption in this way was entirely removed in this checkin, by modifying the file /Targets/SQLite.NET.Settings.targets, and setting the value of InteropCodec to false.

Specifically the comment says "Merge all changes needed for the SQLite core library 3.32.0 release."

This reveals to us that the actual culprit is SQLite itself, where in release 3.32.0, they removed support for this type of encryption API as well, in this commit, where the comment says "simplify the code by removing the unsupported and undocumented SQLITE_HAS_CODEC compile-time option"

Neither the change in System.Data.SQLite nor in SQLite are documented in the release notes for these projects.

In prior versions of System.Data.SQLite, such as 1.0.112.1 and earlier, encryption via the SetPassword() method was supported, and this used the “SQLite Encryption Extension” (SEE)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1