[英]How encrypt few columns of postgres database while using it with EF core in an ASP.NET core application?
I have an application based on NETCore 2.2.0. 我有一个基于NETCore 2.2.0的应用程序。 I am using Postgres as my database and using EntityFramework.
我将Postgres用作数据库并使用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? 有什么方法可以避免直接使用pgcrypto库,而是借助EF或npgsql或任何其他NuGet包仅加密表的几列?
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.
EF Core的值转换器是一个非常容易实现的功能-只需设置一个lambda即可加密您的值,而另一个则可对其进行解密。 The actual encryption/decryption is up to you.
实际的加密/解密由您决定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.