Protect SQLite Database Used by EntityFramework Core

I am trying to use EntityFramework Core 1.0 (new name for EntityFramework 7) to manage a SQLite database in a C # working application.

I am reading the official documentation and my test application is working.

My question is: is it possible to password protect the database?

I know that there are many ways to do this, it exists and the .NET class System.Data.SQLite that allow this, but how to do it using EFCore 1?

I can’t understand if this is possible.

Thanks for the help,

Enrico

+2
c # sqlite entity-framework-core
source share
3 answers

EF Core uses Microsoft.Data.Sqlite, which currently does not support out-of-box encryption. See https://github.com/aspnet/Microsoft.Data.Sqlite/issues/184 . You can add encryption yourself using SQLite extensions.

+2
source share

With EntityFramework Core 2.0 (EFCore 2.0), you can use an encrypted SQLite database.

Steps to use SQLite Encrypted Database (SQLCiher) with EFCore

  • Add the Microsoft.EntityFrameworkCore.Design link to your project.

  • Add the Microsoft.EntityFrameworkCore.Sqlite.Core link. This is a really important step. Do not add a link to Microsoft.EntityFrameworkCore.Sqlite. Otherwise it will not work.

  • Add the SQLitePCLRaw.bundle_sqlcipher link. For encryption required. Add the following line: ExcludeAssets = "All" Otherwise, this will not work. For more information, see the following link http://www.bricelam.net/2016/06/13/sqlite-encryption.html

    Download a working example from Github

+1
source share

This post is a bit outdated, but I found a solution to this problem.

Take a look.

-one
source share

All Articles