예제 #1
0
		/**
		* Constructor from given details.
		* <p/>
		* <code>professionItems</code> is mandatory, all other parameters are
		* optional.
		*
		* @param namingAuthority    The naming authority.
		* @param professionItems    Directory strings of the profession.
		* @param professionOids     DERObjectIdentfier objects for the
		*                           profession.
		* @param registrationNumber Registration number.
		* @param addProfessionInfo  Additional infos in encoded form.
		*/
		public ProfessionInfo(
			NamingAuthority			namingAuthority,
			DirectoryString[]		professionItems,
			DerObjectIdentifier[]	professionOids,
			string					registrationNumber,
			Asn1OctetString			addProfessionInfo)
		{
			this.namingAuthority = namingAuthority;
			this.professionItems = new DerSequence(professionItems);
			if (professionOids != null)
			{
				this.professionOids = new DerSequence(professionOids);
			}
			this.registrationNumber = registrationNumber;
			this.addProfessionInfo = addProfessionInfo;
		}
예제 #2
0
		/**
		* @return Returns the professionItems.
		*/
		public virtual DirectoryString[] GetProfessionItems()
		{
			DirectoryString[] result = new DirectoryString[professionItems.Count];

			for (int i = 0; i < professionItems.Count; ++i)
			{
				result[i] = DirectoryString.GetInstance(professionItems[i]);
			}

			return result;
		}
예제 #3
0
		/**
		* Constructor from DirectoryString.
		* <p/>
		* The DirectoryString is of type RestrictionSyntax:
		* <p/>
		* <pre>
		*      RestrictionSyntax ::= DirectoryString (SIZE(1..1024))
		* </pre>
		*
		* @param restriction A IAsn1String.
		*/
		private Restriction(
			DirectoryString restriction)
		{
			this.restriction = restriction;
		}
예제 #4
0
		/**
		* Constructor from a given details.
		*
		* @param restriction The description of the restriction.
		*/
		public Restriction(
			string restriction)
		{
			this.restriction = new DirectoryString(restriction);
		}
예제 #5
0
		/**
		* Constructor from given details.
		* <p/>
		* All parameters can be combined.
		*
		* @param namingAuthorityID   ObjectIdentifier for naming authority.
		* @param namingAuthorityUrl  URL for naming authority.
		* @param namingAuthorityText Textual representation of naming authority.
		*/
		public NamingAuthority(
			DerObjectIdentifier	namingAuthorityID,
			string				namingAuthorityUrl,
			DirectoryString		namingAuthorityText)
		{
			this.namingAuthorityID = namingAuthorityID;
			this.namingAuthorityUrl = namingAuthorityUrl;
			this.namingAuthorityText = namingAuthorityText;
		}
예제 #6
0
		/**
		* Constructor from Asn1Sequence.
		* <p/>
		* <p/>
		* <pre>
		*             NamingAuthority ::= SEQUENCE
		*             {
		*               namingAuthorityID OBJECT IDENTIFIER OPTIONAL,
		*               namingAuthorityUrl IA5String OPTIONAL,
		*               namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
		*             }
		* </pre>
		*
		* @param seq The ASN.1 sequence.
		*/
		private NamingAuthority(
			Asn1Sequence seq)
		{
			if (seq.Count > 3)
				throw new ArgumentException("Bad sequence size: " + seq.Count);

			IEnumerator e = seq.GetEnumerator();

			if (e.MoveNext())
			{
				Asn1Encodable o = (Asn1Encodable) e.Current;
				if (o is DerObjectIdentifier)
				{
					namingAuthorityID = (DerObjectIdentifier) o;
				}
				else if (o is DerIA5String)
				{
					namingAuthorityUrl = DerIA5String.GetInstance(o).GetString();
				}
				else if (o is IAsn1String)
				{
					namingAuthorityText = DirectoryString.GetInstance(o);
				}
				else
				{
					throw new ArgumentException("Bad object encountered: " + o.GetType().Name);
				}
			}

			if (e.MoveNext())
			{
				Asn1Encodable o = (Asn1Encodable) e.Current;
				if (o is DerIA5String)
				{
					namingAuthorityUrl = DerIA5String.GetInstance(o).GetString();
				}
				else if (o is IAsn1String)
				{
					namingAuthorityText = DirectoryString.GetInstance(o);
				}
				else
				{
					throw new ArgumentException("Bad object encountered: " + o.GetType().Name);
				}
			}

			if (e.MoveNext())
			{
				Asn1Encodable o = (Asn1Encodable) e.Current;
				if (o is IAsn1String)
				{
					namingAuthorityText = DirectoryString.GetInstance(o);
				}
				else
				{
					throw new ArgumentException("Bad object encountered: " + o.GetType().Name);
				}
			}
		}
