讓.NET 4.0支援TLS1.2協議

FrankYou發表於2016-09-02

The DEFAULT System.Net.ServicePointManager.SecurityProtocol in both .NET 4.0/4.5 is:

 SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls.

.NET 4.0 supports up to TLS 1.0 while .NET 4.5 supports up to TLS 1.2

However, an application targeting .NET 4.0 can still support up to TLS 1.2 if .NET 4.5 is installed in the same environment. .NET 4.5 installs on top of .NET 4.0, replacing System.dll.

I've verified this by observing the correct security protocol set in traffic with fiddler4 and by manually setting the enumerated values in a .NET 4.0 project:

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

 

 

相關文章