安装在不同操作系统上的 .NET 应用程序使用什么版本的 TLS
What version of TLS is used in a .NET application installed on different operating systems
假设我有一个标准的 .NET (4.5) Web 应用程序需要使用 TLS 连接到安全服务器。
我想停止在我的服务器中支持未使用或弱的协议和密码套件,并仅支持客户端也支持的协议和密码套件(最好是 TLS 1.2)
使用的 TLS 版本(1.0、1.1 或 1.2)和/或 密码套件是否取决于操作系统或.NET 版本?
换句话说,当我的 .NET 应用程序安装在具有不同操作系统/更新的计算机上时,是否会使用不同的密码套件或 TLS 版本?或者 .NET 4.5 的使用是否确保每次客户端-服务器通信的协议都相同?
这个答案比我在 .NET 问题上写的要好得多:
本质上:
.NET 4.0 supports up to TLS 1.0 while .NET 4.5 supports up to TLS 1.2
在实践中,我已经看到 .NET 4.5 和 .NET 4.6 都默认为 TLS 1.0,如果您不是强制性的话:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
无法对 .NET 4.7 发表评论,但我认为它仍然默认握手 TLS 1.0,因此整个互联网不会突然中断。
.NET 4.7 使用 whatever the OS default is through the SystemDefaultTlsVersions
registry key (thanks Panagiotis Kanavos) — more findings in this repo.
真正的意思是针对 .NET 4.7,ServicePointManager.SecurityProtocol
现在 returns SystemDefault
.
关于 OS 问题,是的,.NET 调用 SCHANNEL,它是 Microsoft 的安全支持提供程序(想想 Windows 世界中的 "OpenSSL")。只要您 运行 在 Windows Server 2008 R2+ 上,您就可以使用 TLS 1.2。
摘自this comprehensive blog post (blogs.msdn.microsoft.com):
这里有一些进一步的研究(我自己的)—
Starting with .NET 4.7,.NET 使用操作系统的默认设置。
The TLS stack, which is used by System.Net.Security.SslStream and up-stack components such as HTTP, FTP, and SMTP, allows developers to use the default TLS protocols supported by the operating system. Developers need no longer hard-code a TLS version.
在 4.7 之前,您必须指定 TLS 版本才能显式使用
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
对于 .NET 4.7,ServicePointManager.SecurityProtocol
(如果未明确设置)现在 returns SystemDefault
。
顺便说一句,最早支持的 .NET 版本是 4.5.2。不过,大多数系统都会有一个 较新的 版本,由其他应用程序或 Windows 更新安装。自 4.0 以来的每个版本都是以前版本的二进制替换。
假设我有一个标准的 .NET (4.5) Web 应用程序需要使用 TLS 连接到安全服务器。
我想停止在我的服务器中支持未使用或弱的协议和密码套件,并仅支持客户端也支持的协议和密码套件(最好是 TLS 1.2)
使用的 TLS 版本(1.0、1.1 或 1.2)和/或 密码套件是否取决于操作系统或.NET 版本?
换句话说,当我的 .NET 应用程序安装在具有不同操作系统/更新的计算机上时,是否会使用不同的密码套件或 TLS 版本?或者 .NET 4.5 的使用是否确保每次客户端-服务器通信的协议都相同?
这个答案比我在 .NET 问题上写的要好得多:
本质上:
.NET 4.0 supports up to TLS 1.0 while .NET 4.5 supports up to TLS 1.2
在实践中,我已经看到 .NET 4.5 和 .NET 4.6 都默认为 TLS 1.0,如果您不是强制性的话:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
无法对 .NET 4.7 发表评论,但我认为它仍然默认握手 TLS 1.0,因此整个互联网不会突然中断。
.NET 4.7 使用 whatever the OS default is through the SystemDefaultTlsVersions
registry key (thanks Panagiotis Kanavos) — more findings in this repo.
真正的意思是针对 .NET 4.7,ServicePointManager.SecurityProtocol
现在 returns SystemDefault
.
关于 OS 问题,是的,.NET 调用 SCHANNEL,它是 Microsoft 的安全支持提供程序(想想 Windows 世界中的 "OpenSSL")。只要您 运行 在 Windows Server 2008 R2+ 上,您就可以使用 TLS 1.2。
摘自this comprehensive blog post (blogs.msdn.microsoft.com):
这里有一些进一步的研究(我自己的)—
Starting with .NET 4.7,.NET 使用操作系统的默认设置。
The TLS stack, which is used by System.Net.Security.SslStream and up-stack components such as HTTP, FTP, and SMTP, allows developers to use the default TLS protocols supported by the operating system. Developers need no longer hard-code a TLS version.
在 4.7 之前,您必须指定 TLS 版本才能显式使用
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
对于 .NET 4.7,ServicePointManager.SecurityProtocol
(如果未明确设置)现在 returns SystemDefault
。
顺便说一句,最早支持的 .NET 版本是 4.5.2。不过,大多数系统都会有一个 较新的 版本,由其他应用程序或 Windows 更新安装。自 4.0 以来的每个版本都是以前版本的二进制替换。