using System; using System.Collections.Generic; using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509 { public class NameConstraints : Asn1Encodable { private Asn1Sequence permitted, excluded; public static NameConstraints GetInstance( object obj) { if (obj == null || obj is NameConstraints) { return (NameConstraints) obj; } if (obj is Asn1Sequence) { return new NameConstraints((Asn1Sequence) obj); } throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public NameConstraints( Asn1Sequence seq) { foreach (Asn1TaggedObject o in seq) { switch (o.TagNo) { case 0: permitted = Asn1Sequence.GetInstance(o, false); break; case 1: excluded = Asn1Sequence.GetInstance(o, false); break; } } } /** * Constructor from a given details. * *
permitted and excluded are Vectors of GeneralSubtree objects.
* * @param permitted Permitted subtrees * @param excluded Excluded subtrees */ public NameConstraints( IList