简体   繁体   English

是否有TLS 1.2的.NET实现?

[英]Are there .NET implementation of TLS 1.2?

由于我刚刚发现RFC 5425需要使用TLS 1.2,并且.NET还不支持它,我想知道是否有任何实现,可能是开源的TLS 1.2协议,如RFC 5246中所定义。

Yes, though you have to turn on TLS 1.2 manually at System.Net.ServicePointManager.SecurityProtocol 是的,但您必须在System.Net.ServicePointManager.SecurityProtocol上手动打开TLS 1.2

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; // comparable to modern browsers
var response = WebRequest.Create("https://www.howsmyssl.com/").GetResponse();
var body = new StreamReader(response.GetResponseStream()).ReadToEnd();

Your client is using TLS 1.2, the most modern version of the encryption protocol 您的客户端使用的是最现代版本的加密协议TLS 1.2


Out the box, WebRequest will use TLS 1.0 or SSL 3 . 在框中, WebRequest将使用TLS 1.0或SSL 3

Your client is using TLS 1.0, which is very old, possibly susceptible to the BEAST attack, and doesn't have the best cipher suites available on it. 您的客户端正在使用TLS 1.0,它很老,可能容易受到BEAST攻击,并且没有可用的最佳密码套件。 Additions like AES-GCM, and SHA256 to replace MD5-SHA-1 are unavailable to a TLS 1.0 client as well as many more modern cipher suites. 用于替换MD5-SHA-1的AES-GCM和SHA256等附加功能不适用于TLS 1.0客户端以及更多现代密码套件。

You can make use of the SchUseStrongCrypto registry setting to require all .NET applications to use TLS 1.2 instead of 1.0 by default. 您可以使用SchUseStrongCrypto注册表设置来要求所有.NET应用程序默认使用TLS 1.2而不是1.0。

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

I fixed my problem by switching to the latest .Net Framework. 我通过切换到最新的.Net Framework来解决我的问题。 So your target Framework sets your Security Protocol. 所以你的目标框架设置你的安全协议。

when you have this in Web.config 当你在Web.config中有这个

<system.web>
  <httpRuntime targetFramework="4.5"/>
</system.web>

you will get this by default: 你会默认得到这个:

ServicePointManager.SecurityProtocol = Ssl3 | Tls

when you have this in Web.config 当你在Web.config中有这个

<system.web>
  <httpRuntime targetFramework="4.6.1"/>
</system.web>

you will get this by default: 你会默认得到这个:

ServicePointManager.SecurityProtocol = Tls12 | Tls11 | Tls

Just download this registry key and run it. 只需下载此注册表项并运行它。 It will add the necessary key to the .NET framework registry. 它将为.NET框架注册表添加必要的密钥。 You can have more info at this link . 您可以在此链接获得更多信息。 Search for 'Option 2' in '.NET 4.5 to 4.5.2'. 在“.NET 4.5到4.5.2”中搜索“选项2”。

The reg file appends the following to the Registry: reg文件将以下内容附加到注册表:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

This is the part of the page that is useful in case it goes broken : 这是页面的一部分,如果它破坏了它是有用的:

" .. enable TLS 1.2 by default without modifying the source code by setting the SchUseStrongCrypto DWORD value in the following two registry keys to 1, creating them if they don't exist: "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft.NETFramework\\v4.0.30319" and "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft.NETFramework\\v4.0.30319". Although the version number in those registry keys is 4.0.30319, the .NET 4.5, 4.5.1, and 4.5.2 frameworks also use these values. Those registry keys, however, will enable TLS 1.2 by default in all installed .NET 4.0, 4.5, 4.5.1, and 4.5.2 applications on that system. It is thus advisable to test this change before deploying it to your production servers. This is also available as a registry import file. These registry values, however, will not affect .NET applications that set the System.Net.ServicePointManager.SecurityProtocol value. " “..默认启用TLS 1.2而不修改源代码,方法是将以下两个注册表项中的SchUseStrongCrypto DWORD值设置为1,如果它们不存在则创建它们:”HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft.NETFramework \\ v4.0.30319“和“HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Wow6432Node \\ Microsoft.NETFramework \\ v4.0.30319”。虽然这些注册表项中的版本号是4.0.30319,但.NET 4.5,4.5.1和4.5.2框架也使用这些值。但是,注册表项将在该系统上的所有已安装的.NET 4.0,4.5,4.5.1和4.5.2应用程序中默认启用TLS 1.2。因此,建议在将此更改部署到生产服务器之前对其进行测试。也可用作注册表导入文件。但是,这些注册表值不会影响设置System.Net.ServicePointManager.SecurityProtocol值的.NET应用程序。“

If you are dealing with older versions of .NET Framework, then support for TLS 1.2 is available in our SecureBlackbox product in both client and server components. 如果您正在处理旧版本的.NET Framework,那么在我们的SecureBlackbox产品中,客户端和服务器组件中都支持TLS 1.2。 SecureBlackbox contains its own implementation of all algorithms, so it doesn't matter which version of .NET-based framework you use (including .NET CF) - you'll have TLS 1.2 with the latest additions in all cases. SecureBlackbox包含自己的所有算法实现,因此使用哪个版本的基于.NET的框架(包括.NET CF)并不重要 - 在所有情况下,您都将拥有TLS 1.2及最新版本。

Please note that SecureBlackbox wont magically add TLS 1.2 to framework classes - instead you need to use SecureBlackbox classes and components explicitly. 请注意,SecureBlackbox不会将TLS 1.2神奇地添加到框架类中 - 而是需要明确使用SecureBlackbox类和组件。

最新版本的SSPI (与Windows 7捆绑在一起)具有TLS 1.2的实现,可以在schannel.dll中找到

.NET Framework 4.6 uses TLS 1.2 by default. .NET Framework 4.6默认使用TLS 1.2。

Moreover, only host application should be in .NET 4.6, referenced libraries may remain in older versions. 此外,只有主机应用程序应该在.NET 4.6中,引用的库可能保留在旧版本中。

You can enable TLS 1.2 in IIS by following these instructions . 您可以按照这些说明在IIS中启用TLS 1.2。 I presume this would be sufficient if you have an ASP.NET-based application that runs on top of IIS, although it looks like it does not really meet your needs. 我认为如果你有一个在IIS之上运行的基于ASP.NET的应用程序,这就足够了,虽然看起来它并不真正满足你的需求。

这里提到的你可以添加这一行

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM