Refactor TLS 1.3 support.

This commit is contained in:
Christian Kratky
2020-10-31 11:23:14 +01:00
parent f8c956a9e2
commit 558d281a33
6 changed files with 14 additions and 18 deletions
@@ -39,11 +39,7 @@ namespace MQTTnet.Implementations
CreateStreams();
#if NETCOREAPP3_0 || NET5_0
IsSecureConnection = socket.Information.ProtectionLevel >= SocketProtectionLevel.Tls13;
#else
IsSecureConnection = socket.Information.ProtectionLevel >= SocketProtectionLevel.Tls12;
#endif
ClientCertificate = clientCertificate;
Endpoint = _socket.Information.RemoteAddress + ":" + _socket.Information.RemotePort;
@@ -79,7 +75,7 @@ namespace MQTTnet.Implementations
_socket.Control.IgnorableServerCertificateErrors.Add(ignorableChainValidationResult);
}
#if NETCOREAPP3_0 || NET5_0
#if NETCOREAPP3_1 || NET5_0
var socketProtectionLevel = SocketProtectionLevel.Tls13;
if (_options.TlsOptions.SslProtocol == SslProtocols.Tls12)
{
@@ -89,7 +85,7 @@ namespace MQTTnet.Implementations
{
socketProtectionLevel = SocketProtectionLevel.Tls11;
}
#else
#else
var socketProtectionLevel = SocketProtectionLevel.Tls12;
if (_options.TlsOptions.SslProtocol == SslProtocols.Tls11)
{