Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipe GP committed Apr 19, 2021
1 parent 546e04a commit 3cfb6b5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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/)
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>entity-framework-core, extensions, dotnet-core, dotnet, encryption, fluent-api</PackageTags>
<PackageIcon>icon.png</PackageIcon>
<Copyright>Filipe GOMES PEIXOTO © 2019 - 2020</Copyright>
<Copyright>Filipe GOMES PEIXOTO © 2019 - 2021</Copyright>
<Description>A plugin for Microsoft.EntityFrameworkCore to add support of encrypted fields using built-in or custom encryption providers.</Description>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReleaseNotes>
- Add support for storing data as binary or Base64
- Add support for SecureString and binary model properties
</PackageReleaseNotes>
<PackageReleaseNotes>- Add support for storing data as binary or Base64
- Add support for SecureString and binary model properties </PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'">
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 3cfb6b5

Please sign in to comment.