1

I have an application based on NETCore 2.2.0. I am using Postgres as my database and using EntityFramework.

Is there any way in which I can avoid directly using pgcrypto library, rather encrypt only a few columns of the table with the help of EF or npgsql or any other NuGet package?

Rajat Rokade
  • 115
  • 1
  • 7
  • I would take a look a [Model Extensibility Framework](https://stackoverflow.com/questions/8730830/mef-plugins-and-ef-codefirst-how/8901068#8901068) to extend entity framework adding your .net crypto logic and thus avoid pgcrypto. – Cleptus Sep 17 '19 at 09:44

1 Answers1

2

You can manually encrypt and decrypt your columns before writing/reading them. One feature which can made very easy is EF Core's value converters - simply set up one lambda to encrypt your value and another to decrypt it. The actual encryption/decryption is up to you.

Shay Rojansky
  • 15,357
  • 2
  • 40
  • 69