.NET 4.5中的默认安全协议

324

与支持TLS 1.2的服务器通信的默认安全协议是什么?.NET会默认选择服务器端支持的最高安全协议,还是我必须显式添加这行代码:

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

除了修改代码,是否有其他方法可以更改此默认设置?

最后,.NET 4.0 是否仅支持 TLS 1.0?即我必须将客户端项目升级到 4.5 才能支持 TLS 1.2

我的动机是在客户端上删除对 SSLv3 的支持,即使服务器支持它(我已经有了一个禁用此功能的 PowerShell 脚本),并支持服务器支持的最高 TLS 协议。

更新: 查看 .NET 4.0 中的 ServicePointManager 类,我没有看到枚举值为 TLS 1.01.1。 在 .NET 4.0/4.5 中,缺省值是 SecurityProtocolType.Tls|SecurityProtocolType.Ssl3。希望这个默认设置不会因为在注册表中禁用 SSLv3 而破坏。

但是,我决定将所有应用程序升级到 .NET 4.5 并在所有应用程序的引导代码中显式添加 SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

这将使对各种 api 和服务的出站请求不会降级到 SSLv3 并应选择最高级别的 TLS

这种方法是否合理或过度?我有许多应用程序要更新,我希望对它们进行未来的保护,因为我听说一些提供商甚至可能很快淘汰 TLS 1.0

作为向 API 发出出站请求的客户端,在注册表中禁用 SSL3 是否会在 .NET 框架中产生影响?默认情况下,TLS 1.1 和 1.2 都没有启用,我们是否必须通过注册表启用它们?请参阅 http://support.microsoft.com/kb/245030

经过一番调查后,我相信注册表设置不会产生影响,因为它们适用于 IIS(服务器子键)和浏览器(客户端子键)。

很抱歉,这篇文章变成了多个问题,接着是“可能”的答案。


最新的TLS最佳实践:https://learn.microsoft.com/en-us/dotnet/framework/network-programming/tls - JohnLBevan
想要看到最佳答案的人,请按投票排序! - navule
1
相关的SO问答:https://dev59.com/1FgR5IYBdhLWcg3wLq5n读者应该注意,这个问题已经有些年头了,截至2020年,有新的建议。 - No Refunds No Returns
17个回答

367

在其他答案上留下评论的一些人指出,将System.Net.ServicePointManager.SecurityProtocol设置为特定值意味着您的应用程序将无法利用未来可能成为.NET未来更新中默认值的新的TLS版本。所以,不要指定固定协议列表,请执行以下操作:

对于.NET 4.7或更高版本,不要设置System.Net.ServicePointManager.SecurityProtocol。默认值(SecurityProtocolType.SystemDefault)将允许操作系统使用其已知和已配置的任何版本,包括可能在创建应用程序时不存在的任何新版本。

对于早期版本的.NET Framework,您可以打开或关闭您了解和关心的协议,保留其他任何协议。

要打开TLS 1.1和1.2而不影响其他协议:

System.Net.ServicePointManager.SecurityProtocol |= 
    SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

请注意使用|=来打开这些标志而不关闭其他标志。

要关闭SSL3协议而不影响其他协议:

System.Net.ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Ssl3;

7
这才是正确答案。如果你采用被接受的答案,除非你返回更新代码,否则你的应用程序将始终切换到新的TLS版本。 - Connor
7
不,这是按位或操作,如果某些位为0,则会打开这些位。如果这些位已经是1,则不会发生任何变化。 - Scott
5
而这个的PowerShell等效版本是[Net.ServicePointManager] :: SecurityProtocol = ([Net.ServicePointManager] :: SecurityProtocol -bor [Net.SecurityProtocolType] :: Tls11 -bor [Net.SecurityProtocolType] :: Tls12)Invoke-RestMethod依赖于相同的基础.NET框架库。 - Martin Hollingsworth
36
由于没有人讨论在哪里放置这段代码,我成功地将它放到了我的ASP.NET MVC应用程序的Global.asax.cs文件中的Application_Start方法中。我正在寻找如何使我的SMTP请求通过TLS1.2发送而不是通过TLS1.0发送。我还添加了 &= ~SecurityProtocolType.Tls 以关闭TLS 1.0。 - Greg Veres
4
@Andrew,如果SecurityProtocol目前设置为SecurityProtocolType.SystemDefault(这是.Net 4.7中的默认值),则设置SecurityProtocol |= Tls11 | Tls12将禁用Tls13。因此,在.NET 4.7中,“without affecting other protocols”这句话不再适用。 - CoperNick
显示剩余15条评论

