gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 12:19:53 25 4
gpt4 key购买 nike

我正在这些链接中查看 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com