Наследование: System.Collections.IEnumerator
        public int Add(CryptographicAttributeObject attribute)
        {
            if (attribute == null)
            {
                throw new ArgumentNullException("attribute");
            }
            string strA = null;

            if (attribute.Oid != null)
            {
                strA = attribute.Oid.Value;
            }
            for (int i = 0; i < this.m_list.Count; i++)
            {
                CryptographicAttributeObject obj2 = (CryptographicAttributeObject)this.m_list[i];
                if (obj2.Values == attribute.Values)
                {
                    throw new InvalidOperationException(SecurityResources.GetResourceString("InvalidOperation_DuplicateItemNotAllowed"));
                }
                string strB = null;
                if (obj2.Oid != null)
                {
                    strB = obj2.Oid.Value;
                }
                if ((strA == null) && (strB == null))
                {
                    AsnEncodedDataEnumerator enumerator = attribute.Values.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        AsnEncodedData current = enumerator.Current;
                        obj2.Values.Add(current);
                    }
                    return(i);
                }
                if (((strA != null) && (strB != null)) && (string.Compare(strA, strB, StringComparison.OrdinalIgnoreCase) == 0))
                {
                    if (string.Compare(strA, "1.2.840.113549.1.9.5", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Pkcs9_MultipleSigningTimeNotAllowed"));
                    }
                    AsnEncodedDataEnumerator enumerator2 = attribute.Values.GetEnumerator();
                    while (enumerator2.MoveNext())
                    {
                        AsnEncodedData asnEncodedData = enumerator2.Current;
                        obj2.Values.Add(asnEncodedData);
                    }
                    return(i);
                }
            }
            return(this.m_list.Add(attribute));
        }
Пример #2
0
 public CryptographicAttributeObject(System.Security.Cryptography.Oid oid, AsnEncodedDataCollection values)
 {
     this.m_oid = new System.Security.Cryptography.Oid(oid);
     if (values == null)
     {
         this.m_values = new AsnEncodedDataCollection();
     }
     else
     {
         AsnEncodedDataEnumerator enumerator = values.GetEnumerator();
         while (enumerator.MoveNext())
         {
             if (string.Compare(enumerator.Current.Oid.Value, oid.Value, StringComparison.Ordinal) != 0)
             {
                 throw new InvalidOperationException(SecurityResources.GetResourceString("InvalidOperation_DuplicateItemNotAllowed"));
             }
         }
         this.m_values = values;
     }
 }