Example #1
0
        public virtual X509Attribute[] GetAttributes(
            string oid)
        {
            Asn1Sequence seq  = cert.ACInfo.Attributes;
            IList        list = Platform.CreateArrayList();

            for (int i = 0; i != seq.Count; i++)
            {
                X509Attribute attr = new X509Attribute((Asn1Encodable)seq[i]);
                if (attr.Oid.Equals(oid))
                {
                    list.Add(attr);
                }
            }

            if (list.Count < 1)
            {
                return(null);
            }

            X509Attribute[] result = new X509Attribute[list.Count];
            for (int i = 0; i < list.Count; ++i)
            {
                result[i] = (X509Attribute)list[i];
            }
            return(result);
        }
Example #2
0
        public virtual X509Attribute[] GetAttributes()
        {
            Asn1Sequence seq = cert.ACInfo.Attributes;

            X509Attribute[] attrs = new X509Attribute[seq.Count];

            for (int i = 0; i != seq.Count; i++)
            {
                attrs[i] = new X509Attribute((Asn1Encodable)seq[i]);
            }

            return(attrs);
        }
 /// <summary>Add an attribute.</summary>
 public void AddAttribute(
     X509Attribute attribute)
 {
     acInfoGen.AddAttribute(AttributeX509.GetInstance(attribute.ToAsn1Object()));
 }