SQLite3 Multiple Ciphers NuGet

SQLite3MultipleCiphers-NuGet provides C#/.NET bindings for SQLite3 Multiple Ciphers. Under the hood it leverages SQLitePCLRaw to create the bindings.

license

latest version is the latest version.

Until spring 2025 the component used to be maintained in Eric Sink’s GitHub repository SQLitePCL.raw - however, Eric decided to no longer publish encryption-enabled SQLite builds without cost. Since then the component is hosted on GitHub:

NuGet packages for SQLite3 Multiple Ciphers

C# 13 3

The repository SQLite3MultipleCiphers-NuGet is backed by a separate repository for building the binaries:

The project provides the following 3 NuGet packages, downloadable from NuGet.org:

Microsoft.Data.SQLite

Using this component together with Microsoft.Data.SQLite has been problematic, if not impossible, since spring 2025 until mid of November 2025 due to an annoying bug in the Microsoft.Data.SQLite implementation (see GitHub issue):

Bug in Microsoft.Data.SQLite

The behaviour of SQLite itself changed beginning with version 3.48.0. Since then simple queries like SELECT 1; touch the underlying database file, although the database schema is not affected - this was not the case for prior versions of SQLite.

Unfortunately, Microsoft.Data.SQLite uses such an SQL statement to quote the password, before setting the encryption key with PRAGMA key. Following are the relevant source code lines:

111    var quotedPassword = ExecuteScalar(
112          "SELECT quote($password);",
113          connectionOptions.Password,
114          connectionOptions.DefaultTimeout);
115    ExecuteNonQuery(
116      "PRAGMA key = " + quotedPassword + ";",
117      connectionOptions.DefaultTimeout);

The SQL command executed in function ExecuteScalar() accesses the SQLite database file internally, before the encryption key is set, and therefore throws the error message File is not a database.

A Pull request with adapted code was accepted and via backport integrated in version 10.0.1. That version was released officially in mid of November 2025.

Therefore it is strongly recommended, to only use version 10.0.1 (or higher) from now on to avoid problems with SQLite encryption.

Background

In teamwork with Brice Lambson and Eric Sink this library has been made a part of the main SQLitePCLRaw project in October/November 2023 and was released as NuGet package SQLitePCLRaw.bundle_e_sqlite3mc.

A more detailed version of the story can be read in Brice Lambson’s blog article “More SQLite Encryption in .NET”.

In November 2025 this project was published as a separate, independent NuGet package SQLite3MC.PCLRaw.bundle.

0%