mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 00:15:15 +08:00
Use IgnoreCertificateChainErrors option in TcpChannel (#1447)
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#if !WINDOWS_UWP
|
||||
using MQTTnet.Channel;
|
||||
using MQTTnet.Client;
|
||||
using MQTTnet.Exceptions;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Security;
|
||||
@@ -11,9 +14,6 @@ using System.Runtime.ExceptionServices;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MQTTnet.Channel;
|
||||
using MQTTnet.Client;
|
||||
using MQTTnet.Exceptions;
|
||||
|
||||
namespace MQTTnet.Implementations
|
||||
{
|
||||
@@ -274,6 +274,9 @@ namespace MQTTnet.Implementations
|
||||
return certificateValidationHandler(eventArgs);
|
||||
}
|
||||
|
||||
if (_tcpOptions?.TlsOptions?.IgnoreCertificateChainErrors ?? false)
|
||||
sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateChainErrors;
|
||||
|
||||
return sslPolicyErrors == SslPolicyErrors.None;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user