206

在 .NET 4.0/4.5 中,默认的 System.Net.ServicePointManager.SecurityProtocolSecurityProtocolType.Tls|SecurityProtocolType.Ssl3

.NET 4.0 支持最高到 TLS 1.0,而 .NET 4.5 支持最高到 TLS 1.2

然而,如果在同一环境中安装了 .NET 4.5,那么针对 .NET 4.0 的应用程序仍然可以支持最高到 TLS 1.2。因为 .NET 4.5 安装在 .NET 4.0 的上面,取代了 System.dll

我通过使用 fiddler4 观察流量以及在一个 .NET 4.0 项目中手动设置枚举值来验证了这一点:

ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 |
(SecurityProtocolType)768 | (SecurityProtocolType)3072;

参考资料:

namespace System.Net
{
    [System.Flags]
    public enum SecurityProtocolType
    {
       Ssl3 = 48,
       Tls = 192,
       Tls11 = 768,
       Tls12 = 3072,
    }
}

如果您在仅安装了.NET 4.0的环境中尝试黑客攻击,您将会收到以下异常:

Unhandled Exception: System.NotSupportedException: The requested security protocol is not supported. at System.Net.ServicePointManager.set_SecurityProtocol(SecurityProtocolType value)

然而,我不建议进行这种“黑客攻击”,因为未来的补丁等可能会破坏它。*

因此,我决定删除对SSLv3的支持的最佳方法是:

  1. 升级所有应用程序到.NET 4.5
  2. 将以下内容添加到引导代码中以覆盖默认设置并保证未来使用:

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

*如果这种黑客攻击是错误的,请有人纠正我,但是我看到的初始测试结果表明它有效。


7
请参考 https://www.imperialviolet.org/2014/12/08/poodleagain.html“现在是一个很好的时刻来重申,任何低于 TLS 1.2 并使用 AEAD 密码套件的加密方式都被破解了。” - Neil
3
@Mathew,通过查看 ServicePointManager.cs 源代码,访问链接http://referencesource.microsoft.com/#System/net/System/Net/ServicePointManager.cs,d22ab7c467e5a788,references - Luke Hutton
13
我经常看到人们声称 .NET 4.5 默认使用 Tls12 - 但正如您在这里所说,它并没有。它为 SecurityProtocol 提供了使用它的选项。 - Don Cheadle
17
我不会对这个回答进行踩票,因为它提供了很多有用的信息,但是实现硬编码协议版本并不是一个好主意,因为它将限制应用程序使用最佳可用加密,可能会导致未来的安全问题。更改注册表以改变 .Net 的默认行为以支持现代协议是非常可取的。(然而需要注意的是,注册表更改也会禁用 SSL v3。) - AJ Henderson
8
在 FW 4.6 和 4.7 中,默认值现在为 SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12,参见 https://support.microsoft.com/en-us/help/3069494/cannot-connect-to-a-server-by-using-the-servicepointmanager-or-sslstre。 - Ian Kemp
显示剩余9条评论

78
您可以在以下注册表中覆盖默认行为。
Key  : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 
Value: SchUseStrongCrypto
Type: REG_DWORD
Data : 1

并且

Key  : HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319
Value: SchUseStrongCrypto
Type: REG_DWORD
Data : 1

请参阅ServicePointManager的实现以获取详细信息。

谢谢,我不知道这个。我会测试一下。我创建了一个PowerShell脚本来设置它:https://gist.github.com/lukehutton/ab80d207172a923401b1 - Luke Hutton
6
修改注册表似乎不是一个好的解决方案。如果应用程序想要支持TLS1,则应该由应用程序来负责。而不是由运行环境负责。否则,它可能会损害其他应用程序,或者在部署和升级应用程序时会变得非常繁琐。 - Mikhail G
15
@MikhailG,恰恰相反。更改注册表是首选方法。SChannel提供了底层协商的抽象,您希望应用程序使用支持的最高安全级别。在软件中人为地限制它会导致未来发布新协议时出现问题,而您的软件无法使用它们。如果有一个选项可以说只在软件中使用更好的协议,那将很好,但没有这样的选项,否则也会阻止未来版本的工作。不过,他们确实通过该更改禁用了SSL v3。 - AJ Henderson
14
命令行:reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SchUseStrongCrypto /t REG_DWORD /d 1 /reg:64(还可以使用/reg:32)该命令用于在注册表中添加一个键值项,以启用强加密协议。其中,/v参数指定键名为"SchUseStrongCrypto",/t参数指定数据类型为REG_DWORD,/d参数指定键值为1,/reg参数指定操作的位数为64位或32位。 - Kevin Smyth
7
设置注册表并不会阻止应用程序支持旧协议,它只会改变默认设置(目前包括TLS 1.0)。此外,在.NET 4.6+中,默认行为是使用强加密。在这种情况下,此注册表项仅作为禁用强加密的手段才有用。 - Brian
显示剩余2条评论

58

3
您提供的链接似乎存在SSL证书问题。 - NathanAldenSr
即使我添加了这些注册表项,我仍然遇到了这个问题。有什么想法吗? - Samidjo
@Samidjo - 你使用的是哪个.NET版本?Luke的回答比我的详细得多,但看起来你至少需要安装.NET 4.5。另外,如果你刚刚进行了更改,可能需要重新启动应用程序池。这些只是猜测,所以没有更多的细节,我可能无法提供更多帮助 :) - dana
2
最近应用的补丁 https://support.microsoft.com/en-us/help/4019114/security-and-quality-rollup-for-the-net-framework-3-5-service-pack-1-4 导致我们的 .net 4.5.2 应用在进行 https REST 请求时失败。这些密钥解决了我们的问题。 - Kleinux

28
我发现当我只指定TLS 1.2时,它仍会下降协商到1.1版本。 System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; 我在我的 .net 4.5 Web 应用程序的 Global.asax 启动方法中指定了这个。

2
服务器支持的安全协议是什么?我认为这也是一个因素,可能1.1是服务器上最新的协议。www.passionatecoder.ca - Ehsan
18
因为这是唯一一个说明解决方案代码应该放在哪里的答案,所以我点了个赞。 - jgerman
1
客户端(例如您的C# WebClient)和服务器(您正在调用的API服务器)将协商使用双方都支持的最高协议。因此,如果您的客户端支持TLS 1.2,但服务器仅支持TLS 1.1,则客户端将使用TLS 1.1(除非您从客户端中删除TLS 1.1 - 在这种情况下,它们可能找不到相互支持的协议,客户端将出错)。 - Don Cheadle
必须在 global.asax.cs 中添加 using System.Net。 - Elim Garak

23

以下代码将会:

  • 打印已启用的协议
  • 打印可用的协议
  • 如果平台支持并且未启用TLS1.2,则启用TLS1.2
  • 禁用SSL3,如果它已被启用
  • 打印最终结果

常量:

  • 48 代表 SSL3
  • 192 代表 TLS1
  • 768 代表 TLS1.1
  • 3072 代表 TLS1.2

其他协议将不受影响,这使得代码与未来的协议兼容(Tls1.3等)。

代码

// print initial status
    Console.WriteLine("Runtime: " + System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(int).Assembly.Location).ProductVersion);
    Console.WriteLine("Enabled protocols:   " + ServicePointManager.SecurityProtocol);
    Console.WriteLine("Available protocols: ");
    Boolean platformSupportsTls12 = false;
    foreach (SecurityProtocolType protocol in Enum.GetValues(typeof(SecurityProtocolType))) {                
        Console.WriteLine(protocol.GetHashCode());
        if (protocol.GetHashCode() == 3072){
            platformSupportsTls12 = true;
        }
    }
    Console.WriteLine("Is Tls12 enabled: " + ServicePointManager.SecurityProtocol.HasFlag((SecurityProtocolType)3072));    


