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?
Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
Adam
  • 3,872
  • 6
  • 36
  • 66
  • 1
    This is a security question where everybody is encouraged NOT to role their own implementation. Voting to close it is weird. – Adam Jun 14 '18 at 12:09
  • see my answer here :https://stackoverflow.com/questions/41027953/sql-server-always-encrypted-with-net-core-not-compatible – Tim Bijnens Mar 03 '20 at 11:25
  • Does this answer your question? [SQL Server Always Encrypted with .NET Core not compatible](https://stackoverflow.com/questions/41027953/sql-server-always-encrypted-with-net-core-not-compatible) – Tim Bijnens Mar 03 '20 at 11:25

2 Answers2

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.

John81
  • 3,726
  • 6
  • 38
  • 58
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

Tim Bijnens
  • 310
  • 2
  • 11
  • Could you link to the reference that says this is implemented in core 3.1 so I can mark your answer? – Adam Mar 03 '20 at 15:09