首页 > 解决方案 > 如何使用多个 tls 协议

问题描述

所以我有一个当前使用 .net4.6.1 的应用程序,但由于某种原因,配置文件仍然说 targetframework = net4.5 -> 不要问为什么我不能更改它,因为它是一个 cms 系统。

我们正在使用一个到外部 api 端点的帖子,认为它只能使用 tlsv1.2。为了获得这个,我放置了这个代码:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

完美地工作,但我很难打破其他网络客户端:(。

所以其他 webclient 只能使用 tls1.0 或 tls1.1 来管理这个我已更改为以下代码:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Tls12;

好吧,当然我的 tls 异常消失了,但在事件查看器中也没有收到这篇文章。

使用wireshark,客户端使用tls v1.2发送hello,服务器使用tls1.0响应。

知道如何将 httpclient 与 tls1.2 和 webclient 与 v1.0 或 v1.1 一起使用吗?

标签: c#.net-4.5.net-4.6.1

解决方案


推荐阅读