소스 검색

Merge pull request #800 from stepkillah/develop

Replace raw bytes with x509 certificate to allow specify passwords and flags #2
release/3.x.x
Christian 5 년 전
committed by GitHub
부모
커밋
23e93212a4
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
6개의 변경된 파일24개의 추가작업 그리고 2개의 파일을 삭제
  1. +5
    -0
      Source/MQTTnet.Extensions.WebSocket4Net/WebSocket4NetMqttChannel.cs
  2. +4
    -0
      Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs
  3. +5
    -0
      Source/MQTTnet/Client/Options/MqttClientOptionsBuilderTlsParameters.cs
  4. +4
    -1
      Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs
  5. +1
    -1
      Source/MQTTnet/Implementations/MqttTcpChannel.cs
  6. +5
    -0
      Source/MQTTnet/Implementations/MqttWebSocketChannel.cs

+ 5
- 0
Source/MQTTnet.Extensions.WebSocket4Net/WebSocket4NetMqttChannel.cs 파일 보기

@@ -85,7 +85,12 @@ namespace MQTTnet.Extensions.WebSocket4Net
{
foreach (var certificate in _webSocketOptions.TlsOptions.Certificates)
{
#if WINDOWS_UWP
certificates.Add(new X509Certificate(certificate));
#else
certificates.Add(certificate);
#endif
}
}



+ 4
- 0
Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs 파일 보기

@@ -256,7 +256,11 @@ namespace MQTTnet.Client.Options
UseTls = true,
SslProtocol = _tlsParameters.SslProtocol,
AllowUntrustedCertificates = _tlsParameters.AllowUntrustedCertificates,
#if WINDOWS_UWP
Certificates = _tlsParameters.Certificates?.Select(c => c.ToArray()).ToList(),
#else
Certificates = _tlsParameters.Certificates?.ToList(),
#endif
CertificateValidationCallback = _tlsParameters.CertificateValidationCallback,
IgnoreCertificateChainErrors = _tlsParameters.IgnoreCertificateChainErrors,
IgnoreCertificateRevocationErrors = _tlsParameters.IgnoreCertificateRevocationErrors


+ 5
- 0
Source/MQTTnet/Client/Options/MqttClientOptionsBuilderTlsParameters.cs 파일 보기

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

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

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

public bool AllowUntrustedCertificates { get; set; }



+ 4
- 1
Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs 파일 보기

@@ -15,8 +15,11 @@ namespace MQTTnet.Client.Options
public bool IgnoreCertificateChainErrors { get; set; }

public bool AllowUntrustedCertificates { get; set; }
#if WINDOWS_UWP
public List<byte[]> Certificates { get; set; }
#else
public List<X509Certificate> Certificates { get; set; }
#endif

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



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


+ 5
- 0
Source/MQTTnet/Implementations/MqttWebSocketChannel.cs 파일 보기

@@ -84,7 +84,12 @@ namespace MQTTnet.Implementations
clientWebSocket.Options.ClientCertificates = new X509CertificateCollection();
foreach (var certificate in _options.TlsOptions.Certificates)
{
#if WINDOWS_UWP
clientWebSocket.Options.ClientCertificates.Add(new X509Certificate(certificate));
#else
clientWebSocket.Options.ClientCertificates.Add(certificate);
#endif
}
}



불러오는 중...
취소
저장