223 lines
5.0 KiB
C#
223 lines
5.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
|
|
namespace Mono.Security.X509
|
|
{
|
|
// Token: 0x020000C2 RID: 194
|
|
internal sealed class X509ExtensionCollection : CollectionBase, IEnumerable
|
|
{
|
|
// Token: 0x06000A89 RID: 2697 RVA: 0x0002EE28 File Offset: 0x0002D028
|
|
public X509ExtensionCollection()
|
|
{
|
|
}
|
|
|
|
// Token: 0x06000A8A RID: 2698 RVA: 0x0002EE30 File Offset: 0x0002D030
|
|
public X509ExtensionCollection(ASN1 asn1)
|
|
: this()
|
|
{
|
|
this.readOnly = true;
|
|
if (asn1 == null)
|
|
{
|
|
return;
|
|
}
|
|
if (asn1.Tag != 48)
|
|
{
|
|
throw new Exception("Invalid extensions format");
|
|
}
|
|
for (int i = 0; i < asn1.Count; i++)
|
|
{
|
|
X509Extension x509Extension = new X509Extension(asn1[i]);
|
|
base.InnerList.Add(x509Extension);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000A8B RID: 2699 RVA: 0x0002EE9C File Offset: 0x0002D09C
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return base.InnerList.GetEnumerator();
|
|
}
|
|
|
|
// Token: 0x06000A8C RID: 2700 RVA: 0x0002EEAC File Offset: 0x0002D0AC
|
|
public int Add(X509Extension extension)
|
|
{
|
|
if (extension == null)
|
|
{
|
|
throw new ArgumentNullException("extension");
|
|
}
|
|
if (this.readOnly)
|
|
{
|
|
throw new NotSupportedException("Extensions are read only");
|
|
}
|
|
return base.InnerList.Add(extension);
|
|
}
|
|
|
|
// Token: 0x06000A8D RID: 2701 RVA: 0x0002EEE4 File Offset: 0x0002D0E4
|
|
public void AddRange(X509Extension[] extension)
|
|
{
|
|
if (extension == null)
|
|
{
|
|
throw new ArgumentNullException("extension");
|
|
}
|
|
if (this.readOnly)
|
|
{
|
|
throw new NotSupportedException("Extensions are read only");
|
|
}
|
|
for (int i = 0; i < extension.Length; i++)
|
|
{
|
|
base.InnerList.Add(extension[i]);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000A8E RID: 2702 RVA: 0x0002EF3C File Offset: 0x0002D13C
|
|
public void AddRange(X509ExtensionCollection collection)
|
|
{
|
|
if (collection == null)
|
|
{
|
|
throw new ArgumentNullException("collection");
|
|
}
|
|
if (this.readOnly)
|
|
{
|
|
throw new NotSupportedException("Extensions are read only");
|
|
}
|
|
for (int i = 0; i < collection.InnerList.Count; i++)
|
|
{
|
|
base.InnerList.Add(collection[i]);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000A8F RID: 2703 RVA: 0x0002EFA0 File Offset: 0x0002D1A0
|
|
public bool Contains(X509Extension extension)
|
|
{
|
|
return this.IndexOf(extension) != -1;
|
|
}
|
|
|
|
// Token: 0x06000A90 RID: 2704 RVA: 0x0002EFB0 File Offset: 0x0002D1B0
|
|
public bool Contains(string oid)
|
|
{
|
|
return this.IndexOf(oid) != -1;
|
|
}
|
|
|
|
// Token: 0x06000A91 RID: 2705 RVA: 0x0002EFC0 File Offset: 0x0002D1C0
|
|
public void CopyTo(X509Extension[] extensions, int index)
|
|
{
|
|
if (extensions == null)
|
|
{
|
|
throw new ArgumentNullException("extensions");
|
|
}
|
|
base.InnerList.CopyTo(extensions, index);
|
|
}
|
|
|
|
// Token: 0x06000A92 RID: 2706 RVA: 0x0002EFE0 File Offset: 0x0002D1E0
|
|
public int IndexOf(X509Extension extension)
|
|
{
|
|
if (extension == null)
|
|
{
|
|
throw new ArgumentNullException("extension");
|
|
}
|
|
for (int i = 0; i < base.InnerList.Count; i++)
|
|
{
|
|
X509Extension x509Extension = (X509Extension)base.InnerList[i];
|
|
if (x509Extension.Equals(extension))
|
|
{
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
// Token: 0x06000A93 RID: 2707 RVA: 0x0002F03C File Offset: 0x0002D23C
|
|
public int IndexOf(string oid)
|
|
{
|
|
if (oid == null)
|
|
{
|
|
throw new ArgumentNullException("oid");
|
|
}
|
|
for (int i = 0; i < base.InnerList.Count; i++)
|
|
{
|
|
X509Extension x509Extension = (X509Extension)base.InnerList[i];
|
|
if (x509Extension.Oid == oid)
|
|
{
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
// Token: 0x06000A94 RID: 2708 RVA: 0x0002F09C File Offset: 0x0002D29C
|
|
public void Insert(int index, X509Extension extension)
|
|
{
|
|
if (extension == null)
|
|
{
|
|
throw new ArgumentNullException("extension");
|
|
}
|
|
base.InnerList.Insert(index, extension);
|
|
}
|
|
|
|
// Token: 0x06000A95 RID: 2709 RVA: 0x0002F0BC File Offset: 0x0002D2BC
|
|
public void Remove(X509Extension extension)
|
|
{
|
|
if (extension == null)
|
|
{
|
|
throw new ArgumentNullException("extension");
|
|
}
|
|
base.InnerList.Remove(extension);
|
|
}
|
|
|
|
// Token: 0x06000A96 RID: 2710 RVA: 0x0002F0DC File Offset: 0x0002D2DC
|
|
public void Remove(string oid)
|
|
{
|
|
if (oid == null)
|
|
{
|
|
throw new ArgumentNullException("oid");
|
|
}
|
|
int num = this.IndexOf(oid);
|
|
if (num != -1)
|
|
{
|
|
base.InnerList.RemoveAt(num);
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700015B RID: 347
|
|
public X509Extension this[int index]
|
|
{
|
|
get
|
|
{
|
|
return (X509Extension)base.InnerList[index];
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700015C RID: 348
|
|
public X509Extension this[string oid]
|
|
{
|
|
get
|
|
{
|
|
int num = this.IndexOf(oid);
|
|
if (num == -1)
|
|
{
|
|
return null;
|
|
}
|
|
return (X509Extension)base.InnerList[num];
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000A99 RID: 2713 RVA: 0x0002F15C File Offset: 0x0002D35C
|
|
public byte[] GetBytes()
|
|
{
|
|
if (base.InnerList.Count < 1)
|
|
{
|
|
return null;
|
|
}
|
|
ASN1 asn = new ASN1(48);
|
|
for (int i = 0; i < base.InnerList.Count; i++)
|
|
{
|
|
X509Extension x509Extension = (X509Extension)base.InnerList[i];
|
|
asn.Add(x509Extension.ASN1);
|
|
}
|
|
return asn.GetBytes();
|
|
}
|
|
|
|
// Token: 0x040002BD RID: 701
|
|
private bool readOnly;
|
|
}
|
|
}
|