internal static PkixPolicyNode PrepareNextCertB2(int i, IList[] policyNodes, string id_p, PkixPolicyNode validPolicyTree)
    {
        int num = 0;

        foreach (PkixPolicyNode item in Platform.CreateArrayList(policyNodes[i]))
        {
            if (item.ValidPolicy.Equals(id_p))
            {
                PkixPolicyNode parent = item.Parent;
                parent.RemoveChild(item);
                policyNodes[i].RemoveAt(num);
                for (int num2 = i - 1; num2 >= 0; num2--)
                {
                    IList list = policyNodes[num2];
                    for (int j = 0; j < list.Count; j++)
                    {
                        PkixPolicyNode pkixPolicyNode2 = (PkixPolicyNode)list[j];
                        if (!pkixPolicyNode2.HasChildren)
                        {
                            validPolicyTree = RemovePolicyNode(validPolicyTree, policyNodes, pkixPolicyNode2);
                            if (validPolicyTree == null)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            else
            {
                num++;
            }
        }
        return(validPolicyTree);
    }
    internal static PkixPolicyNode RemovePolicyNode(PkixPolicyNode validPolicyTree, IList[] policyNodes, PkixPolicyNode _node)
    {
        PkixPolicyNode parent = _node.Parent;

        if (validPolicyTree == null)
        {
            return(null);
        }
        if (parent == null)
        {
            for (int i = 0; i < policyNodes.Length; i++)
            {
                policyNodes[i] = Platform.CreateArrayList();
            }
            return(null);
        }
        parent.RemoveChild(_node);
        RemovePolicyNodeRecurse(policyNodes, _node);
        return(validPolicyTree);
    }