Skip to content

Latest commit

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Actions StatusNugetNugetQuality Gate StatusCoverageLines of Code

EF.DataEncryption

  • Flexible
  • Declarative
  • Linq support (with limitations)
  • Supports netstandard 2.1

Status

This library is still under construction and needs to be peer reviewed as well as have features added. Feel free to contribute project.

Usage

Add reference to EF.DataProtection.Services to your project.

dotnet add package EF.DataProtection.Services

Include the following code to Startup.cs

services.AddEntityFrameworkSqlite().AddDbContext<SampleDbContext>((p,opt)=>{opt.UseSqlite(_connection).UseInternalServiceProvider(p);}).AddEfEncryption().AddAes256(opt =>{opt.Password="Really_Strong_Password_For_Data";opt.Salt="Salt";}).AddSha512(opt =>{opt.Password="Really_Strong_Password_For_Data";});

Add reference to EF.DataProtection.Abstractions to your domain model project.

dotnet add package EF.DataProtection.Abstractions

Mark properties in your entity with attributes Aes256 or Sha512

publicclassPersonalData{[Aes256]publicstringPhoneNumber{get;set;}[Aes256]publicstringEmail{get;set;}[Aes256]publicstringSensitiveData{get;set;}[Sha512]publicstringPhoneNumberHash{get;protectedset;}}

Enjoy! You can find the full example here

Limitations

  • Only string supported
  • Sha512 doesn`t return value after hashing
  • There is no way to search by encrypted value. Use hash for search.

Maintainers

About

Easy to use tool for data encryption in Entity Framework Core

Topics

Resources

Stars

6 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages