Browse Source

Add remote certificate validation callback on server

release/3.x.x
Rudá Cunha 5 years ago
parent
commit
ba8ce15ab4
2 changed files with 6 additions and 3 deletions
  1. +1
    -1
      Source/MQTTnet/Implementations/MqttTcpServerListener.cs
  2. +5
    -2
      Source/MQTTnet/Server/MqttServerTlsTcpEndpointOptions.cs

+ 1
- 1
Source/MQTTnet/Implementations/MqttTcpServerListener.cs View File

@@ -160,7 +160,7 @@ namespace MQTTnet.Implementations


if (_tlsCertificate != null) if (_tlsCertificate != null)
{ {
var sslStream = new SslStream(stream, false);
var sslStream = new SslStream(stream, false, _tlsOptions.RemoteCertificateValidationCallback);


await sslStream.AuthenticateAsServerAsync( await sslStream.AuthenticateAsServerAsync(
_tlsCertificate, _tlsCertificate,


+ 5
- 2
Source/MQTTnet/Server/MqttServerTlsTcpEndpointOptions.cs View File

@@ -1,4 +1,5 @@
using System.Security.Authentication;
using System.Net.Security;
using System.Security.Authentication;


namespace MQTTnet.Server namespace MQTTnet.Server
{ {
@@ -14,7 +15,9 @@ namespace MQTTnet.Server
public bool ClientCertificateRequired { get; set; } public bool ClientCertificateRequired { get; set; }


public bool CheckCertificateRevocation { get; set; } public bool CheckCertificateRevocation { get; set; }

public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }

public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12; public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12;
} }
} }

Loading…
Cancel
Save