예제 #1
0
		/**
		 * @param explicitly true if an explicitly tagged object.
		 * @param tagNo the tag number for this object.
		 * @param obj the tagged object.
		 */
		public BerTaggedObject(
			bool			explicitly,
			int				tagNo,
			Asn1Encodable	obj)
			: base(explicitly, tagNo, obj)
		{
		}
예제 #2
0
		/**
         * @param tagNo the tag number for this object.
         * @param obj the tagged object.
         */
        protected Asn1TaggedObject(
            int             tagNo,
            Asn1Encodable   obj)
        {
            this.explicitly = true;
            this.tagNo = tagNo;
            this.obj = obj;
        }
예제 #3
0
		/**
         * @param explicitly true if the object is explicitly tagged.
         * @param tagNo the tag number for this object.
         * @param obj the tagged object.
         */
        protected Asn1TaggedObject(
            bool            explicitly,
            int             tagNo,
            Asn1Encodable   obj)
        {
			// IAsn1Choice marker interface 'insists' on explicit tagging
            this.explicitly = explicitly || (obj is IAsn1Choice);
            this.tagNo = tagNo;
            this.obj = obj;
        }
예제 #4
0
        internal Asn1OctetString(
            Asn1Encodable obj)
        {
            try
            {
				this.str = obj.GetEncoded(Asn1Encodable.Der);
            }
            catch (IOException e)
            {
                throw new ArgumentException("Error processing object : " + e.ToString());
            }
        }
		public DerApplicationSpecific(
			bool			isExplicit,
			int				tag,
			Asn1Encodable	obj)
		{
			byte[] data = obj.GetDerEncoded();

			this.isConstructed = isExplicit;
			this.tag = tag;

			if (isExplicit)
			{
				this.octets = data;
			}
			else
			{
				int lenBytes = GetLengthOfLength(data);
				byte[] tmp = new byte[data.Length - lenBytes];
				Array.Copy(data, lenBytes, tmp, 0, tmp.Length);
				this.octets = tmp;
			}
		}
예제 #6
0
        public BerOctetString(
			Asn1Encodable obj)
			: base(obj.ToAsn1Object())
        {
        }
예제 #7
0
		protected internal void AddObject(
            Asn1Encodable obj)
        {
            seq.Add(obj);
        }
		public override void AddObject(
			Asn1Encodable obj)
		{
			new DerOutputStream(_bOut).WriteObject(obj);
		}
예제 #9
0
		private static void WriteEncodable(MemoryStream ms, Asn1Encodable e)
		{
			if (e != null)
			{
				byte[] bs = e.GetDerEncoded();
				ms.Write(bs, 0, bs.Length);
			}
		}
예제 #10
0
		public virtual void WriteObject(
			Asn1Encodable obj)
		{
			if (obj == null)
			{
				WriteNull();
			}
			else
			{
				obj.ToAsn1Object().Encode(this);
			}
		}
예제 #11
0
		/**
		 * create a sequence containing one object
		 */
		public DerSequence(
			Asn1Encodable obj)
			: base(1)
		{
			AddObject(obj);
		}
예제 #12
0
		public virtual Asn1Encodable[] ToArray()
		{
			Asn1Encodable[] values = new Asn1Encodable[this.Count];
			for (int i = 0; i < this.Count; ++i)
			{
				values[i] = this[i];
			}
			return values;
		}
예제 #13
0
		public abstract void AddObject(Asn1Encodable obj);
		public DerApplicationSpecific(
			int				tag, 
			Asn1Encodable	obj) 
			: this(true, tag, obj)
		{
		}
예제 #15
0
		/**
		 * @param tagNo the tag number for this object.
		 * @param obj the tagged object.
		 */
		public BerTaggedObject(
			int				tagNo,
			Asn1Encodable	obj)
			: base(tagNo, obj)
		{
		}
예제 #16
0
		public DerBitString(
			Asn1Encodable obj)
		{
			this.data = obj.GetDerEncoded();
			//this.padBits = 0;
		}
예제 #17
0
 /**
  * @param obj - a single object that makes up the set.
  */
 public DerSet(
     Asn1Encodable obj)
     : base(1)
 {
     AddObject(obj);
 }