// enable Tls12, if possible
    if (!ServicePointManager.SecurityProtocol.HasFlag((SecurityProtocolType)3072)){
        if (platformSupportsTls12){
            Console.WriteLine("Platform supports Tls12, but it is not enabled. Enabling it now.");
            ServicePointManager.SecurityProtocol |= (SecurityProtocolType)3072;
        } else {
            Console.WriteLine("Platform does not supports Tls12.");
        }
    }

// disable ssl3
   if (ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Ssl3)) { 
      Console.WriteLine("Ssl3SSL3 is enabled. Disabling it now.");
      // disable SSL3. Has no negative impact if SSL3 is already disabled. The enclosing "if" if just for illustration.
      System.Net.ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Ssl3;                      
   }
    Console.WriteLine("Enabled protocols:   " + ServicePointManager.SecurityProtocol);

输出

Runtime: 4.7.2114.0
Enabled protocols:   Ssl3, Tls
Available protocols: 
0
48
192
768
3072
Is Tls12 enabled: False
Platform supports Tls12, but it is not enabled. Enabling it now.
Ssl3 is enabled. Disabling it now.
Enabled protocols:   Tls, Tls12

14

在经过一番努力后,注册表更改机制对我起了作用。实际上,我的应用程序正在以32位运行。因此,我必须更改路径下的值。

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319

值类型需要是DWORD,且值必须大于0。最好使用1。注册表设置以使 .Net 4.0 应用程序在机器上安装了 .Net 4.5 并使用TLS 1.2


这不是很准确的。对于.NET 4.5.2,需要将其设置为1(或更高);但对于.NET 4.6,只需不将其设置为0即可(也就是说,可以不设置)。 - Jirka Hanika
哦,我没有在 .Net 4.6 中进行测试。我的研究结果在博客文章中 http://joymonscode.blogspot.com/2015/08/how-to-make-net-40-45-use-tls-12.html。 - Joy George Kunjikkuru
你提到的注册表键应该是“Wow6432Node”。你不知何故省略了“Node”部分。我试图编辑你的回复,但我的更改只有4个字母,所以它不允许我编辑。:\ - Jeffrey LeCours
我不得不重启IIS,才能使此设置成为默认设置。 - Jeff Mitchell

14

当我的客户将TLS从1.0升级到1.2时,我遇到了问题。我的应用程序使用的是.NET Framework 3.5并在服务器上运行。所以我通过以下方式解决了这个问题:

  1. 修复程序

在调用HttpWebRequest.GetResponse()之前添加此命令:

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

通过添加2个新类System.Net和System.Security.Authentication,扩展了2个DLL的功能。

    namespace System.Net
    {
        using System.Security.Authentication;
        public static class SecurityProtocolTypeExtensions
        {
            public const SecurityProtocolType Tls12 = (SecurityProtocolType)SslProtocolsExtensions.Tls12;
            public const SecurityProtocolType Tls11 = (SecurityProtocolType)SslProtocolsExtensions.Tls11;
            public const SecurityProtocolType SystemDefault = (SecurityProtocolType)0;
        }
    } 

    namespace System.Security.Authentication
    {
        public static class SslProtocolsExtensions
        {
            public const SslProtocols Tls12 = (SslProtocols)0x00000C00;
            public const SslProtocols Tls11 = (SslProtocols)0x00000300;
        }
    } 
  1. 更新Microsoft批处理

