Exemplo n.º 1
0
		public SignerLocation(
			DerUtf8String	countryName,
			DerUtf8String	localityName,
			Asn1Sequence	postalAddress)
		{
			if (postalAddress != null && postalAddress.Count > 6)
			{
				throw new ArgumentException("postal address must contain less than 6 strings");
			}

			if (countryName != null)
			{
				this.countryName = DerUtf8String.GetInstance(countryName.ToAsn1Object());
			}

			if (localityName != null)
			{
				this.localityName = DerUtf8String.GetInstance(localityName.ToAsn1Object());
			}

			if (postalAddress != null)
			{
				this.postalAddress = (Asn1Sequence) postalAddress.ToAsn1Object();
			}
		}
Exemplo n.º 2
0
        protected override bool Asn1Equals(
            Asn1Object asn1Object)
        {
            DerUtf8String other = asn1Object as DerUtf8String;

            if (other == null)
            {
                return(false);
            }

            return(this.str.Equals(other.str));
        }
Exemplo n.º 3
0
		public SignerLocation(
			Asn1Sequence seq)
		{
			foreach (Asn1TaggedObject obj in seq)
			{
				switch (obj.TagNo)
				{
					case 0:
						this.countryName = DerUtf8String.GetInstance(obj, true);
						break;
					case 1:
						this.localityName = DerUtf8String.GetInstance(obj, true);
						break;
					case 2:
						bool isExplicit = obj.IsExplicit();	// handle erroneous implicitly tagged sequences
						this.postalAddress = Asn1Sequence.GetInstance(obj, isExplicit);
						if (postalAddress != null && postalAddress.Count > 6)
							throw new ArgumentException("postal address must contain less than 6 strings");
						break;
					default:
						throw new ArgumentException("illegal tag");
				}
			}
		}
Exemplo n.º 4
0
		public object[] GetValues()
        {
            if (this.ValueType == ValueOctets)
            {
                Asn1OctetString[] tmp = new Asn1OctetString[values.Count];

				for (int i = 0; i != tmp.Length; i++)
                {
                    tmp[i] = (Asn1OctetString) values[i];
                }

				return tmp;
            }

			if (this.ValueType == ValueOid)
            {
                DerObjectIdentifier[] tmp = new DerObjectIdentifier[values.Count];

                for (int i = 0; i != tmp.Length; i++)
                {
                    tmp[i] = (DerObjectIdentifier) values[i];
                }

				return tmp;
            }

			{
				DerUtf8String[] tmp = new DerUtf8String[values.Count];

				for (int i = 0; i != tmp.Length; i++)
				{
					tmp[i] = (DerUtf8String) values[i];
				}

				return tmp;
			}
        }