示例#1
0
        /**
         * test for equivalence - note: case is ignored.
         */
        public bool Equivalent(
            X509Name other)
        {
            if (other == null)
            {
                return(false);
            }

            if (other == this)
            {
                return(true);
            }

            int orderingSize = ordering.Count;

            if (orderingSize != other.ordering.Count)
            {
                return(false);
            }

            bool[] indexes = new bool[orderingSize];
            int    start, end, delta;

            if (ordering[0].Equals(other.ordering[0]))               // guess forward
            {
                start = 0;
                end   = orderingSize;
                delta = 1;
            }
            else              // guess reversed - most common problem
            {
                start = orderingSize - 1;
                end   = -1;
                delta = -1;
            }

            for (int i = start; i != end; i += delta)
            {
                bool found = false;
                DerObjectIdentifier oid = (DerObjectIdentifier)ordering[i];
                string value            = (string)values[i];

                for (int j = 0; j < orderingSize; j++)
                {
                    if (indexes[j])
                    {
                        continue;
                    }

                    DerObjectIdentifier oOid = (DerObjectIdentifier)other.ordering[j];

                    if (oid.Equals(oOid))
                    {
                        string oValue = (string)other.values[j];

                        if (equivalentStrings(value, oValue))
                        {
                            indexes[j] = true;
                            found      = true;
                            break;
                        }
                    }
                }

                if (!found)
                {
                    return(false);
                }
            }

            return(true);
        }
 public void SetIssuer(
     X509Name issuer)
 {
     this.issuer = issuer;
 }
 public void SetSubject(
     X509Name subject)
 {
     this.subject = subject;
 }
示例#4
0
 public GeneralName(
     X509Name directoryName)
 {
     this.obj = directoryName;
     this.tag = 4;
 }