下载批处理:

  • 对于Windows 2008 R2:windows6.1-kb3154518-x64.msu
  • 对于Windows 2012 R2:windows8.1-kb3154520-x64.msu

如需下载批处理和了解更多详情,请查看以下链接:

https://support.microsoft.com/zh-cn/help/3154518/support-for-tls-system-default-versions-included-in-the-.net-framework-3.5.1-on-windows-7-sp1-and-server-2008-r2-sp1


1
能否在不更改源代码的情况下更改SecurityProtocol?例如通过machine.config或app.config。 - ahankendi
1
哇,那是年度巫术大奖的东西...就在那里。你真是太棒了! - granadaCoder

10

我正在使用 .NET 4.5.2,并且对于这些答案都不满意。因为我要和支持 TLS 1.2 的系统通信,而 SSL3、TLS 1.0 和 TLS 1.1 都已经被破解且不安全,所以我不想启用这些协议。在 .NET 4.5.2 下,SSL3 和 TLS 1.0 协议默认都是启用的,可以通过检查 ServicePointManager.SecurityProtocol 代码来查看。在 .NET 4.7 下,有一个新的 SystemDefault 协议模式,明确将协议选择交给操作系统,在那里我认为依赖注册表或其他系统配置设置是合适的。但是在 .NET 4.5.2 下似乎不支持该模式。为了编写向前兼容的代码,即使将来 TLS 1.2 被破解,或者当我升级到 .NET 4.7+ 并将更多选择适当协议的责任交给操作系统时,仍然能做出正确的决策,我采用了以下代码:

SecurityProtocolType securityProtocols = ServicePointManager.SecurityProtocol;
if (securityProtocols.HasFlag(SecurityProtocolType.Ssl3) || securityProtocols.HasFlag(SecurityProtocolType.Tls) || securityProtocols.HasFlag(SecurityProtocolType.Tls11))
{
    securityProtocols &= ~(SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11);
    if (securityProtocols == 0)
    {
        securityProtocols |= SecurityProtocolType.Tls12;
    }
    ServicePointManager.SecurityProtocol = securityProtocols;
}

这段代码将检测是否启用了已知的不安全协议。如果是,则会移除这些不安全协议。如果没有其他明确的协议保留,我们将强制启用 TLS 1.2,因为这是目前 .NET 支持的唯一已知安全协议。此代码具有向前兼容性,因为它将考虑到未来添加的新协议类型,并且将与 .NET 4.7 中的新 SystemDefault 状态相适应,这意味着未来无需重新访问此代码。强烈建议采用这种方法,而不是无条件地硬编码任何特定的安全协议状态,否则您将不得不重新编译并替换客户端以升级到新的安全协议,当 TLS 1.2 不可避免地被攻破时,或者更有可能是您将不得不在服务器上保留现有的不安全协议数年,从而使您的组织成为攻击目标。


