c# - 哪些密码用于加密 ASP.NET Web.config 文件的部分?

标签 c# asp.net .net encryption

我正在这些链接中查看 MS 文档: https://msdn.microsoft.com/en-us/library/dtkwfdky.aspx https://msdn.microsoft.com/en-us/library/hh8x3tas.aspx

文档说明如下:

Now that the identity of your ASP.NET application has read access to the RSA key container for the default RsaProtectedConfigurationProvider object, you will encrypt sections of the Web.config file for your ASP.NET application by using that key container.

这似乎暗示 Web.config 文件中的 protected 部分将通过 RSA 加密,在示例 XML 代码中,我确实看到了以下代码

<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />

但是,我也看到了下面的代码,这似乎暗示TDES-CBC被用作密码:

<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />

使用什么密码来加密什么数据?

最佳答案

引用自各种文档:

您可以指定自己的 protected 配置提供程序,也可以使用内置于 ASP.NET 中的提供程序之一。

默认情况下,Machine.config 文件指定以下 protected 配置提供程序 [包含在 .NET Framework 中]:

DpapiProtectedConfigurationProvider。使用 Windows 数据保护 用于加密和解密数据的 API (DPAPI)。

RsaProtectedConfigurationProvider。 使用RSA加密算法对数据进行加密和解密。 [默认。]

https://msdn.microsoft.com/en-us/library/68ze1hb2(v=vs.100).aspx

// Encrypt the <connectionStrings> section.
connectionStrings.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");

“在某些情况下,您可能需要使用 RSA 或 DPAPI 提供商提供的算法以外的算法来加密信息。” https://msdn.microsoft.com/en-us/library/wfc2t3az(v=vs.100).aspx

TripleDES 提供程序示例:https://msdn.microsoft.com/en-us/library/system.security.cryptography.tripledescryptoserviceprovider(v=vs.100).aspx

关于c# - 哪些密码用于加密 ASP.NET Web.config 文件的部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47897789/

相关文章:

c# 对象初始化 - 可以通过非文字名称引用属性吗?

asp.net - 应用程序洞察 : Filter website health checks?

c# - 默认代理如何绕过大多数网址并仅适用于少数

c# - 什么时候使用 List<T>.BinarySearch?

c# - 在 C# 中获取上/下周星期三日期

asp.net vb 用户控件在调用页面上引发事件

c# - ASP.Net Identity 未创建用户

c# - 为什么使用 "new NetworkCredential(username, password)"对我的网站(来自 WinForms C# 应用程序)的基本身份验证不起作用?

.net - 如何让 WebKit 或 IE 从浏览器中打开的 HTML 页面调用您的应用程序 (.NET)?

C#:XML 转换