Files
Dec2017-Script-Dump/System/Security/Cryptography/Oid.cs
T
2026-06-04 11:42:34 +02:00

230 lines
6.7 KiB
C#

using System;
namespace System.Security.Cryptography
{
/// <summary>Represents a cryptographic object identifier. This class cannot be inherited.</summary>
// Token: 0x020002A7 RID: 679
public sealed class Oid
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Oid" /> class.</summary>
// Token: 0x060018C9 RID: 6345 RVA: 0x00054F2C File Offset: 0x0005312C
public Oid()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Oid" /> class using a string value of an <see cref="T:System.Security.Cryptography.Oid" /> object.</summary>
/// <param name="oid">An object identifier.</param>
// Token: 0x060018CA RID: 6346 RVA: 0x00054F34 File Offset: 0x00053134
public Oid(string oid)
{
if (oid == null)
{
throw new ArgumentNullException("oid");
}
this._value = oid;
this._name = this.GetName(oid);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Oid" /> class using the specified value and friendly name.</summary>
/// <param name="value">The dotted number of the identifier.</param>
/// <param name="friendlyName">The friendly name of the identifier.</param>
// Token: 0x060018CB RID: 6347 RVA: 0x00054F64 File Offset: 0x00053164
public Oid(string value, string friendlyName)
{
this._value = value;
this._name = friendlyName;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Oid" /> class using the specified <see cref="T:System.Security.Cryptography.Oid" /> object.</summary>
/// <param name="oid">The object identifier information to use to create the new object identifier.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="oid " />is null.</exception>
// Token: 0x060018CC RID: 6348 RVA: 0x00054F7C File Offset: 0x0005317C
public Oid(Oid oid)
{
if (oid == null)
{
throw new ArgumentNullException("oid");
}
this._value = oid.Value;
this._name = oid.FriendlyName;
}
/// <summary>Gets or sets the friendly name of the identifier.</summary>
/// <returns>The friendly name of the identifier.</returns>
// Token: 0x170007C3 RID: 1987
// (get) Token: 0x060018CD RID: 6349 RVA: 0x00054FB0 File Offset: 0x000531B0
// (set) Token: 0x060018CE RID: 6350 RVA: 0x00054FB8 File Offset: 0x000531B8
public string FriendlyName
{
get
{
return this._name;
}
set
{
this._name = value;
this._value = this.GetValue(this._name);
}
}
/// <summary>Gets or sets the dotted number of the identifier.</summary>
/// <returns>The dotted number of the identifier.</returns>
// Token: 0x170007C4 RID: 1988
// (get) Token: 0x060018CF RID: 6351 RVA: 0x00054FD4 File Offset: 0x000531D4
// (set) Token: 0x060018D0 RID: 6352 RVA: 0x00054FDC File Offset: 0x000531DC
public string Value
{
get
{
return this._value;
}
set
{
this._value = value;
this._name = this.GetName(this._value);
}
}
// Token: 0x060018D1 RID: 6353 RVA: 0x00054FF8 File Offset: 0x000531F8
private string GetName(string oid)
{
switch (oid)
{
case "1.2.840.113549.1.1.1":
return "RSA";
case "1.2.840.113549.1.7.1":
return "PKCS 7 Data";
case "1.2.840.113549.1.9.3":
return "Content Type";
case "1.2.840.113549.1.9.4":
return "Message Digest";
case "1.2.840.113549.1.9.5":
return "Signing Time";
case "1.2.840.113549.3.7":
return "3des";
case "2.5.29.19":
return "Basic Constraints";
case "2.5.29.15":
return "Key Usage";
case "2.5.29.37":
return "Enhanced Key Usage";
case "2.5.29.14":
return "Subject Key Identifier";
case "2.5.29.17":
return "Subject Alternative Name";
case "2.16.840.1.113730.1.1":
return "Netscape Cert Type";
case "1.2.840.113549.2.5":
return "md5";
case "1.3.14.3.2.26":
return "sha1";
}
return this._name;
}
// Token: 0x060018D2 RID: 6354 RVA: 0x00055184 File Offset: 0x00053384
private string GetValue(string name)
{
switch (name)
{
case "RSA":
return "1.2.840.113549.1.1.1";
case "PKCS 7 Data":
return "1.2.840.113549.1.7.1";
case "Content Type":
return "1.2.840.113549.1.9.3";
case "Message Digest":
return "1.2.840.113549.1.9.4";
case "Signing Time":
return "1.2.840.113549.1.9.5";
case "3des":
return "1.2.840.113549.3.7";
case "Basic Constraints":
return "2.5.29.19";
case "Key Usage":
return "2.5.29.15";
case "Enhanced Key Usage":
return "2.5.29.37";
case "Subject Key Identifier":
return "2.5.29.14";
case "Subject Alternative Name":
return "2.5.29.17";
case "Netscape Cert Type":
return "2.16.840.1.113730.1.1";
case "md5":
return "1.2.840.113549.2.5";
case "sha1":
return "1.3.14.3.2.26";
}
return this._value;
}
// Token: 0x040013A5 RID: 5029
internal const string oidRSA = "1.2.840.113549.1.1.1";
// Token: 0x040013A6 RID: 5030
internal const string nameRSA = "RSA";
// Token: 0x040013A7 RID: 5031
internal const string oidPkcs7Data = "1.2.840.113549.1.7.1";
// Token: 0x040013A8 RID: 5032
internal const string namePkcs7Data = "PKCS 7 Data";
// Token: 0x040013A9 RID: 5033
internal const string oidPkcs9ContentType = "1.2.840.113549.1.9.3";
// Token: 0x040013AA RID: 5034
internal const string namePkcs9ContentType = "Content Type";
// Token: 0x040013AB RID: 5035
internal const string oidPkcs9MessageDigest = "1.2.840.113549.1.9.4";
// Token: 0x040013AC RID: 5036
internal const string namePkcs9MessageDigest = "Message Digest";
// Token: 0x040013AD RID: 5037
internal const string oidPkcs9SigningTime = "1.2.840.113549.1.9.5";
// Token: 0x040013AE RID: 5038
internal const string namePkcs9SigningTime = "Signing Time";
// Token: 0x040013AF RID: 5039
internal const string oidMd5 = "1.2.840.113549.2.5";
// Token: 0x040013B0 RID: 5040
internal const string nameMd5 = "md5";
// Token: 0x040013B1 RID: 5041
internal const string oid3Des = "1.2.840.113549.3.7";
// Token: 0x040013B2 RID: 5042
internal const string name3Des = "3des";
// Token: 0x040013B3 RID: 5043
internal const string oidSha1 = "1.3.14.3.2.26";
// Token: 0x040013B4 RID: 5044
internal const string nameSha1 = "sha1";
// Token: 0x040013B5 RID: 5045
internal const string oidSubjectAltName = "2.5.29.17";
// Token: 0x040013B6 RID: 5046
internal const string nameSubjectAltName = "Subject Alternative Name";
// Token: 0x040013B7 RID: 5047
internal const string oidNetscapeCertType = "2.16.840.1.113730.1.1";
// Token: 0x040013B8 RID: 5048
internal const string nameNetscapeCertType = "Netscape Cert Type";
// Token: 0x040013B9 RID: 5049
private string _value;
// Token: 0x040013BA RID: 5050
private string _name;
}
}