2
这个答案似乎是最深思熟虑的,但是,除非我漏掉了什么,否则我不确定它在TLS 1.2不可避免地出现问题时是否具有向前兼容性。从我在我的.NET 4.7.2应用程序中看到的情况来看,SecurityProtocolType.SystemDefault标志评估为0,因此使用按位包含或标志进行TLS 1.2检查时,检查if (securityProtocols == 0)将始终包括TLS 1.2,即使在它“breaks”之后,对吧?我并不是在挑刺。我真的在努力寻找最佳前进路径。 - Griswald_911
我已经修改了您的代码,包括这个内容,它似乎可以正常工作并且具备向前兼容性:if (!Enum.IsDefined(typeof(SecurityProtocolType), 0) && securityProtocols == 0) { securityProtocols |= SecurityProtocolType.Tls12; } - Griswald_911
@Griswald_911,我在我的4.7.2控制台应用程序中有类似的代码,我发现这行securityProtocols |= SecurityProtocolType.Tls12; (没有if块)不能保持SystemDefault,securityProtocols之后只有TLS2。 所以,您的意思是当值为SystemDefault时,不应更新任何值吗? 关于向前兼容性,您是否假定操作系统会负责启用较新的协议,例如TLS 1.3? - Yang
@Yang -- 正确。代码行 securityProtocols |= SecurityProtocolType.Tls12; 将添加 TLS 1.2,但由于 SecurityProtocolType 枚举类型带有 [Flags] 属性,并且 SystemDefault 枚举值为 0,即使先前已设置了 SystemDefault 值,它也将被剥离。最终结果是您可以将 SevicePointManager.SecurityProtocol 设置为 0 或任何其他枚举值的组合。如果将其设置为 SystemDefault,则基本上是选择不指定协议并让操作系统决定。 - Griswald_911
1
@Yang -- 关键是,在将值设置为SystemDefault之后,您的应用程序应该使用操作系统指定的任何内容--这在最新版本的Windows 10中是TLS 1.2。其想法是,将来当TLS 1.3成为标准时,您不必修改应用程序以继承该功能。请参阅此处的文档(https://learn.microsoft.com/en-us/dotnet/api/system.net.securityprotocoltype?view=netframework-4.7.2),其中SystemDefault“允许操作系统选择要使用的最佳协议,并阻止不安全的协议”。 - Griswald_911

9

微软最近发布了关于此事的最佳实践。 https://learn.microsoft.com/en-us/dotnet/framework/network-programming/tls

摘要

针对 .Net Framework 4.7,删除任何设置SecurityProtocol的代码,因此操作系统将确保您使用最安全的解决方案。

NB: 您还需要确保您的操作系统支持并启用了最新版本的TLS。

OS                          TLS 1.2 support

Windows 10                  \_ Supported, and enabled by default.
Windows Server 2016         /   
Windows 8.1                 \_ Supported, and enabled by default.
Windows Server 2012 R2      /
Windows 8.0                 \_ Supported, and enabled by default.
Windows Server 2012         /
Windows 7 SP1               \_ Supported, but not enabled by default*.
Windows Server 2008 R2 SP1  /
Windows Server 2008         -  Support for TLS 1.2 and TLS 1.1 requires an update. See Update to add support for TLS 1.1 and TLS 1.2 in Windows Server 2008 SP2.
Windows Vista               -  Not supported.

* To enable TLS1.2 via the registry see https://learn.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings#tls-12 

    Path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server

        Property: Enabled
        Type: REG_DWORD
        Value: 1

        Property: DisabledByDefault 
        Type: REG_DWORD
        Value: 0

    Path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client

        Property: Enabled
        Type: REG_DWORD
        Value: 1

        Property: DisabledByDefault 
        Type: REG_DWORD
        Value: 0

更多信息和旧框架,请参考微软链接。


3
问题在于如果按照指南(保持SecurityProtocolType.SystemDefault)在Windows 7和Server 2008上使用tls 1.1和tls 1.2将无法运行,因为这些操作系统中没有默认“启用”它们,除非进行注册表更改。这使得SystemDefault在实践中被设计上损坏了。Microsoft真的搞砸了这个问题。 - osexpert
好的,感谢@osexpert的提醒和指正。我已经修改了答案,包括关于支持的操作系统信息,这样就可以避免在运行旧操作系统的计算机上仅针对4.7版本进行开发时出现意外的情况。 - JohnLBevan
1
注意:某些操作系统还有一个KB可启用更新的协议:https://support.microsoft.com/en-my/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-wi - JohnLBevan
1
如果注册表设置不是一个选项,我认为这是.NET 4.7+的最佳解决方案:if (System.Environment.OSVersion.Version < new Version(6, 2) /* Windows 8 */) ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; else ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault; - osexpert

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接