using System;
using System.Text;
namespace System.Security.Cryptography.X509Certificates
{
/// Represents an X509 extension.
// Token: 0x02000295 RID: 661
public class X509Extension : AsnEncodedData
{
/// Initializes a new instance of the class.
// Token: 0x0600185F RID: 6239 RVA: 0x00052EB0 File Offset: 0x000510B0
protected X509Extension()
{
}
/// Initializes a new instance of the class.
/// The encoded data to be used to create the extension.
/// true if the extension is critical; otherwise false.
// 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;
}
/// Initializes a new instance of the class.
/// The object identifier used to identify the extension.
/// The encoded data used to create the extension.
/// true if the extension is critical; otherwise false.
///
/// is null.
///
/// is an empty string ("").
// 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;
}
/// Initializes a new instance of the class.
/// A string representing the object identifier.
/// The encoded data used to create the extension.
/// true if the extension is critical; otherwise false.
// Token: 0x06001862 RID: 6242 RVA: 0x00052F3C File Offset: 0x0005113C
public X509Extension(string oid, byte[] rawData, bool critical)
: base(oid, rawData)
{
this._critical = critical;
}
/// Gets a Boolean value indicating whether the extension is critical.
/// true if the extension is critical; otherwise, false.
// 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;
}
}
/// Copies the extension properties of the specified object.
/// The to be copied.
///
/// is null.
///
/// does not have a valid X.509 extension.
// 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;
}
}