Protect SQLite database used by EntityFramework Core Application

↘锁芯ラ 提交于 2019-12-05 10:20:54

With EntityFramework Core 2.0 (EFCore 2.0), It is possible to use Encrypted SQLite database.

Steps for using SQLite Encrypted (SQLCiher) database with EFCore

  1. Add the reference of Microsoft.EntityFrameworkCore.Design in your project.

  2. Add the reference of Microsoft.EntityFrameworkCore.Sqlite.Core. This is really important step. Don't add the reference of Microsoft.EntityFrameworkCore.Sqlite. Otherwise it will not work.

  3. Add the reference of SQLitePCLRaw.bundle_sqlcipher. For encryption it is required. Add the following line ExcludeAssets="All" is important otherwise it will not work. For details refer to following link http://www.bricelam.net/2016/06/13/sqlite-encryption.html

    Download the working example from Github

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

fharreau

This post is a little bit old, but I found a solution about this problem.

Take a look to it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!