Пример #1
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
		{
			DerUtf8String other = asn1Object as DerUtf8String;

			if (other == null)
				return false;

			return this.str.Equals(other.str);
        }
Пример #2
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
        {
			DerEnumerated other = asn1Object as DerEnumerated;

			if (other == null)
				return false;

			return Arrays.AreEqual(this.bytes, other.bytes);
        }
Пример #3
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
		{
			DerUnknownTag other = asn1Object as DerUnknownTag;

			if (other == null)
				return false;

			return this.isConstructed == other.isConstructed
				&& this.tag == other.tag
				&& Arrays.AreEqual(this.data, other.data);
        }
Пример #4
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
        {
			Asn1TaggedObject other = asn1Object as Asn1TaggedObject;

			if (other == null)
				return false;

			return this.tagNo == other.tagNo
//				&& this.empty == other.empty
				&& this.explicitly == other.explicitly   // TODO Should this be part of equality?
				&& Platform.Equals(GetObject(), other.GetObject());
		}
Пример #5
0
		public DerExternal(
			Asn1EncodableVector vector)
		{
			int offset = 0;
			Asn1Object enc = GetObjFromVector(vector, offset);
			if (enc is DerObjectIdentifier)
			{
				directReference = (DerObjectIdentifier)enc;
				offset++;
				enc = GetObjFromVector(vector, offset);
			}
			if (enc is DerInteger)
			{
				indirectReference = (DerInteger) enc;
				offset++;
				enc = GetObjFromVector(vector, offset);
			}
			if (!(enc is DerTaggedObject))
			{
				dataValueDescriptor = (Asn1Object) enc;
				offset++;
				enc = GetObjFromVector(vector, offset);
			}
			if (!(enc is DerTaggedObject))
			{
				throw new InvalidOperationException(
					"No tagged object found in vector. Structure doesn't seem to be of type External");
			}

			if (vector.Count != offset + 1)
				throw new ArgumentException("input vector too large", "vector");

			if (!(enc is DerTaggedObject))
				throw new ArgumentException("No tagged object found in vector. Structure doesn't seem to be of type External", "vector");

			DerTaggedObject obj = (DerTaggedObject)enc;

			// Use property accessor to include check on value
			Encoding = obj.TagNo;

			if (encoding < 0 || encoding > 2)
				throw new InvalidOperationException("invalid encoding value");

			externalContent = obj.GetObject();
		}
Пример #6
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
		{
			if (this == asn1Object)
				return true;

			DerExternal other = asn1Object as DerExternal;

			if (other == null)
				return false;

			return Platform.Equals(directReference, other.directReference)
				&& Platform.Equals(indirectReference, other.indirectReference)
				&& Platform.Equals(dataValueDescriptor, other.dataValueDescriptor)
				&& externalContent.Equals(other.externalContent);
		}
Пример #7
0
		protected abstract bool Asn1Equals(Asn1Object asn1Object);
Пример #8
0
		public virtual void WriteObject(
			Asn1Object obj)
		{
			if (obj == null)
			{
				WriteNull();
			}
			else
			{
				obj.Encode(this);
			}
		}
Пример #9
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
        {
			DerBoolean other = asn1Object as DerBoolean;

			if (other == null)
				return false;

			return IsTrue == other.IsTrue;
        }
Пример #10
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
		{
			DerOctetString other = asn1Object as DerOctetString;

			if (other == null)
				return false;

			return Arrays.AreEqual(GetOctets(), other.GetOctets());
		}
Пример #11
0
 /**
  * Creates a new instance of DerExternal.
  * See X.690 for more informations about the meaning of these parameters
  * @param directReference The direct reference or <code>null</code> if not set.
  * @param indirectReference The indirect reference or <code>null</code> if not set.
  * @param dataValueDescriptor The data value descriptor or <code>null</code> if not set.
  * @param encoding The encoding to be used for the external data
  * @param externalData The external data
  */
 public DerExternal(DerObjectIdentifier directReference, DerInteger indirectReference, Asn1Object dataValueDescriptor, int encoding, Asn1Object externalData)
 {
     DirectReference     = directReference;
     IndirectReference   = indirectReference;
     DataValueDescriptor = dataValueDescriptor;
     Encoding            = encoding;
     ExternalContent     = externalData.ToAsn1Object();
 }
