TLS 1.1 and 1.2 support
See original GitHub issueI found TcpSocketClient cannot establish TLS 1.1 and TLS 1.2 secured connections. I trace down the code and found this piece of code which might limit how I could establish the secured connection:
if (secure)
{
var secureStream = new SslStream(_writeStream, true, (sender, cert, chain, sslPolicy) => ServerValidationCallback(sender, cert, chain, sslPolicy));
// `System.Security.Authentication.SslProtocols.Tls` bellow specifies I could only use TLSv1.0
secureStream.AuthenticateAsClient(address, null, System.Security.Authentication.SslProtocols.Tls, false);
_secureStream = secureStream;
}
I guess the reason that we only specify SslProtocols.Tls is that in previous versions, the highest .net support is Tls.
However I was wondering if we could change the code to secureStream.AuthenticateAsClient(address);
or secureStream.AuthenticateAsClient(address, null, SslProtocols.Tls | SslProtocols.Tls1.1 | SslProtocols.Tls1.2, false);
to make it working with tls1.1 and tls1.2 too.
In .net 4.6, AuthenticateAsClient(address)
will default to use “default protocol”. While in previous versions such as 3.5, it will default to SslProtocols.Default
. However my knowledge of nuget is not good enough to understand if your lib compiled targeting to say framework 3.5, but I import to 4.6, whether the code will compile against my 4.6 system lib or not. (whether it keep using SslProcols.Default
or it will pick up the “default protocol”)
All in all, can we make TcpSocketClient
to support TLS 1.1 and TLS 1.2 too?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Is there any update on this issue ? Or somebody has found a way to go around this maybe ? Thanks a lot,
I have a need to use TLS 1.2 also.