-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathRemoteCertificateEventArgs.cs
More file actions
71 lines (64 loc) · 1.57 KB
/
RemoteCertificateEventArgs.cs
File metadata and controls
71 lines (64 loc) · 1.57 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace Waher.Content
{
/// <summary>
/// Remove certificate validation event arguments.
/// </summary>
public class RemoteCertificateEventArgs : EventArgs
{
private bool? isValid = null;
/// <summary>
/// Remove certificate validation event arguments.
/// </summary>
/// <param name="Certificate">Remote certificate.</param>
/// <param name="Chain">Certificate chain</param>
/// <param name="SslPolicyErrors">Any SSL policy errors detected.</param>
public RemoteCertificateEventArgs(X509Certificate Certificate,
X509Chain Chain, SslPolicyErrors SslPolicyErrors)
{
this.Certificate = Certificate;
this.Chain = Chain;
this.SslPolicyErrors = SslPolicyErrors;
}
/// <summary>
/// If remote certificate is considered valid or not. null means default
/// validation rules will be applied. Can be set once to a non-null value.
/// </summary>
public bool? IsValid
{
get => this.isValid;
set
{
if (this.isValid.HasValue && this.isValid != value)
throw new InvalidOperationException("Value has already been set.");
this.isValid = value;
}
}
/// <summary>
/// Remote certificate.
/// </summary>
public X509Certificate Certificate
{
get;
private set;
}
/// <summary>
/// Certificate chain
/// </summary>
public X509Chain Chain
{
get;
private set;
}
/// <summary>
/// Any SSL policy errors detected.
/// </summary>
public SslPolicyErrors SslPolicyErrors
{
get;
private set;
}
}
}