且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 WCF 和 .NET 4.0 中使用 TLS 1.1 还是 1.2?

更新时间:2023-02-11 16:54:07

是的,可以在面向 .NET Framework 4.0 的 .NET 应用程序中使用 TLS 1.1 和 1.2,但您需要安装 .NET 4.6(您不需要需要在您的应用程序中定位 4.6).TLS 1.2 已添加到 .NET 4.5,但 TLS 1.2 将无法在不更改代码的情况下使用.

Yes, it's possible to use TLS 1.1 and 1.2 in a .NET application targetting .NET Framework 4.0, but you will need .NET 4.6 installed (you do not need to target 4.6 in your application). TLS 1.2 was added to .NET 4.5, but TLS 1.2 will not be able to be used without code changes.

如果您希望现有的 .NET 4.0 代码使用 TLS 1.2,则需要以下内容:

If you want existing .NET 4.0 code to use TLS 1.2, you'll need the following:

  1. 安装 .NET Framework 4.6 或更高版本.这是默认使用 TLS 1.2 作为协议以及适当的 Windows 注册表项所必需的.

  1. Install .NET Framework 4.6 or higher. This is needed to use TLS 1.2 as a protocol by default in combination with proper Windows registry keys.

设置以下.NET Framework 强加密注册表项:

在 32 位和 64 位版本的 Windows 上:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]"SchUseStrongCrypto"=dword:00000001

On 32-bit and 64-bit versions of Windows: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319] "SchUseStrongCrypto"=dword:00000001

在 64 位版本的 Windows 上:[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]"SchUseStrongCrypto"=dword:00000001

On 64-bit versions of Windows: [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319] "SchUseStrongCrypto"=dword:00000001

WOW6432Node value 在 64 位系统上运行时由 32 位应用程序使用.

The WOW6432Node value is used by 32-bit applications when run on a 64-bit system.

有关更多信息,请参阅:https://github.com/TheLevelUp/pos-tls-修补程序

For more information see: https://github.com/TheLevelUp/pos-tls-patcher