예제 #7
0
		/**
		 * Constructor from a given details.
		 * <p/>
		 * <p/>
		 * Either <code>generalName</code> or <code>certRef</code> MUST be
		 * <code>null</code>.
		 *
		 * @param country            The country code whose laws apply.
		 * @param typeOfSubstitution The type of procuration.
		 * @param thirdPerson        The GeneralName of the person who is represented.
		 */
		public ProcurationSyntax(
			string			country,
			DirectoryString	typeOfSubstitution,
			GeneralName		thirdPerson)
		{
			this.country = country;
			this.typeOfSubstitution = typeOfSubstitution;
			this.thirdPerson = thirdPerson;
			this.certRef = null;
		}
예제 #8
0
		public DirectoryString[] GetGivenName()
		{
			DirectoryString[] items = new DirectoryString[givenName.Count];
			int count = 0;
			foreach (object o in givenName)
			{
				items[count++] = DirectoryString.GetInstance(o);
			}
			return items;
		}
		/**
		* Constructor from a given details.
		*
		* @param information The describtion of the information.
		*/
		public AdditionalInformationSyntax(
			string information)
		{
			this.information = new DirectoryString(information);
		}
예제 #10
0
		/**
		* Constructor from a given details.
		* <p/>
		* <p/>
		* Either <code>generalName</code> or <code>certRef</code> MUST be
		* <code>null</code>.
		*
		* @param country            The country code whose laws apply.
		* @param typeOfSubstitution The type of procuration.
		* @param certRef            Reference to certificate of the person who is represented.
		*/
		public ProcurationSyntax(
			string			country,
			DirectoryString	typeOfSubstitution,
			IssuerSerial	certRef)
		{
			this.country = country;
			this.typeOfSubstitution = typeOfSubstitution;
			this.thirdPerson = null;
			this.certRef = certRef;
		}
		private AdditionalInformationSyntax(
			DirectoryString information)
		{
			this.information = information;
		}
예제 #12
0
		/**
		* Constructor from Asn1Sequence.
		* <p/>
		* The sequence is of type NameOrPseudonym:
		* <p/>
		* <pre>
		*       NameOrPseudonym ::= CHOICE {
		*     	   surAndGivenName SEQUENCE {
		*     	     surName DirectoryString,
		*     	     givenName SEQUENCE OF DirectoryString
		*         },
		*     	   pseudonym DirectoryString
		*       }
		* </pre>
		*
		* @param seq The ASN.1 sequence.
		*/
		private NameOrPseudonym(
			Asn1Sequence seq)
		{
			if (seq.Count != 2)
				throw new ArgumentException("Bad sequence size: " + seq.Count);

			if (!(seq[0] is IAsn1String))
				throw new ArgumentException("Bad object encountered: " + seq[0].GetType().Name);

			surname = DirectoryString.GetInstance(seq[0]);
			givenName = Asn1Sequence.GetInstance(seq[1]);
		}
예제 #13
0
		/**
		* Constructor from DERString.
		* <p/>
		* The sequence is of type NameOrPseudonym:
		* <p/>
		* <pre>
		*       NameOrPseudonym ::= CHOICE {
		*     	   surAndGivenName SEQUENCE {
		*     	     surName DirectoryString,
		*     	     givenName SEQUENCE OF DirectoryString
		*         },
		*     	   pseudonym DirectoryString
		*       }
		* </pre>
		* @param pseudonym pseudonym value to use.
		*/
		public NameOrPseudonym(
			DirectoryString pseudonym)
		{
			this.pseudonym = pseudonym;
		}
