Study From
https://stackoverflow.com/questions/28286086/default-securityprotocol-in-net-4-5
The default System.Net.ServicePointManager.SecurityProtocol
in both .NET 4.0/4.5
is SecurityProtocolType.Tls|SecurityProtocolType.Ssl3
.
.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;
Reference:
namespace System.Net { [System.Flags] public enum SecurityProtocolType { Ssl3 = 48, Tls = 192, Tls11 = 768, Tls12 = 3072, } }
If you attempt the hack on an environment with ONLY .NET 4.0
installed, you will get the exception:
Unhandled Exception: System.NotSupportedException: The requested security protocol is not supported. at System.Net.ServicePointManager.set_SecurityProtocol(SecurityProtocolType v alue)
However, I wouldn't recommend this "hack" since a future patch, etc. may break it.*
Therefore, I've decided the best route to remove support for SSLv3
is to:
- Upgrade all applications to
.NET 4.5
-
Add the following to boostrapping code to override the default and future proof it:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
*Someone correct me if this hack is wrong, but initial tests I see it works