mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-18 02:13:00 +08:00
Refactor TLS 1.3 support.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user