예제 #14
0
		/**
		* Constructor from a given details.
		*
		* @param nameOrPseudonym  Name or pseudonym.
		* @param nameDistinguisher Name distinguisher.
		* @param dateOfBirth      Date of birth.
		* @param placeOfBirth     Place of birth.
		* @param gender           Gender.
		* @param postalAddress    Postal Address.
		*/
		public PersonalData(
			NameOrPseudonym		nameOrPseudonym,
			BigInteger			nameDistinguisher,
			DerGeneralizedTime	dateOfBirth,
			DirectoryString		placeOfBirth,
			string				gender,
			DirectoryString		postalAddress)
		{
			this.nameOrPseudonym = nameOrPseudonym;
			this.dateOfBirth = dateOfBirth;
			this.gender = gender;
			this.nameDistinguisher = nameDistinguisher;
			this.postalAddress = postalAddress;
			this.placeOfBirth = placeOfBirth;
		}
예제 #15
0
		/**
		* Constructor from Asn1Sequence.
		* <p/>
		* The sequence is of type ProcurationSyntax:
		* <p/>
		* <pre>
		*               ProcurationSyntax ::= SEQUENCE {
		*                 country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
		*                 typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
		*                 signingFor [3] EXPLICIT SigningFor
		*               }
		* <p/>
		*               SigningFor ::= CHOICE
		*               {
		*                 thirdPerson GeneralName,
		*                 certRef IssuerSerial
		*               }
		* </pre>
		*
		* @param seq The ASN.1 sequence.
		*/
		private ProcurationSyntax(
			Asn1Sequence seq)
		{
			if (seq.Count < 1 || seq.Count > 3)
				throw new ArgumentException("Bad sequence size: " + seq.Count);

			IEnumerator e = seq.GetEnumerator();

			while (e.MoveNext())
			{
				Asn1TaggedObject o = Asn1TaggedObject.GetInstance(e.Current);
				switch (o.TagNo)
				{
					case 1:
						country = DerPrintableString.GetInstance(o, true).GetString();
						break;
					case 2:
						typeOfSubstitution = DirectoryString.GetInstance(o, true);
						break;
					case 3:
						Asn1Object signingFor = o.GetObject();
						if (signingFor is Asn1TaggedObject)
						{
							thirdPerson = GeneralName.GetInstance(signingFor);
						}
						else
						{
							certRef = IssuerSerial.GetInstance(signingFor);
						}
						break;
					default:
						throw new ArgumentException("Bad tag number: " + o.TagNo);
				}
			}
		}
예제 #16
0
		/**
		* Constructor from Asn1Sequence.
		* <p/>
		* The sequence is of type NameOrPseudonym:
		* <p/>
		* <pre>
		*     PersonalData ::= SEQUENCE {
		*       nameOrPseudonym NameOrPseudonym,
		*       nameDistinguisher [0] INTEGER OPTIONAL,
		*       dateOfBirth [1] GeneralizedTime OPTIONAL,
		*       placeOfBirth [2] DirectoryString OPTIONAL,
		*       gender [3] PrintableString OPTIONAL,
		*       postalAddress [4] DirectoryString OPTIONAL
		*       }
		* </pre>
		*
		* @param seq The ASN.1 sequence.
		*/
		private PersonalData(
			Asn1Sequence seq)
		{
			if (seq.Count < 1)
				throw new ArgumentException("Bad sequence size: " + seq.Count);

			IEnumerator e = seq.GetEnumerator();
			e.MoveNext();

			nameOrPseudonym = NameOrPseudonym.GetInstance(e.Current);

			while (e.MoveNext())
			{
				Asn1TaggedObject o = Asn1TaggedObject.GetInstance(e.Current);
				int tag = o.TagNo;
				switch (tag)
				{
					case 0:
						nameDistinguisher = DerInteger.GetInstance(o, false).Value;
						break;
					case 1:
						dateOfBirth = DerGeneralizedTime.GetInstance(o, false);
						break;
					case 2:
						placeOfBirth = DirectoryString.GetInstance(o, true);
						break;
					case 3:
						gender = DerPrintableString.GetInstance(o, false).GetString();
						break;
					case 4:
						postalAddress = DirectoryString.GetInstance(o, true);
						break;
					default:
						throw new ArgumentException("Bad tag number: " + o.TagNo);
				}
			}
		}
예제 #17
0
		/**
		 * Constructor from a given details.
		 *
		 * @param surname   The surname.
		 * @param givenName A sequence of directory strings making up the givenName
		 */
		public NameOrPseudonym(
			DirectoryString	surname,
			Asn1Sequence	givenName)
		{
			this.surname = surname;
			this.givenName = givenName;
		}