Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Column encryption in ASP MVC app with SQL Server 2016 using .net Core / EF Core

I am trying to use the "Always Encrypted" feature in SQL Server 2016 to encrypt some columns. I used this post as a guide to set the columns as encrypted in SSDT.

That part goes fine, it's when I attempt to query the data from the application that I get an error. According to the docs I need to add this:

column encryption setting=enabled

to my connection string. This does not appear to be supported in Entity Framework Core. I get this error:

column encryption setting=enabled is not supported

I tried using the SqlConnectionStringBuilder to build the string as well and the ability to add that setting is not there. It does appear to be there in .NET 4.6.

So, is anyone aware of a way to connect to an SQL server instance from a .NET Core application using Always Encrypted?

like image 560
Brian Avatar asked Dec 16 '16 00:12

Brian


People also ask

How do I decrypt always encrypted column in SQL Server?

Make sure you have enabled Always Encrypted for the database connection for the Query Editor window, from which you will run a SELECT query retrieving and decrypting your data. This will instruct the . NET Framework Data Provider for SQL Server (used by SSMS) to decrypt the encrypted columns in the query result set.

Is Ado net encrypted?

NET Data Provider for SQL Server, achieves this security by transparently encrypting and decrypting sensitive data in the client application.


2 Answers

As of .net Core 3.1 this is supported. I have it running in production scenario See my Answer on this stackoverflow question (Using EFCore and Azure KeyVault) : SQL Server Always Encrypted with .NET Core not compatible

like image 190
Tim Bijnens Avatar answered Oct 05 '22 02:10

Tim Bijnens


Always Encrypted is now supported in the .NET Core 3.0 Preview 5 through the new Microsoft.Data.SqlClient data provider for Microsoft SQL Server.

like image 31
SoftDev Avatar answered Oct 05 '22 01:10

SoftDev