Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CngAlgorithmGroup.cs
Go to the documentation of this file.
2
4
5public sealed class CngAlgorithmGroup : IEquatable<CngAlgorithmGroup>
6{
7 private static CngAlgorithmGroup s_dh;
8
9 private static CngAlgorithmGroup s_dsa;
10
11 private static CngAlgorithmGroup s_ecdh;
12
13 private static CngAlgorithmGroup s_ecdsa;
14
15 private static CngAlgorithmGroup s_rsa;
16
17 private readonly string _algorithmGroup;
18
20
21 public static CngAlgorithmGroup DiffieHellman => s_dh ?? (s_dh = new CngAlgorithmGroup("DH"));
22
23 public static CngAlgorithmGroup Dsa => s_dsa ?? (s_dsa = new CngAlgorithmGroup("DSA"));
24
26
27 public static CngAlgorithmGroup ECDsa => s_ecdsa ?? (s_ecdsa = new CngAlgorithmGroup("ECDSA"));
28
29 public static CngAlgorithmGroup Rsa => s_rsa ?? (s_rsa = new CngAlgorithmGroup("RSA"));
30
31 public CngAlgorithmGroup(string algorithmGroup)
32 {
33 if (algorithmGroup == null)
34 {
35 throw new ArgumentNullException("algorithmGroup");
36 }
37 if (algorithmGroup.Length == 0)
38 {
39 throw new ArgumentException(System.SR.Format(System.SR.Cryptography_InvalidAlgorithmGroup, algorithmGroup), "algorithmGroup");
40 }
41 _algorithmGroup = algorithmGroup;
42 }
43
44 public static bool operator ==(CngAlgorithmGroup? left, CngAlgorithmGroup? right)
45 {
46 return left?.Equals(right) ?? ((object)right == null);
47 }
48
49 public static bool operator !=(CngAlgorithmGroup? left, CngAlgorithmGroup? right)
50 {
51 if ((object)left == null)
52 {
53 return (object)right != null;
54 }
55 return !left.Equals(right);
56 }
57
58 public override bool Equals([NotNullWhen(true)] object? obj)
59 {
60 return Equals(obj as CngAlgorithmGroup);
61 }
62
63 public bool Equals([NotNullWhen(true)] CngAlgorithmGroup? other)
64 {
65 if ((object)other == null)
66 {
67 return false;
68 }
69 return _algorithmGroup.Equals(other.AlgorithmGroup);
70 }
71
72 public override int GetHashCode()
73 {
74 return _algorithmGroup.GetHashCode();
75 }
76
77 public override string ToString()
78 {
79 return _algorithmGroup;
80 }
81}
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Cryptography_InvalidAlgorithmGroup
Definition SR.cs:50
Definition SR.cs:7
bool Equals([NotNullWhen(true)] CngAlgorithmGroup? other)
override bool Equals([NotNullWhen(true)] object? obj)
static bool operator!=(CngAlgorithmGroup? left, CngAlgorithmGroup? right)
static bool operator==(CngAlgorithmGroup? left, CngAlgorithmGroup? right)