MqttClientTlsOptions.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Net.Security;
  4. using System.Security.Authentication;
  5. using System.Security.Cryptography.X509Certificates;
  6. namespace MQTTnet.Client.Options
  7. {
  8. public class MqttClientTlsOptions
  9. {
  10. public bool UseTls { get; set; }
  11. public bool IgnoreCertificateRevocationErrors { get; set; }
  12. public bool IgnoreCertificateChainErrors { get; set; }
  13. public bool AllowUntrustedCertificates { get; set; }
  14. #if WINDOWS_UWP
  15. public List<byte[]> Certificates { get; set; }
  16. #else
  17. public List<X509Certificate> Certificates { get; set; }
  18. #endif
  19. public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12;
  20. [Obsolete("This property will be removed soon. Use CertificateValidationHandler instead.")]
  21. public Func<X509Certificate, X509Chain, SslPolicyErrors, IMqttClientOptions, bool> CertificateValidationCallback { get; set; }
  22. public Func<MqttClientCertificateValidationCallbackContext, bool> CertificateValidationHandler { get; set; }
  23. }
  24. }