AddChild() public method

public AddChild ( PkixPolicyNode child ) : void
child PkixPolicyNode
return void
Beispiel #1
0
        internal static bool ProcessCertD1i(
            int index,
            IList[]                         policyNodes,
            DerObjectIdentifier pOid,
            ISet pq)
        {
            IList policyNodeVec = policyNodes[index - 1];

            for (int j = 0; j < policyNodeVec.Count; j++)
            {
                PkixPolicyNode node             = (PkixPolicyNode)policyNodeVec[j];
                ISet           expectedPolicies = node.ExpectedPolicies;

                if (expectedPolicies.Contains(pOid.Id))
                {
                    ISet childExpectedPolicies = new HashSet();
                    childExpectedPolicies.Add(pOid.Id);

                    PkixPolicyNode child = new PkixPolicyNode(Platform.CreateArrayList(),
                                                              index,
                                                              childExpectedPolicies,
                                                              node,
                                                              pq,
                                                              pOid.Id,
                                                              false);
                    node.AddChild(child);
                    policyNodes[index].Add(child);

                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
        internal static void ProcessCertD1ii(
            int index,
            IList[]                         policyNodes,
            DerObjectIdentifier _poid,
            ISet _pq)
        {
            IList policyNodeVec = policyNodes[index - 1];

            for (int j = 0; j < policyNodeVec.Count; j++)
            {
                PkixPolicyNode _node = (PkixPolicyNode)policyNodeVec[j];

                if (ANY_POLICY.Equals(_node.ValidPolicy))
                {
                    ISet _childExpectedPolicies = new HashSet();
                    _childExpectedPolicies.Add(_poid.Id);

                    PkixPolicyNode _child = new PkixPolicyNode(Platform.CreateArrayList(),
                                                               index,
                                                               _childExpectedPolicies,
                                                               _node,
                                                               _pq,
                                                               _poid.Id,
                                                               false);
                    _node.AddChild(_child);
                    policyNodes[index].Add(_child);
                    return;
                }
            }
        }
        public virtual PkixPolicyNode Copy()
        {
            PkixPolicyNode pkixPolicyNode = new PkixPolicyNode(Platform.CreateArrayList(), mDepth, new HashSet(mExpectedPolicies), null, new HashSet(mPolicyQualifiers), mValidPolicy, mCritical);

            global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)mChildren).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    PkixPolicyNode pkixPolicyNode2 = (PkixPolicyNode)enumerator.get_Current();
                    PkixPolicyNode pkixPolicyNode3 = pkixPolicyNode2.Copy();
                    pkixPolicyNode3.Parent = pkixPolicyNode;
                    pkixPolicyNode.AddChild(pkixPolicyNode3);
                }
                return(pkixPolicyNode);
            }
            finally
            {
                global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
Beispiel #4
0
        public virtual PkixPolicyNode Copy()
        {
            PkixPolicyNode pkixPolicyNode = new PkixPolicyNode(Platform.CreateArrayList(), this.mDepth, new HashSet(this.mExpectedPolicies), null, new HashSet(this.mPolicyQualifiers), this.mValidPolicy, this.mCritical);

            foreach (PkixPolicyNode pkixPolicyNode2 in this.mChildren)
            {
                PkixPolicyNode pkixPolicyNode3 = pkixPolicyNode2.Copy();
                pkixPolicyNode3.Parent = pkixPolicyNode;
                pkixPolicyNode.AddChild(pkixPolicyNode3);
            }
            return(pkixPolicyNode);
        }
Beispiel #5
0
 internal static void ProcessCertD1ii(int index, global::System.Collections.IList[] policyNodes, DerObjectIdentifier _poid, ISet _pq)
 {
     global::System.Collections.IList list = policyNodes[index - 1];
     for (int i = 0; i < ((global::System.Collections.ICollection)list).get_Count(); i++)
     {
         PkixPolicyNode pkixPolicyNode = (PkixPolicyNode)list.get_Item(i);
         if (ANY_POLICY.Equals(pkixPolicyNode.ValidPolicy))
         {
             ISet set = new HashSet();
             set.Add(_poid.Id);
             PkixPolicyNode pkixPolicyNode2 = new PkixPolicyNode(Platform.CreateArrayList(), index, set, pkixPolicyNode, _pq, _poid.Id, critical: false);
             pkixPolicyNode.AddChild(pkixPolicyNode2);
             policyNodes[index].Add((object)pkixPolicyNode2);
             break;
         }
     }
 }
Beispiel #6
0
        internal static void ProcessCertD1ii(int index, IList[] policyNodes, DerObjectIdentifier _poid, ISet _pq)
        {
            IList list = policyNodes[index - 1];

            for (int i = 0; i < list.Count; i++)
            {
                PkixPolicyNode pkixPolicyNode = (PkixPolicyNode)list[i];
                if (PkixCertPathValidatorUtilities.ANY_POLICY.Equals(pkixPolicyNode.ValidPolicy))
                {
                    ISet set = new HashSet();
                    set.Add(_poid.Id);
                    PkixPolicyNode pkixPolicyNode2 = new PkixPolicyNode(Platform.CreateArrayList(), index, set, pkixPolicyNode, _pq, _poid.Id, false);
                    pkixPolicyNode.AddChild(pkixPolicyNode2);
                    policyNodes[index].Add(pkixPolicyNode2);
                    return;
                }
            }
        }
Beispiel #7
0
 internal static bool ProcessCertD1i(int index, global::System.Collections.IList[] policyNodes, DerObjectIdentifier pOid, ISet pq)
 {
     global::System.Collections.IList list = policyNodes[index - 1];
     for (int i = 0; i < ((global::System.Collections.ICollection)list).get_Count(); i++)
     {
         PkixPolicyNode pkixPolicyNode   = (PkixPolicyNode)list.get_Item(i);
         ISet           expectedPolicies = pkixPolicyNode.ExpectedPolicies;
         if (expectedPolicies.Contains(pOid.Id))
         {
             ISet set = new HashSet();
             set.Add(pOid.Id);
             PkixPolicyNode pkixPolicyNode2 = new PkixPolicyNode(Platform.CreateArrayList(), index, set, pkixPolicyNode, pq, pOid.Id, critical: false);
             pkixPolicyNode.AddChild(pkixPolicyNode2);
             policyNodes[index].Add((object)pkixPolicyNode2);
             return(true);
         }
     }
     return(false);
 }
Beispiel #8
0
        public virtual PkixPolicyNode Copy()
        {
            PkixPolicyNode node = new PkixPolicyNode(
                Platform.CreateArrayList(),
                mDepth,
                new HashSet(mExpectedPolicies),
                null,
                new HashSet(mPolicyQualifiers),
                mValidPolicy,
                mCritical);

            foreach (PkixPolicyNode child in mChildren)
            {
                PkixPolicyNode copy = child.Copy();
                copy.Parent = node;
                node.AddChild(copy);
            }

            return(node);
        }
Beispiel #9
0
        internal static bool ProcessCertD1i(int index, IList[] policyNodes, DerObjectIdentifier pOid, ISet pq)
        {
            IList list = policyNodes[index - 1];

            for (int i = 0; i < list.Count; i++)
            {
                PkixPolicyNode pkixPolicyNode   = (PkixPolicyNode)list[i];
                ISet           expectedPolicies = pkixPolicyNode.ExpectedPolicies;
                if (expectedPolicies.Contains(pOid.Id))
                {
                    ISet set = new HashSet();
                    set.Add(pOid.Id);
                    PkixPolicyNode pkixPolicyNode2 = new PkixPolicyNode(Platform.CreateArrayList(), index, set, pkixPolicyNode, pq, pOid.Id, false);
                    pkixPolicyNode.AddChild(pkixPolicyNode2);
                    policyNodes[index].Add(pkixPolicyNode2);
                    return(true);
                }
            }
            return(false);
        }
Beispiel #10
0
        internal static void PrepareNextCertB1(
            int i,
            IList[] policyNodes,
            string id_p,
            IDictionary m_idp,
            X509Certificate cert)
        {
            bool        idp_found = false;
            IEnumerator nodes_i   = policyNodes[i].GetEnumerator();

            while (nodes_i.MoveNext())
            {
                PkixPolicyNode node = (PkixPolicyNode)nodes_i.Current;
                if (node.ValidPolicy.Equals(id_p))
                {
                    idp_found             = true;
                    node.ExpectedPolicies = (ISet)m_idp[id_p];
                    break;
                }
            }

            if (!idp_found)
            {
                nodes_i = policyNodes[i].GetEnumerator();
                while (nodes_i.MoveNext())
                {
                    PkixPolicyNode node = (PkixPolicyNode)nodes_i.Current;
                    if (ANY_POLICY.Equals(node.ValidPolicy))
                    {
                        ISet         pq       = null;
                        Asn1Sequence policies = null;
                        try
                        {
                            policies = DerSequence.GetInstance(GetExtensionValue(cert, X509Extensions.CertificatePolicies));
                        }
                        catch (Exception e)
                        {
                            throw new Exception("Certificate policies cannot be decoded.", e);
                        }

                        IEnumerator enm = policies.GetEnumerator();
                        while (enm.MoveNext())
                        {
                            PolicyInformation pinfo = null;

                            try
                            {
                                pinfo = PolicyInformation.GetInstance(enm.Current);
                            }
                            catch (Exception ex)
                            {
                                throw new Exception("Policy information cannot be decoded.", ex);
                            }

                            if (ANY_POLICY.Equals(pinfo.PolicyIdentifier.Id))
                            {
                                try
                                {
                                    pq = GetQualifierSet(pinfo.PolicyQualifiers);
                                }
                                catch (PkixCertPathValidatorException ex)
                                {
                                    throw new PkixCertPathValidatorException(
                                              "Policy qualifier info set could not be built.", ex);
                                }
                                break;
                            }
                        }
                        bool ci          = false;
                        ISet critExtOids = cert.GetCriticalExtensionOids();
                        if (critExtOids != null)
                        {
                            ci = critExtOids.Contains(X509Extensions.CertificatePolicies.Id);
                        }

                        PkixPolicyNode p_node = (PkixPolicyNode)node.Parent;
                        if (ANY_POLICY.Equals(p_node.ValidPolicy))
                        {
                            PkixPolicyNode c_node = new PkixPolicyNode(
                                Platform.CreateArrayList(), i,
                                (ISet)m_idp[id_p],
                                p_node, pq, id_p, ci);
                            p_node.AddChild(c_node);
                            policyNodes[i].Add(c_node);
                        }
                        break;
                    }
                }
            }
        }
        public virtual PkixPolicyNode Copy()
        {
            PkixPolicyNode node = new PkixPolicyNode(
                new ArrayList(),
                mDepth,
                new HashSet(mExpectedPolicies),
                null,
                new HashSet(mPolicyQualifiers),
                mValidPolicy,
                mCritical);

            foreach (PkixPolicyNode child in mChildren)
            {
                PkixPolicyNode copy = child.Copy();
                copy.Parent = node;
                node.AddChild(copy);
            }

            return node;
        }
Beispiel #12
0
        internal static void PrepareNextCertB1(int i, global::System.Collections.IList[] policyNodes, string id_p, IDictionary m_idp, X509Certificate cert)
        {
            bool flag = false;

            global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)policyNodes[i]).GetEnumerator();
            while (enumerator.MoveNext())
            {
                PkixPolicyNode pkixPolicyNode = (PkixPolicyNode)enumerator.get_Current();
                if (pkixPolicyNode.ValidPolicy.Equals(id_p))
                {
                    flag = true;
                    pkixPolicyNode.ExpectedPolicies = (ISet)m_idp.get_Item((object)id_p);
                    break;
                }
            }
            if (flag)
            {
                return;
            }
            enumerator = ((global::System.Collections.IEnumerable)policyNodes[i]).GetEnumerator();
            while (enumerator.MoveNext())
            {
                PkixPolicyNode pkixPolicyNode2 = (PkixPolicyNode)enumerator.get_Current();
                if (!ANY_POLICY.Equals(pkixPolicyNode2.ValidPolicy))
                {
                    continue;
                }
                ISet         policyQualifiers = null;
                Asn1Sequence asn1Sequence     = null;
                try
                {
                    asn1Sequence = Asn1Sequence.GetInstance(GetExtensionValue(cert, X509Extensions.CertificatePolicies));
                }
                catch (global::System.Exception ex)
                {
                    throw new global::System.Exception("Certificate policies cannot be decoded.", ex);
                }
                global::System.Collections.IEnumerator enumerator2 = asn1Sequence.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    PolicyInformation policyInformation = null;
                    try
                    {
                        policyInformation = PolicyInformation.GetInstance(enumerator2.get_Current());
                    }
                    catch (global::System.Exception ex2)
                    {
                        throw new global::System.Exception("Policy information cannot be decoded.", ex2);
                    }
                    if (ANY_POLICY.Equals(policyInformation.PolicyIdentifier.Id))
                    {
                        try
                        {
                            policyQualifiers = GetQualifierSet(policyInformation.PolicyQualifiers);
                        }
                        catch (PkixCertPathValidatorException cause)
                        {
                            throw new PkixCertPathValidatorException("Policy qualifier info set could not be built.", cause);
                        }
                        break;
                    }
                }
                bool critical = false;
                ISet criticalExtensionOids = cert.GetCriticalExtensionOids();
                if (criticalExtensionOids != null)
                {
                    critical = criticalExtensionOids.Contains(X509Extensions.CertificatePolicies.Id);
                }
                PkixPolicyNode parent = pkixPolicyNode2.Parent;
                if (ANY_POLICY.Equals(parent.ValidPolicy))
                {
                    PkixPolicyNode pkixPolicyNode3 = new PkixPolicyNode(Platform.CreateArrayList(), i, (ISet)m_idp.get_Item((object)id_p), parent, policyQualifiers, id_p, critical);
                    parent.AddChild(pkixPolicyNode3);
                    policyNodes[i].Add((object)pkixPolicyNode3);
                }
                break;
            }
        }