Пример #12
0
        public BerOctetString(
			Asn1Object obj)
			: base(obj)
        {
        }
Пример #13
0
		/**
		* Creates a new instance of DerExternal.
		* See X.690 for more informations about the meaning of these parameters
		* @param directReference The direct reference or <code>null</code> if not set.
		* @param indirectReference The indirect reference or <code>null</code> if not set.
		* @param dataValueDescriptor The data value descriptor or <code>null</code> if not set.
		* @param encoding The encoding to be used for the external data
		* @param externalData The external data
		*/
		public DerExternal(DerObjectIdentifier directReference, DerInteger indirectReference, Asn1Object dataValueDescriptor, int encoding, Asn1Object externalData)
		{
			DirectReference = directReference;
			IndirectReference = indirectReference;
			DataValueDescriptor = dataValueDescriptor;
			Encoding = encoding;
			ExternalContent = externalData.ToAsn1Object();
		}
Пример #14
0
		internal bool CallAsn1Equals(Asn1Object obj)
		{
			return Asn1Equals(obj);
		}
Пример #15
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
		{
			return asn1Object is DerNull;
		}
Пример #16
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
		{
			DerUniversalString other = asn1Object as DerUniversalString;

			if (other == null)
				return false;

//			return this.GetString().Equals(other.GetString());
			return Arrays.AreEqual(this.str, other.str);
        }
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
        {
			DerApplicationSpecific other = asn1Object as DerApplicationSpecific;

			if (other == null)
				return false;

			return this.isConstructed == other.isConstructed
				&& this.tag == other.tag
				&& Arrays.AreEqual(this.octets, other.octets);
        }
Пример #18
0
		/**
		* Creates a new instance of DerExternal
		* See X.690 for more informations about the meaning of these parameters
		* @param directReference The direct reference or <code>null</code> if not set.
		* @param indirectReference The indirect reference or <code>null</code> if not set.
		* @param dataValueDescriptor The data value descriptor or <code>null</code> if not set.
		* @param externalData The external data in its encoded form.
		*/
		public DerExternal(DerObjectIdentifier directReference, DerInteger indirectReference, Asn1Object dataValueDescriptor, DerTaggedObject externalData)
			: this(directReference, indirectReference, dataValueDescriptor, externalData.TagNo, externalData.ToAsn1Object())
		{
		}
Пример #19
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
		{
			DerBitString other = asn1Object as DerBitString;

			if (other == null)
				return false;

			return this.padBits == other.padBits
				&& Arrays.AreEqual(this.data, other.data);
		}
Пример #20
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
		{
			Asn1Sequence other = asn1Object as Asn1Sequence;

			if (other == null)
                return false;

			if (Count != other.Count)
                return false;

			IEnumerator s1 = GetEnumerator();
            IEnumerator s2 = other.GetEnumerator();

			while (s1.MoveNext() && s2.MoveNext())
			{
				Asn1Object o1 = GetCurrent(s1).ToAsn1Object();
				Asn1Object o2 = GetCurrent(s2).ToAsn1Object();

				if (!o1.Equals(o2))
					return false;
			}

			return true;
        }
Пример #21
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
		{
			DerObjectIdentifier other = asn1Object as DerObjectIdentifier;

			if (other == null)
				return false;

			return this.identifier.Equals(other.identifier);
        }
Пример #22
0
		protected override bool Asn1Equals(
			Asn1Object asn1Object)
        {
			DerGeneralizedTime other = asn1Object as DerGeneralizedTime;

			if (other == null)
				return false;

			return this.time.Equals(other.time);
        }
Пример #23
0
 /**
  * Creates a new instance of DerExternal
  * See X.690 for more informations about the meaning of these parameters
  * @param directReference The direct reference or <code>null</code> if not set.
  * @param indirectReference The indirect reference or <code>null</code> if not set.
  * @param dataValueDescriptor The data value descriptor or <code>null</code> if not set.
  * @param externalData The external data in its encoded form.
  */
 public DerExternal(DerObjectIdentifier directReference, DerInteger indirectReference, Asn1Object dataValueDescriptor, DerTaggedObject externalData)
     : this(directReference, indirectReference, dataValueDescriptor, externalData.TagNo, externalData.ToAsn1Object())
 {
 }