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

120 lines
4.6 KiB
C#

using System;
using System.Text;
namespace System.Security.Cryptography.X509Certificates
{
/// <summary>Represents an X509 extension.</summary>
// Token: 0x02000295 RID: 661
public class X509Extension : AsnEncodedData
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> class.</summary>
// Token: 0x0600185F RID: 6239 RVA: 0x00052EB0 File Offset: 0x000510B0
protected X509Extension()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> class.</summary>
/// <param name="encodedExtension">The encoded data to be used to create the extension.</param>
/// <param name="critical">true if the extension is critical; otherwise false.</param>
// Token: 0x06001860 RID: 6240 RVA: 0x00052EB8 File Offset: 0x000510B8
public X509Extension(AsnEncodedData encodedExtension, bool critical)
{
if (encodedExtension.Oid == null)
{
throw new ArgumentNullException("encodedExtension.Oid");
}
base.Oid = encodedExtension.Oid;
base.RawData = encodedExtension.RawData;
this._critical = critical;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> class.</summary>
/// <param name="oid">The object identifier used to identify the extension.</param>
/// <param name="rawData">The encoded data used to create the extension.</param>
/// <param name="critical">true if the extension is critical; otherwise false.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="oid" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="oid" /> is an empty string ("").</exception>
// Token: 0x06001861 RID: 6241 RVA: 0x00052F00 File Offset: 0x00051100
public X509Extension(Oid oid, byte[] rawData, bool critical)
{
if (oid == null)
{
throw new ArgumentNullException("oid");
}
base.Oid = oid;
base.RawData = rawData;
this._critical = critical;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Extension" /> class.</summary>
/// <param name="oid">A string representing the object identifier.</param>
/// <param name="rawData">The encoded data used to create the extension.</param>
/// <param name="critical">true if the extension is critical; otherwise false.</param>
// Token: 0x06001862 RID: 6242 RVA: 0x00052F3C File Offset: 0x0005113C
public X509Extension(string oid, byte[] rawData, bool critical)
: base(oid, rawData)
{
this._critical = critical;
}
/// <summary>Gets a Boolean value indicating whether the extension is critical.</summary>
/// <returns>true if the extension is critical; otherwise, false.</returns>
// Token: 0x170007A9 RID: 1961
// (get) Token: 0x06001863 RID: 6243 RVA: 0x00052F50 File Offset: 0x00051150
// (set) Token: 0x06001864 RID: 6244 RVA: 0x00052F58 File Offset: 0x00051158
public bool Critical
{
get
{
return this._critical;
}
set
{
this._critical = value;
}
}
/// <summary>Copies the extension properties of the specified <see cref="T:System.Security.Cryptography.AsnEncodedData" /> object.</summary>
/// <param name="asnEncodedData">The <see cref="T:System.Security.Cryptography.AsnEncodedData" /> to be copied.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="asnEncodedData" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="asnEncodedData" /> does not have a valid X.509 extension.</exception>
// Token: 0x06001865 RID: 6245 RVA: 0x00052F64 File Offset: 0x00051164
public override void CopyFrom(AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
{
throw new ArgumentNullException("encodedData");
}
X509Extension x509Extension = asnEncodedData as X509Extension;
if (x509Extension == null)
{
throw new ArgumentException(global::Locale.GetText("Expected a X509Extension instance."));
}
base.CopyFrom(asnEncodedData);
this._critical = x509Extension.Critical;
}
// Token: 0x06001866 RID: 6246 RVA: 0x00052FB4 File Offset: 0x000511B4
internal string FormatUnkownData(byte[] data)
{
if (data == null || data.Length == 0)
{
return string.Empty;
}
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
stringBuilder.Append(data[i].ToString("X2"));
}
return stringBuilder.ToString();
}
// Token: 0x04001343 RID: 4931
private bool _critical;
}
}