using System; using System.Collections; namespace Org.BouncyCastle.Asn1.X509 { /** * NoticeReference class, used in * CertificatePolicies X509 V3 extensions * (in policy qualifiers). * *
	 *  NoticeReference ::= Sequence {
	 *      organization     DisplayText,
	 *      noticeNumbers    Sequence OF Integer }
	 *
	 * 
* * @see PolicyQualifierInfo * @see PolicyInformation */ public class NoticeReference : Asn1Encodable { internal readonly DisplayText organization; internal readonly Asn1Sequence noticeNumbers; #if !(SILVERLIGHT || PORTABLE) [Obsolete] public NoticeReference( string orgName, ArrayList numbers) : this(orgName, (IList)numbers) { } #endif /** * Creates a new NoticeReference instance. * * @param orgName a string value * @param numbers a ArrayList value */ public NoticeReference( string orgName, IList numbers) { organization = new DisplayText(orgName); object o = numbers[0]; Asn1EncodableVector av = new Asn1EncodableVector(); if (o is int) { foreach (int nm in numbers) { av.Add(new DerInteger(nm)); } } noticeNumbers = new DerSequence(av); } /** * Creates a new NoticeReference instance. * * @param orgName a string value * @param numbers an Asn1Sequence value */ public NoticeReference( string orgName, Asn1Sequence numbers) { organization = new DisplayText(orgName); noticeNumbers = numbers; } /** * Creates a new NoticeReference instance. * * @param displayTextType an int value * @param orgName a string value * @param numbers an Asn1Sequence value */ public NoticeReference( int displayTextType, string orgName, Asn1Sequence numbers) { organization = new DisplayText(displayTextType, orgName); noticeNumbers = numbers; } /** * Creates a new NoticeReference instance. *

Useful for reconstructing a NoticeReference * instance from its encodable/encoded form.

* * @param as an Asn1Sequence value obtained from either * calling @{link ToAsn1Object()} for a NoticeReference * instance or from parsing it from a Der-encoded stream. */ private NoticeReference( Asn1Sequence seq) { if (seq.Count != 2) throw new ArgumentException("Bad sequence size: " + seq.Count, "seq"); organization = DisplayText.GetInstance(seq[0]); noticeNumbers = Asn1Sequence.GetInstance(seq[1]); } public static NoticeReference GetInstance( object obj) { if (obj is NoticeReference) { return (NoticeReference) obj; } if (obj is Asn1Sequence) { return new NoticeReference((Asn1Sequence) obj); } throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj"); } /** * Describe ToAsn1Object method here. * * @return a Asn1Object value */ public override Asn1Object ToAsn1Object() { return new DerSequence(organization, noticeNumbers); } } }