Always Encrypted in Entity Framework Core Support
Asked Answered
A

2

9

As of EF Core 2.1, Always Encrypted SQL Server feature is not yet supported.

I am using both SQL Server 2016 and Azure SQL and all clients are Windows-based.

  • Can we use ADO.NET to achieve this while waiting for the feature to be implemented?
  • Is there any third party NuGet or paid component that does so?
  • Any other suggestion of how to encrypt few columns in a database with .NET Core 2.1 without rolling my own algorithm while we wait for the EF team to implement it?
Arnoldarnoldo answered 11/6, 2018 at 23:2 Comment(3)
This is a security question where everybody is encouraged NOT to role their own implementation. Voting to close it is weird.Arnoldarnoldo
see my answer here :#41028453Carine
Does this answer your question? SQL Server Always Encrypted with .NET Core not compatibleCarine
C
3

This is now supported on .Net Core 3.1, on Lower versions you will have a harder time implmenting it, also see my answer about implementing it on .Net Core 3.1 here: SQL Server Always Encrypted with .NET Core not compatible

See this github issue/comment https://github.com/dotnet/SqlClient/issues/11#issuecomment-520100830

To clarify : Microsoft.Data.SqlClient should be used on .Net Core 3.1

Carine answered 3/3, 2020 at 11:27 Comment(1)
Could you link to the reference that says this is implemented in core 3.1 so I can mark your answer?Arnoldarnoldo
N
3

Do not role your own implementation. What we ended up doing was creating a separate Windows Classic Desktop class library project in our solution that handled the data layer for the table with encrypted columns. We used Dapper for the ORM in that project and it supported the encrypted columns. It really limited some things we could do since the rest of our data layer was through EF Core but it works.

Since you are using Azure SQL, I would also recommend using the Microsoft Azure Key Vault to store the column master key. See the NuGet package Microsoft.SqlServer.Management.AlwaysEncrypted.AzureKeyVaultProvider. This NuGet package is also not supported in .NET Core.

Naive answered 22/8, 2018 at 12:34 Comment(0)
C
3

This is now supported on .Net Core 3.1, on Lower versions you will have a harder time implmenting it, also see my answer about implementing it on .Net Core 3.1 here: SQL Server Always Encrypted with .NET Core not compatible

See this github issue/comment https://github.com/dotnet/SqlClient/issues/11#issuecomment-520100830

To clarify : Microsoft.Data.SqlClient should be used on .Net Core 3.1

Carine answered 3/3, 2020 at 11:27 Comment(1)
Could you link to the reference that says this is implemented in core 3.1 so I can mark your answer?Arnoldarnoldo

© 2022 - 2025 — McMap. All rights reserved.