在 WCF 和 .NET 4.0 中使用 TLS 1.1 还是 1.2? [英] Use TLS 1.1 or 1.2 in WCF and .NET 4.0?

查看:46
本文介绍了在 WCF 和 .NET 4.0 中使用 TLS 1.1 还是 1.2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 WCF 的服务器服务和一个客户端服务,两者都使用 C# 和 .NET 4.0 版和 Visual Studio 2010 构建.

I have a Server service and a Client service using WCF, both built in C# with .NET version 4.0 and Visual Studio 2010.

我在服务器上创建并安装了自签名 SSL 和 CA 证书.到现在为止还挺好.一切正常.客户端服务能够与来自不同机器的服务器服务通信.

I created and installed self-signed SSL and CA certificates on the server. So far so good. Everything works ok. The Client is service is able to communicate with the Server service from a different machine.

但是,连接详细信息显示它使用的是 TLS 1.0.

However, the connection details show it is using TLS 1.0.

有没有办法使用 DotNet 4.0 实现 TLS 1.1 或 1.2?似乎不是,但我希望有人有适合他们的技术.

Is there a way to implement TLS 1.1 or 1.2 using DotNet 4.0? It appears not, but I was hoping someone had a technique that worked for them.

推荐答案

是的,可以在面向 .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

这篇关于在 WCF 和 .NET 4.0 中使用 TLS 1.1 还是 1.2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