mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 03:24:33 +08:00
Merge pull request #799 from chkr1011/revert-798-master
Revert "Replace raw bytes with x509 certificate to allow specify passwords and flags"
This commit is contained in:
@@ -85,7 +85,7 @@ namespace MQTTnet.Extensions.WebSocket4Net
|
|||||||
{
|
{
|
||||||
foreach (var certificate in _webSocketOptions.TlsOptions.Certificates)
|
foreach (var certificate in _webSocketOptions.TlsOptions.Certificates)
|
||||||
{
|
{
|
||||||
certificates.Add(certificate);
|
certificates.Add(new X509Certificate(certificate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ namespace MQTTnet.Client.Options
|
|||||||
UseTls = true,
|
UseTls = true,
|
||||||
SslProtocol = _tlsParameters.SslProtocol,
|
SslProtocol = _tlsParameters.SslProtocol,
|
||||||
AllowUntrustedCertificates = _tlsParameters.AllowUntrustedCertificates,
|
AllowUntrustedCertificates = _tlsParameters.AllowUntrustedCertificates,
|
||||||
Certificates = _tlsParameters.Certificates?.ToList(),
|
Certificates = _tlsParameters.Certificates?.Select(c => c.ToArray()).ToList(),
|
||||||
CertificateValidationCallback = _tlsParameters.CertificateValidationCallback,
|
CertificateValidationCallback = _tlsParameters.CertificateValidationCallback,
|
||||||
IgnoreCertificateChainErrors = _tlsParameters.IgnoreCertificateChainErrors,
|
IgnoreCertificateChainErrors = _tlsParameters.IgnoreCertificateChainErrors,
|
||||||
IgnoreCertificateRevocationErrors = _tlsParameters.IgnoreCertificateRevocationErrors
|
IgnoreCertificateRevocationErrors = _tlsParameters.IgnoreCertificateRevocationErrors
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace MQTTnet.Client.Options
|
|||||||
|
|
||||||
public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12;
|
public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12;
|
||||||
|
|
||||||
public IEnumerable<X509Certificate> Certificates { get; set; }
|
public IEnumerable<IEnumerable<byte>> Certificates { get; set; }
|
||||||
|
|
||||||
public bool AllowUntrustedCertificates { get; set; }
|
public bool AllowUntrustedCertificates { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace MQTTnet.Client.Options
|
|||||||
|
|
||||||
public bool AllowUntrustedCertificates { get; set; }
|
public bool AllowUntrustedCertificates { get; set; }
|
||||||
|
|
||||||
public List<X509Certificate> Certificates { get; set; }
|
public List<byte[]> Certificates { get; set; }
|
||||||
|
|
||||||
public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12;
|
public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12;
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace MQTTnet.Implementations
|
|||||||
throw new NotSupportedException("Only one client certificate is supported for UWP.");
|
throw new NotSupportedException("Only one client certificate is supported for UWP.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Certificate(options.TlsOptions.Certificates.First().GetRawCertData());
|
return new Certificate(options.TlsOptions.Certificates.First().AsBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<ChainValidationResult> ResolveIgnorableServerCertificateErrors()
|
private IEnumerable<ChainValidationResult> ResolveIgnorableServerCertificateErrors()
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ namespace MQTTnet.Implementations
|
|||||||
|
|
||||||
foreach (var certificate in _options.TlsOptions.Certificates)
|
foreach (var certificate in _options.TlsOptions.Certificates)
|
||||||
{
|
{
|
||||||
certificates.Add(certificate);
|
certificates.Add(new X509Certificate2(certificate));
|
||||||
}
|
}
|
||||||
|
|
||||||
return certificates;
|
return certificates;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace MQTTnet.Implementations
|
|||||||
clientWebSocket.Options.ClientCertificates = new X509CertificateCollection();
|
clientWebSocket.Options.ClientCertificates = new X509CertificateCollection();
|
||||||
foreach (var certificate in _options.TlsOptions.Certificates)
|
foreach (var certificate in _options.TlsOptions.Certificates)
|
||||||
{
|
{
|
||||||
clientWebSocket.Options.ClientCertificates.Add(certificate);
|
clientWebSocket.Options.ClientCertificates.Add(new X509Certificate(certificate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user