From 3cfb6b5f6eb22bf6f5409e7c9ce92076a026d5f4 Mon Sep 17 00:00:00 2001 From: Filipe GP Date: Mon, 19 Apr 2021 13:27:50 +0200 Subject: [PATCH] Update README.md --- README.md | 27 ++++++++++++++++--- .../EntityFrameworkCore.DataEncryption.csproj | 12 +++++---- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8ec3250..c82d7a8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # EntityFrameworkCore.DataEncryption -[![Build Status](https://dev.azure.com/eastrall/EntityFrameworkCore.DataEncryption/_apis/build/status/EntityFrameworkCore.DataEncryption?branchName=refs%2Fpull%2F14%2Fmerge)](https://dev.azure.com/eastrall/EntityFrameworkCore.DataEncryption/_build/latest?definitionId=9&branchName=refs%2Fpull%2F14%2Fmerge) -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2bfb621fd6fc453488d022a3eec8069e)](https://www.codacy.com/app/Eastrall/EntityFrameworkCore.DataEncryption?utm_source=github.com&utm_medium=referral&utm_content=Eastrall/EntityFrameworkCore.DataEncryption&utm_campaign=Badge_Grade) +[![Build Status](https://dev.azure.com/eastrall/EntityFrameworkCore.DataEncryption/_apis/build/status/EntityFrameworkCore.DataEncryption?branchName=master)](https://dev.azure.com/eastrall/EntityFrameworkCore.DataEncryption/_build/latest?definitionId=9&branchName=master) [![codecov](https://codecov.io/gh/Eastrall/EntityFrameworkCore.DataEncryption/branch/master/graph/badge.svg)](https://codecov.io/gh/Eastrall/EntityFrameworkCore.DataEncryption) [![Nuget](https://img.shields.io/nuget/v/EntityFrameworkCore.DataEncryption.svg)](https://www.nuget.org/packages/EntityFrameworkCore.DataEncryption) @@ -72,6 +71,8 @@ The code bellow creates a new `AesEncryption` provider and gives it to the curre ## Create an encryption provider +> :warning: This section is outdated and doesn't work for V3.0.0 and will be updated soon. + `EntityFrameworkCore.DataEncryption` gives the possibility to create your own encryption providers. To do so, create a new class and make it inherit from `IEncryptionProvider`. You will need to implement the `Encrypt(string)` and `Decrypt(string)` methods. ```csharp @@ -108,15 +109,35 @@ public class DatabaseContext : DbContext } ``` - ## Important notes ### AES Provider structure The following section describes how encrypted fields using the built-in AES provider encrypts data. +There is two available modes : + +* Fixed IV +* Dynamic IV + +#### Fixed IV + +A fixed IV is generated at setup and is used for every encrypted fields on the database. +This might be a security issue depending on your context. + +#### Dynamic IV For each encrypted field, the provider generates a new IV with a length of `16 bytes`. These 16 bytes are written at the begining of the `CryptoStream` followed by the actual input to encrypt. Similarly, for reading, the provider reads the first **16 bytes** from the input data converted as a `byte[]` to retrieve the initialization vector and then read the encrypted content. For more information, checkout the [`AesProvider`](https://github.com/Eastrall/EntityFrameworkCore.DataEncryption/blob/master/src/EntityFrameworkCore.DataEncryption/Providers/AesProvider.cs#L58) class. + +> :warning: When using Dynamic IV, you cannot use the Entity Framework LINQ extensions because the provider will generate a new IV per value, which will create unexpected behaviors. + +## Thanks + +I would like to thank all the people that supports and contributes to the project and helped to improve the library. :smile: + +## Credits + +Package Icon : from [Icons8](https://icons8.com/) \ No newline at end of file diff --git a/src/EntityFrameworkCore.DataEncryption/EntityFrameworkCore.DataEncryption.csproj b/src/EntityFrameworkCore.DataEncryption/EntityFrameworkCore.DataEncryption.csproj index c4ba5c4..8e08655 100644 --- a/src/EntityFrameworkCore.DataEncryption/EntityFrameworkCore.DataEncryption.csproj +++ b/src/EntityFrameworkCore.DataEncryption/EntityFrameworkCore.DataEncryption.csproj @@ -16,13 +16,15 @@ true entity-framework-core, extensions, dotnet-core, dotnet, encryption, fluent-api icon.png - Filipe GOMES PEIXOTO © 2019 - 2020 + Filipe GOMES PEIXOTO © 2019 - 2021 A plugin for Microsoft.EntityFrameworkCore to add support of encrypted fields using built-in or custom encryption providers. LICENSE - - - Add support for storing data as binary or Base64 - - Add support for SecureString and binary model properties - + - Add support for storing data as binary or Base64 +- Add support for SecureString and binary model properties + + + + On