generated from wazzamatazz/csharp-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MqttAgentTlsOptions.cs
47 lines (38 loc) · 1.63 KB
/
MqttAgentTlsOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace NRuuviTag.Mqtt {
/// <summary>
/// TLS-related options for <see cref="MqttAgent"/>.
/// </summary>
public class MqttAgentTlsOptions {
/// <summary>
/// Specifies if TLS should be used for the MQTT connection.
/// </summary>
public bool UseTls { get; set; } = true;
/// <summary>
/// The client certificates to use. Ignored if <see cref="UseTls"/> is <see langword="false"/>.
/// </summary>
public IEnumerable<X509Certificate>? ClientCertificates { get; set; }
/// <summary>
/// Specifies if untrusted server certificates will be allowed when validating server
/// certificates.
/// </summary>
public bool AllowUntrustedCertificates { get; set; }
/// <summary>
/// Specifies if certificate chain errors will be ignored when validating server
/// certificates.
/// </summary>
public bool IgnoreCertificateChainErrors { get; set; }
/// <summary>
/// A callback that can be used to perform custom validation of server certificates.
/// </summary>
/// <remarks>
/// Use this callback if you require certificate validation control beyond that offered
/// by the <see cref="AllowUntrustedCertificates"/> and <see cref="IgnoreCertificateChainErrors"/>
/// flags.
/// </remarks>
public Func<X509Certificate, X509Chain, SslPolicyErrors, bool>? ValidateServerCertificate { get; set; }
}
}