using System; using System.Collections; using Mono.Security; using Mono.Security.X509; namespace System.Security.Cryptography.X509Certificates { /// Represents a collection of objects. This class cannot be inherited. // Token: 0x02000296 RID: 662 public sealed class X509ExtensionCollection : ICollection, IEnumerable { /// Initializes a new instance of the class. // Token: 0x06001867 RID: 6247 RVA: 0x00053010 File Offset: 0x00051210 public X509ExtensionCollection() { this._list = new ArrayList(); } // Token: 0x06001868 RID: 6248 RVA: 0x00053024 File Offset: 0x00051224 internal X509ExtensionCollection(X509Certificate cert) { this._list = new ArrayList(cert.Extensions.Count); if (cert.Extensions.Count == 0) { return; } object[] array = new object[2]; foreach (object obj in cert.Extensions) { X509Extension x509Extension = (X509Extension)obj; bool critical = x509Extension.Critical; string oid = x509Extension.Oid; byte[] array2 = null; ASN1 value = x509Extension.Value; if (value.Tag == 4 && value.Count > 0) { array2 = value[0].GetBytes(); } array[0] = new AsnEncodedData(oid, array2); array[1] = critical; X509Extension x509Extension2 = (X509Extension)CryptoConfig.CreateFromName(oid, array); if (x509Extension2 == null) { x509Extension2 = new X509Extension(oid, array2, critical); } this._list.Add(x509Extension2); } } /// Copies the collection into an array starting at the specified index. /// An array of objects. /// The location in the array at which copying starts. /// /// is a zero-length string or contains an invalid value. /// /// is null. /// /// specifies a value that is not in the range of the array. // Token: 0x06001869 RID: 6249 RVA: 0x0005314C File Offset: 0x0005134C void ICollection.CopyTo(Array array, int index) { if (array == null) { throw new ArgumentNullException("array"); } if (index < 0) { throw new ArgumentOutOfRangeException("negative index"); } if (index >= array.Length) { throw new ArgumentOutOfRangeException("index >= array.Length"); } this._list.CopyTo(array, index); } /// Returns an enumerator that can iterate through an object. /// An object to use to iterate through the object. // Token: 0x0600186A RID: 6250 RVA: 0x000531A0 File Offset: 0x000513A0 IEnumerator IEnumerable.GetEnumerator() { return new X509ExtensionEnumerator(this._list); } /// Gets the number of objects in a object. /// An integer representing the number of objects in the object. // Token: 0x170007AA RID: 1962 // (get) Token: 0x0600186B RID: 6251 RVA: 0x000531B0 File Offset: 0x000513B0 public int Count { get { return this._list.Count; } } /// Gets a value indicating whether the collection is guaranteed to be thread safe. /// true if the collection is thread safe; otherwise, false. // Token: 0x170007AB RID: 1963 // (get) Token: 0x0600186C RID: 6252 RVA: 0x000531C0 File Offset: 0x000513C0 public bool IsSynchronized { get { return this._list.IsSynchronized; } } /// Gets an object that you can use to synchronize access to the object. /// An object that you can use to synchronize access to the object. // Token: 0x170007AC RID: 1964 // (get) Token: 0x0600186D RID: 6253 RVA: 0x000531D0 File Offset: 0x000513D0 public object SyncRoot { get { return this; } } /// Gets the object at the specified index. /// An object. /// The location of the object to retrieve. /// /// is less than zero. /// /// is equal to or greater than the length of the array. // Token: 0x170007AD RID: 1965 public X509Extension this[int index] { get { if (index < 0) { throw new InvalidOperationException("index"); } return (X509Extension)this._list[index]; } } /// Gets the first object whose value or friendly name is specified by an object identifier (OID). /// An object. /// The object identifier (OID) of the extension to retrieve. // Token: 0x170007AE RID: 1966 public X509Extension this[string oid] { get { if (oid == null) { throw new ArgumentNullException("oid"); } if (this._list.Count == 0 || oid.Length == 0) { return null; } foreach (object obj in this._list) { X509Extension x509Extension = (X509Extension)obj; if (x509Extension.Oid.Value.Equals(oid)) { return x509Extension; } } return null; } } /// Adds an object to an object. /// The index at which the parameter was added. /// An object to add to the object. /// The value of the parameter is null. // Token: 0x06001870 RID: 6256 RVA: 0x000532B4 File Offset: 0x000514B4 public int Add(X509Extension extension) { if (extension == null) { throw new ArgumentNullException("extension"); } return this._list.Add(extension); } /// Copies a collection into an array starting at the specified index. /// An array of objects. /// The location in the array at which copying starts. /// /// is a zero-length string or contains an invalid value. /// /// is null. /// /// specifies a value that is not in the range of the array. // Token: 0x06001871 RID: 6257 RVA: 0x000532D4 File Offset: 0x000514D4 public void CopyTo(X509Extension[] array, int index) { if (array == null) { throw new ArgumentNullException("array"); } if (index < 0) { throw new ArgumentOutOfRangeException("negative index"); } if (index >= array.Length) { throw new ArgumentOutOfRangeException("index >= array.Length"); } this._list.CopyTo(array, index); } /// Returns an enumerator that can iterate through an object. /// An object to use to iterate through the object. // Token: 0x06001872 RID: 6258 RVA: 0x00053328 File Offset: 0x00051528 public X509ExtensionEnumerator GetEnumerator() { return new X509ExtensionEnumerator(this._list); } // Token: 0x04001344 RID: 4932 private ArrayList _list; } }