mscorlib(4.0.0.0) API with additions
Oid.cs
2 
4 {
6  public sealed class Oid
7  {
8  private string m_value;
9 
10  private string m_friendlyName;
11 
12  private OidGroup m_group;
13 
16  public string Value
17  {
18  get
19  {
20  return m_value;
21  }
22  set
23  {
24  m_value = value;
25  }
26  }
27 
30  public string FriendlyName
31  {
32  get
33  {
34  if (m_friendlyName == null && m_value != null)
35  {
36  m_friendlyName = System.Security.Cryptography.X509Certificates.X509Utils.FindOidInfoWithFallback(1u, m_value, m_group);
37  }
38  return m_friendlyName;
39  }
40  set
41  {
42  m_friendlyName = value;
43  if (m_friendlyName != null)
44  {
45  string text = System.Security.Cryptography.X509Certificates.X509Utils.FindOidInfoWithFallback(2u, m_friendlyName, m_group);
46  if (text != null)
47  {
48  m_value = text;
49  }
50  }
51  }
52  }
53 
55  public Oid()
56  {
57  }
58 
61  public Oid(string oid)
62  : this(oid, OidGroup.All, lookupFriendlyName: true)
63  {
64  }
65 
66  internal Oid(string oid, OidGroup group, bool lookupFriendlyName)
67  {
68  if (lookupFriendlyName)
69  {
70  string text = System.Security.Cryptography.X509Certificates.X509Utils.FindOidInfoWithFallback(2u, oid, group);
71  if (text == null)
72  {
73  text = oid;
74  }
75  Value = text;
76  }
77  else
78  {
79  Value = oid;
80  }
81  m_group = group;
82  }
83 
87  public Oid(string value, string friendlyName)
88  {
89  m_value = value;
90  m_friendlyName = friendlyName;
91  }
92 
97  public Oid(Oid oid)
98  {
99  if (oid == null)
100  {
101  throw new ArgumentNullException("oid");
102  }
103  m_value = oid.m_value;
104  m_friendlyName = oid.m_friendlyName;
105  m_group = oid.m_group;
106  }
107 
108  private Oid(string value, string friendlyName, OidGroup group)
109  {
110  m_value = value;
111  m_friendlyName = friendlyName;
112  m_group = group;
113  }
114 
122  public static Oid FromFriendlyName(string friendlyName, OidGroup group)
123  {
124  if (friendlyName == null)
125  {
126  throw new ArgumentNullException("friendlyName");
127  }
128  string text = System.Security.Cryptography.X509Certificates.X509Utils.FindOidInfo(2u, friendlyName, group);
129  if (text == null)
130  {
131  throw new CryptographicException(SR.GetString("Cryptography_Oid_InvalidValue"));
132  }
133  return new Oid(text, friendlyName, group);
134  }
135 
143  public static Oid FromOidValue(string oidValue, OidGroup group)
144  {
145  if (oidValue == null)
146  {
147  throw new ArgumentNullException("oidValue");
148  }
149  string text = System.Security.Cryptography.X509Certificates.X509Utils.FindOidInfo(1u, oidValue, group);
150  if (text == null)
151  {
152  throw new CryptographicException(SR.GetString("Cryptography_Oid_InvalidValue"));
153  }
154  return new Oid(oidValue, text, group);
155  }
156  }
157 }
The exception that is thrown when an error occurs during a cryptographic operation.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Represents a cryptographic object identifier. This class cannot be inherited.
Definition: Oid.cs:6
Definition: __Canon.cs:3
string Value
Gets or sets the dotted number of the identifier.
Definition: Oid.cs:17
OidGroup
Identifies Windows cryptographic object identifier (OID) groups.
Definition: OidGroup.cs:4
Oid(Oid oid)
Initializes a new instance of the T:System.Security.Cryptography.Oid class using the specified T:Syst...
Definition: Oid.cs:97
Oid(string oid)
Initializes a new instance of the T:System.Security.Cryptography.Oid class using a string value of an...
Definition: Oid.cs:61
Oid()
Initializes a new instance of the T:System.Security.Cryptography.Oid class.
Definition: Oid.cs:55
static Oid FromOidValue(string oidValue, OidGroup group)
Creates an T:System.Security.Cryptography.Oid object by using the specified OID value and group.
Definition: Oid.cs:143
Oid(string value, string friendlyName)
Initializes a new instance of the T:System.Security.Cryptography.Oid class using the specified value ...
Definition: Oid.cs:87
static Oid FromFriendlyName(string friendlyName, OidGroup group)
Creates an T:System.Security.Cryptography.Oid object from an OID friendly name by searching the speci...
Definition: Oid.cs:122
string FriendlyName
Gets or sets the friendly name of the identifier.
Definition: Oid.cs:31