Add exception if both Certificate and X509Certificate are set

This commit is contained in:
Ben Origas
2020-04-15 09:55:23 -05:00
parent 88e8691ce0
commit 07ad9fc557
@@ -48,6 +48,10 @@ namespace MQTTnet.Implementations
{
throw new ArgumentException("TLS certificate is not set.");
}
else if (options.TlsEndpointOptions.Certificate != null && options.TlsEndpointOptions.X509Certificate != null)
{
throw new ArgumentException($"{nameof(MqttServerTlsTcpEndpointOptions.Certificate)} and {nameof(MqttServerTlsTcpEndpointOptions.X509Certificate)} cannot both be set");
}
X509Certificate2 tlsCertificate;
if (options.TlsEndpointOptions.X509Certificate != null)