Browse Source

Adjusted default value for the supported Net frameworks versions where "None" is incompatible. (#1348)

release/3.x.x
HansM 2 years ago
committed by GitHub
parent
commit
47e674e4d3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions
  1. +2
    -0
      Build/MQTTnet.nuspec
  2. +7
    -2
      Source/MQTTnet.Extensions.WebSocket4Net/WebSocket4NetMqttChannel.cs
  3. +5
    -1
      Source/MQTTnet/Client/Options/MqttClientOptionsBuilderTlsParameters.cs
  4. +5
    -1
      Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs

+ 2
- 0
Build/MQTTnet.nuspec View File

@@ -16,6 +16,8 @@
* [Core] Decreased object allocations (#1324, thanks to @gfoidl).
* [Core] Decreased object allocations when logging is not active (thanks to @gfoidl, @Tymoniden).
* [Client] Fixed issue in _MqttApplicationMessageBuilder.WithPayload_ (#1322, thanks to @gfoidl).
* [Client] Adjusted default SslProtocol values to Tls12 and Tls13 (#1347).
* [Extensions.WebSocket4Net] Adjusted default SslProtocol values to Tls12 and Tls13 (#1347).

Git commit: $gitCommit
</releaseNotes>


+ 7
- 2
Source/MQTTnet.Extensions.WebSocket4Net/WebSocket4NetMqttChannel.cs View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
@@ -52,7 +52,12 @@ namespace MQTTnet.Extensions.WebSocket4Net
}
}

var sslProtocols = _webSocketOptions?.TlsOptions?.SslProtocol ?? SslProtocols.None;
#if NET48 || NETCOREAPP3_1 || NET5 || NET6
var sslProtocols = _webSocketOptions?.TlsOptions.SslProtocol ?? SslProtocols.Tls12 | SslProtocols.Tls13;
#else
var sslProtocols = _webSocketOptions?.TlsOptions.SslProtocol ?? SslProtocols.Tls12 | (SslProtocols)0x00003000 /*Tls13*/;
#endif

var subProtocol = _webSocketOptions.SubProtocols.FirstOrDefault() ?? string.Empty;

var cookies = new List<KeyValuePair<string, string>>();


+ 5
- 1
Source/MQTTnet/Client/Options/MqttClientOptionsBuilderTlsParameters.cs View File

@@ -19,7 +19,11 @@ namespace MQTTnet.Client.Options

public Func<MqttClientCertificateValidationCallbackContext, bool> CertificateValidationHandler { get; set; }

public SslProtocols SslProtocol { get; set; } = SslProtocols.None;
#if NET48 || NETCOREAPP3_1 || NET5 || NET6
public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12 | SslProtocols.Tls13;
#else
public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12 | (SslProtocols)0x00003000 /*Tls13*/;
#endif

#if WINDOWS_UWP
public IEnumerable<IEnumerable<byte>> Certificates { get; set; }


+ 5
- 1
Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs View File

@@ -26,7 +26,11 @@ namespace MQTTnet.Client.Options
public List<SslApplicationProtocol> ApplicationProtocols { get; set; }
#endif

public SslProtocols SslProtocol { get; set; } = SslProtocols.None;
#if NET48 || NETCOREAPP3_1 || NET5 || NET6
public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12 | SslProtocols.Tls13;
#else
public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12 | (SslProtocols)0x00003000 /*Tls13*/;
#endif

[Obsolete("This property will be removed soon. Use CertificateValidationHandler instead.")]
public Func<X509Certificate, X509Chain, SslPolicyErrors, IMqttClientOptions, bool> CertificateValidationCallback { get; set; }


Loading…
Cancel
Save