diff --git a/Source/MQTTnet.Extensions.WebSocket4Net/WebSocket4NetMqttChannel.cs b/Source/MQTTnet.Extensions.WebSocket4Net/WebSocket4NetMqttChannel.cs index 68b12ef..1bbc65c 100644 --- a/Source/MQTTnet.Extensions.WebSocket4Net/WebSocket4NetMqttChannel.cs +++ b/Source/MQTTnet.Extensions.WebSocket4Net/WebSocket4NetMqttChannel.cs @@ -85,7 +85,7 @@ namespace MQTTnet.Extensions.WebSocket4Net { foreach (var certificate in _webSocketOptions.TlsOptions.Certificates) { - certificates.Add(new X509Certificate(certificate)); + certificates.Add(certificate); } } diff --git a/Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs b/Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs index 65a1ec9..e9ab3df 100644 --- a/Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs +++ b/Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs @@ -256,7 +256,7 @@ namespace MQTTnet.Client.Options UseTls = true, SslProtocol = _tlsParameters.SslProtocol, AllowUntrustedCertificates = _tlsParameters.AllowUntrustedCertificates, - Certificates = _tlsParameters.Certificates?.Select(c => c.ToArray()).ToList(), + Certificates = _tlsParameters.Certificates?.ToList(), CertificateValidationCallback = _tlsParameters.CertificateValidationCallback, IgnoreCertificateChainErrors = _tlsParameters.IgnoreCertificateChainErrors, IgnoreCertificateRevocationErrors = _tlsParameters.IgnoreCertificateRevocationErrors diff --git a/Source/MQTTnet/Client/Options/MqttClientOptionsBuilderTlsParameters.cs b/Source/MQTTnet/Client/Options/MqttClientOptionsBuilderTlsParameters.cs index ea36baa..79be24a 100644 --- a/Source/MQTTnet/Client/Options/MqttClientOptionsBuilderTlsParameters.cs +++ b/Source/MQTTnet/Client/Options/MqttClientOptionsBuilderTlsParameters.cs @@ -18,7 +18,7 @@ namespace MQTTnet.Client.Options public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12; - public IEnumerable> Certificates { get; set; } + public IEnumerable Certificates { get; set; } public bool AllowUntrustedCertificates { get; set; } diff --git a/Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs b/Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs index db4077d..cf04646 100644 --- a/Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs +++ b/Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs @@ -16,7 +16,7 @@ namespace MQTTnet.Client.Options public bool AllowUntrustedCertificates { get; set; } - public List Certificates { get; set; } + public List Certificates { get; set; } public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12; diff --git a/Source/MQTTnet/Implementations/MqttTcpChannel.Uwp.cs b/Source/MQTTnet/Implementations/MqttTcpChannel.Uwp.cs index cb0f71c..2b84899 100644 --- a/Source/MQTTnet/Implementations/MqttTcpChannel.Uwp.cs +++ b/Source/MQTTnet/Implementations/MqttTcpChannel.Uwp.cs @@ -132,7 +132,7 @@ namespace MQTTnet.Implementations throw new NotSupportedException("Only one client certificate is supported for UWP."); } - return new Certificate(options.TlsOptions.Certificates.First().AsBuffer()); + return new Certificate(options.TlsOptions.Certificates.First().GetRawCertData()); } private IEnumerable ResolveIgnorableServerCertificateErrors() diff --git a/Source/MQTTnet/Implementations/MqttTcpChannel.cs b/Source/MQTTnet/Implementations/MqttTcpChannel.cs index d7943ad..8f012cb 100644 --- a/Source/MQTTnet/Implementations/MqttTcpChannel.cs +++ b/Source/MQTTnet/Implementations/MqttTcpChannel.cs @@ -214,7 +214,7 @@ namespace MQTTnet.Implementations foreach (var certificate in _options.TlsOptions.Certificates) { - certificates.Add(new X509Certificate2(certificate)); + certificates.Add(certificate); } return certificates; diff --git a/Source/MQTTnet/Implementations/MqttWebSocketChannel.cs b/Source/MQTTnet/Implementations/MqttWebSocketChannel.cs index 38e4342..c53a131 100644 --- a/Source/MQTTnet/Implementations/MqttWebSocketChannel.cs +++ b/Source/MQTTnet/Implementations/MqttWebSocketChannel.cs @@ -84,7 +84,7 @@ namespace MQTTnet.Implementations clientWebSocket.Options.ClientCertificates = new X509CertificateCollection(); foreach (var certificate in _options.TlsOptions.Certificates) { - clientWebSocket.Options.ClientCertificates.Add(new X509Certificate(certificate)); + clientWebSocket.Options.ClientCertificates.Add(certificate); } }