Beispiel #13
0
        internal static void PrepareNextCertB1(int i, IList[] policyNodes, string id_p, IDictionary m_idp, X509Certificate cert)
        {
            bool        flag       = false;
            IEnumerator enumerator = policyNodes[i].GetEnumerator();

            while (enumerator.MoveNext())
            {
                PkixPolicyNode pkixPolicyNode = (PkixPolicyNode)enumerator.Current;
                if (pkixPolicyNode.ValidPolicy.Equals(id_p))
                {
                    flag = true;
                    pkixPolicyNode.ExpectedPolicies = (ISet)m_idp[id_p];
                    break;
                }
            }
            if (!flag)
            {
                enumerator = policyNodes[i].GetEnumerator();
                while (enumerator.MoveNext())
                {
                    PkixPolicyNode pkixPolicyNode2 = (PkixPolicyNode)enumerator.Current;
                    if (PkixCertPathValidatorUtilities.ANY_POLICY.Equals(pkixPolicyNode2.ValidPolicy))
                    {
                        ISet         policyQualifiers = null;
                        Asn1Sequence asn1Sequence     = null;
                        try
                        {
                            asn1Sequence = Asn1Sequence.GetInstance(PkixCertPathValidatorUtilities.GetExtensionValue(cert, X509Extensions.CertificatePolicies));
                        }
                        catch (Exception innerException)
                        {
                            throw new Exception("Certificate policies cannot be decoded.", innerException);
                        }
                        IEnumerator enumerator2 = asn1Sequence.GetEnumerator();
                        while (enumerator2.MoveNext())
                        {
                            PolicyInformation policyInformation = null;
                            try
                            {
                                policyInformation = PolicyInformation.GetInstance(enumerator2.Current);
                            }
                            catch (Exception innerException2)
                            {
                                throw new Exception("Policy information cannot be decoded.", innerException2);
                            }
                            if (PkixCertPathValidatorUtilities.ANY_POLICY.Equals(policyInformation.PolicyIdentifier.Id))
                            {
                                try
                                {
                                    policyQualifiers = PkixCertPathValidatorUtilities.GetQualifierSet(policyInformation.PolicyQualifiers);
                                    break;
                                }
                                catch (PkixCertPathValidatorException cause)
                                {
                                    throw new PkixCertPathValidatorException("Policy qualifier info set could not be built.", cause);
                                }
                            }
                        }
                        bool critical = false;
                        ISet criticalExtensionOids = cert.GetCriticalExtensionOids();
                        if (criticalExtensionOids != null)
                        {
                            critical = criticalExtensionOids.Contains(X509Extensions.CertificatePolicies.Id);
                        }
                        PkixPolicyNode parent = pkixPolicyNode2.Parent;
                        if (PkixCertPathValidatorUtilities.ANY_POLICY.Equals(parent.ValidPolicy))
                        {
                            PkixPolicyNode pkixPolicyNode3 = new PkixPolicyNode(Platform.CreateArrayList(), i, (ISet)m_idp[id_p], parent, policyQualifiers, id_p, critical);
                            parent.AddChild(pkixPolicyNode3);
                            policyNodes[i].Add(pkixPolicyNode3);
                            return;
                        }
                        break;
                    }
                }
            }
        }