using System; using System.Collections.Generic; namespace Org.BouncyCastle.Asn1.X509 { public class NameConstraints : Asn1Encodable { private readonly Asn1Sequence m_permitted, m_excluded; public static NameConstraints GetInstance(object obj) { if (obj == null) return null; if (obj is NameConstraints nameConstraints) return nameConstraints; #pragma warning disable CS0618 // Type or member is obsolete return new NameConstraints(Asn1Sequence.GetInstance(obj)); #pragma warning restore CS0618 // Type or member is obsolete } public static NameConstraints GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); } [Obsolete("Use 'GetInstance' instead")] public NameConstraints(Asn1Sequence seq) { foreach (Asn1TaggedObject o in seq) { switch (o.TagNo) { case 0: m_permitted = Asn1Sequence.GetInstance(o, false); break; case 1: m_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