SQLite Encryption using Entity Framework Core (EFCore)
This is a real life example which demostrates how to use SQLite encrypted databases using Entity Framework Core (EFCore).
The database is using SQLCipher encryption. To create/explore SQLite databases with encrytion manually, you may use the open source DB Browser for SQLite, which you can find here https://sqlitebrowser.org/ or on GitHub https://github.com/sqlitebrowser/sqlitebrowser .
This example is using .Net Core 3.1 with EFCore 3.1.6 and SQLCipher 2.0.3:
Microsoft.EntityFrameworkCore
in your projectMicrosoft.EntityFrameworkCore.Design
in your projectMicrosoft.EntityFrameworkCore.Sqlite.Core
in your project This is a really important step: DO NOT add a reference to Microsoft.EntityFrameworkCore.Sqlite, otherwise it will not work!
SQLitePCLRaw.bundle_e_sqlcipher
SqliteConnection
), defining the database access password in the connection string (you can use SqliteConnectionStringBuilder
) you give to the constructorUseSqlite
method, when configuring the database context