简体   繁体   English

在ASP.NET核心应用程序中将其与EF核心一起使用时,如何加密postgres数据库的几列?

[英]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.

相关问题 在内存数据库提供程序中使用EF core进行asp.net core应用程序的单元测试的优势 - Advantages of using EF core in memory database provider for unit testing of asp.net core application ASP.NET Core和EF应用程序在初始化数据库上下文时停止 - ASP.NET Core and EF application stops at initialising Database context 如何使用 EF Core 3.1.5 解决 ASP.net Core 应用程序中的 null 引用异常? - How can I resolve null reference exception in ASP.net Core application using EF Core 3.1.5? 如何使用 Asp.net Core EF Core 在 Web 托管服务器上创建多个数据库 - How To Create multiple database on web hosting server using Asp.net core EF Core 如何使用相同的数据库分离 ASP.Net Core 应用程序 - How to a separate ASP.Net Core Application using same Database 使用带有EF 6的ASP.NET Core控制台应用程序“创建模型时无法使用上下文” - “Context cannot be used while the model is being created” using ASP.NET Core Console Application With EF 6 通过 EF Core 连接到 ASP.NET Core 应用程序中的 SQL 服务器时,pipe 的另一端没有进程 - No process is on the other end of pipe while connecting to SQL Server in an ASP.NET Core application via EF Core 如何使用EF在asp.net core中使用存储过程 - how to use stored procedure in asp.net core using EF 如何在 ASP.NET Core web 应用程序中使用 Entity Framework Core 从数据库中保存和检索图像? - How to save and retrieve images from database using Entity Framework Core in ASP.NET Core web application? 如何在不使用EF的情况下连接ASP.NET Core Web API中的数据库? - How do I connect to database in ASP.NET Core Web API without using EF?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM