Inheritance: Asn1Encodable
Example #1
0
        /**
        * Constructor from a given details.
        * <p/>
        * Parameter <code>professionInfos</code> is mandatory.
        *
        * @param admissionAuthority The admission authority.
        * @param namingAuthority    The naming authority.
        * @param professionInfos    The profession infos.
        */
        public Admissions(
			GeneralName			admissionAuthority,
			NamingAuthority		namingAuthority,
			ProfessionInfo[]	professionInfos)
        {
            this.admissionAuthority = admissionAuthority;
            this.namingAuthority = namingAuthority;
            this.professionInfos = new DerSequence(professionInfos);
        }
Example #2
0
        public ProfessionInfo[] GetProfessionInfos()
        {
            ProfessionInfo[] infos = new ProfessionInfo[professionInfos.Count];
            int count = 0;

            foreach (Asn1Encodable ae in professionInfos)
            {
                infos[count++] = ProfessionInfo.GetInstance(ae);
            }
            return(infos);
        }
Example #3
0
        public ProfessionInfo[] GetProfessionInfos()
        {
            ProfessionInfo[] array = new ProfessionInfo[this.professionInfos.Count];
            int num = 0;

            foreach (Asn1Encodable obj in this.professionInfos)
            {
                array[num++] = ProfessionInfo.GetInstance(obj);
            }
            return(array);
        }
		public override void PerformTest()
		{
			NamingAuthority auth =  new NamingAuthority(new DerObjectIdentifier("1.2.3"), "url", new DirectoryString("fred"));
			DirectoryString[] professionItems = { new DirectoryString("substitution") };
			DerObjectIdentifier[] professionOids = { new DerObjectIdentifier("1.2.3") };
			string registrationNumber = "12345";
			DerOctetString addProfInfo = new DerOctetString(new byte[20]);

			ProfessionInfo info = new ProfessionInfo(auth, professionItems, professionOids, registrationNumber, addProfInfo);

			checkConstruction(info, auth, professionItems, professionOids, registrationNumber, addProfInfo);

			info = new ProfessionInfo(null, professionItems, professionOids, registrationNumber, addProfInfo);

			checkConstruction(info, null, professionItems, professionOids, registrationNumber, addProfInfo);

			info = new ProfessionInfo(auth, professionItems, null, registrationNumber, addProfInfo);

			checkConstruction(info, auth, professionItems, null, registrationNumber, addProfInfo);

			info = new ProfessionInfo(auth, professionItems, professionOids, null, addProfInfo);

			checkConstruction(info, auth, professionItems, professionOids, null, addProfInfo);

			info = new ProfessionInfo(auth, professionItems, professionOids, registrationNumber, null);

			checkConstruction(info, auth, professionItems, professionOids, registrationNumber, null);

			info = ProfessionInfo.GetInstance(null);

			if (info != null)
			{
				Fail("null GetInstance() failed.");
			}

			try
			{
				ProcurationSyntax.GetInstance(new Object());

				Fail("GetInstance() failed to detect bad object.");
			}
			catch (ArgumentException)
			{
				// expected
			}
		}
		private void checkConstruction(
			ProfessionInfo			profInfo,
			NamingAuthority			auth,
			DirectoryString[]		professionItems,
			DerObjectIdentifier[]	professionOids,
			string					registrationNumber,
			DerOctetString			addProfInfo)
		{
			checkValues(profInfo, auth, professionItems, professionOids, registrationNumber, addProfInfo);

			profInfo = ProfessionInfo.GetInstance(profInfo);

			checkValues(profInfo, auth, professionItems, professionOids, registrationNumber, addProfInfo);

			Asn1InputStream aIn = new Asn1InputStream(profInfo.ToAsn1Object().GetEncoded());

			Asn1Sequence seq = (Asn1Sequence) aIn.ReadObject();

			profInfo = ProfessionInfo.GetInstance(seq);

			checkValues(profInfo, auth, professionItems, professionOids, registrationNumber, addProfInfo);
		}
Example #6
0
        public ProfessionInfo[] GetProfessionInfos()
        {
            ProfessionInfo[] array = new ProfessionInfo[professionInfos.Count];
            int num = 0;

            global::System.Collections.IEnumerator enumerator = professionInfos.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    Asn1Encodable obj = (Asn1Encodable)enumerator.get_Current();
                    array[num++] = ProfessionInfo.GetInstance(obj);
                }
                return(array);
            }
            finally
            {
                global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
		private void checkValues(
			ProfessionInfo			profInfo,
			NamingAuthority			auth,
			DirectoryString[]		professionItems,
			DerObjectIdentifier[]	professionOids,
			string					registrationNumber,
			DerOctetString			addProfInfo)
		{
			checkOptionalField("auth", auth, profInfo.NamingAuthority);
			checkMandatoryField("professionItems", professionItems[0], profInfo.GetProfessionItems()[0]);
			if (professionOids != null)
			{
				checkOptionalField("professionOids", professionOids[0], profInfo.GetProfessionOids()[0]);
			}
			checkOptionalField("registrationNumber", registrationNumber, profInfo.RegistrationNumber);
			checkOptionalField("addProfessionInfo", addProfInfo, profInfo.AddProfessionInfo);
		}
Example #8
0
		public ProfessionInfo[] GetProfessionInfos()
		{
			ProfessionInfo[] infos = new ProfessionInfo[professionInfos.Count];
			int count = 0;
			foreach (Asn1Encodable ae in professionInfos)
			{
				infos[count++] = ProfessionInfo.GetInstance(ae);
			}
			return infos;
		}