Просмотр исходного кода

Merge pull request #798 from stepkillah/master

Replace raw bytes with x509 certificate to allow specify passwords and flags
release/3.x.x
Christian 5 лет назад
committed by GitHub
Родитель
Сommit
c490e83c91
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 4AEE18F83AFDEB23
7 измененных файлов: 7 добавлений и 7 удалений
  1. +1
    -1
      Source/MQTTnet.Extensions.WebSocket4Net/WebSocket4NetMqttChannel.cs
  2. +1
    -1
      Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs
  3. +1
    -1
      Source/MQTTnet/Client/Options/MqttClientOptionsBuilderTlsParameters.cs
  4. +1
    -1
      Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs
  5. +1
    -1
      Source/MQTTnet/Implementations/MqttTcpChannel.Uwp.cs
  6. +1
    -1
      Source/MQTTnet/Implementations/MqttTcpChannel.cs
  7. +1
    -1
      Source/MQTTnet/Implementations/MqttWebSocketChannel.cs

+ 1
- 1
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);
}
}



+ 1
- 1
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


+ 1
- 1
Source/MQTTnet/Client/Options/MqttClientOptionsBuilderTlsParameters.cs Просмотреть файл

@@ -18,7 +18,7 @@ namespace MQTTnet.Client.Options

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

public IEnumerable<IEnumerable<byte>> Certificates { get; set; }
public IEnumerable<X509Certificate> Certificates { get; set; }

public bool AllowUntrustedCertificates { get; set; }



+ 1
- 1
Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs Просмотреть файл

@@ -16,7 +16,7 @@ namespace MQTTnet.Client.Options

public bool AllowUntrustedCertificates { get; set; }

public List<byte[]> Certificates { get; set; }
public List<X509Certificate> Certificates { get; set; }

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



+ 1
- 1
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<ChainValidationResult> ResolveIgnorableServerCertificateErrors()


+ 1
- 1
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;


+ 1
- 1
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);
}
}



Загрузка…
Отмена
Сохранить