/// <summary>
		/// Read values from BER code. Inherited by 
		/// ASN.1's string types.
		/// </summary>
		/// <param name="ulazBER">BER encoded input</param>
		public override void fromBER(BEREncoding ulazBER) 
		{
			ulazBER.Decode();
			
			foreach (BEREncoding objBER in ulazBER.Decompose() ) 
			{
				Byte[] tmpByteArray = objBER.GetContents();
				int len             = tmpByteArray.Length;

				// --------------------------------------------------
				
				Char[] tmpCharArray = new Char[len];
				for(int i=0; i<len; i++) 
				{
					tmpCharArray[i]=Convert.ToChar(tmpByteArray[i]);     
				}														 
 
				this.StringValue += new String(tmpCharArray);
				
				// --------------------------------------------------
			}

			this.CheckString();
		}
		public override void fromBER(BEREncoding ulazBER)
		{
			ulazBER.Decode();

			this.val = (ulazBER.GetContents()[0] != 0x00);
		}
Beispiel #3
0
		public virtual ASN1SetOf SubCreateInstance(ASN1SetOf setOfObject, BEREncoding ulazBER) 
		{
			/// ovo treba baciti u .fromBER od setOfObject-a !!!!!
			ulazBER.Decode();

			foreach(BEREncoding ber in ulazBER.Decompose()) 
			{
				setOfObject.Add(this.type.CreateInstance(ber));
			}
			
			/// Dolazak ovdje predstavlja gresku!
			return setOfObject;
		}
Beispiel #4
0
		/// <summary>
		///  ovo sam zasrao. Ovo mora ici u ASN1SetOf.fromBER()
		/// </summary>
		/// <param name="ulazBER"></param>
		/// <returns></returns>
		public override ASN1Object CreateInstance(BEREncoding ulazBER)
		{
			ASN1SetOf setOfObject = this.Instance() as ASN1SetOf;
			ulazBER.Decode();

			foreach(BEREncoding ber in ulazBER.Decompose()) 
			{
				setOfObject.Add(this.type.CreateInstance(ber));
			}
			
			/// Dolazak ovdje predstavlja gresku!
			return setOfObject;
		}
Beispiel #5
0
		public override void fromBER(BEREncoding ulazBER)
		{

			/// OVO TREBA TESTIRATI!!!

			ulazBER.Decode();

			/* FIXME: Dizi exception ako je 'type==null' */

			foreach(BEREncoding ber in ulazBER.Decompose()) 
			{
				this.Add(this.type.CreateInstance(ber));
			}
				
		}
Beispiel #6
0
		public virtual void fromBER(BEREncoding ulazBER) 
		{
			ulazBER.Decode();
		}
		protected ASN1Choice SubCreateInstance(ASN1Choice choiceObject, BEREncoding ulazBER) 
		{
			ulazBER.Decode();
			int my_tag = BEREncoding.DecodeTagNumber(ulazBER.GetIdOctets());
			
			foreach(ASN1Type tip in choiceObject.Alternatives) 
			{
				if (ASN1Type.MatchTag(my_tag, tip)) 
				{
					choiceObject.Assign(tip.CreateInstance(ulazBER));
					return choiceObject;
				}
			}
			
			/// Dolazak ovdje treba predstavljati
			/// gresku!
			return null;
		}
		public override void fromBER(BEREncoding ulazBER)
		{
			ulazBER.Decode();
			
			int tagNum = BEREncoding.DecodeTagNumber(ulazBER.GetIdOctets());

			DecodeByTagNumber(tagNum, ulazBER);	
		}
		public override void fromBER(BEREncoding ulazBER) 
		{
			

			ulazBER.Decode();
			byte[] tmparray = ulazBER.GetContents();
			ArrayList list = new ArrayList();
			
			/// procitaj Contents i prebaci u values...
			/// 

			list.Add(tmparray[0] / 40);
			list.Add(tmparray[0] % 40);

			/// Dekodiraj onaj nespretni zapis u bazi 128 
			
			int i=1, loop = tmparray.Length;
			
			int val, 
				tmpval, 
				sizea=2; /// To su ona dva obavezna, vec ranije obradjena

			while (i < loop)
			{
			
				val = 0;
				
				while (tmparray[i] > 127)
				{
					tmpval = (int) (tmparray[i] & 0x7f);
					
					val <<= 7;
					val |= tmpval;
					
					i++;
				};

				val <<= 7;
				val |= tmparray[i];				
				
				list.Add(val);
				sizea++;
				i++;
			}

			this.Values = new int[sizea];
			list.CopyTo(0, this.Values, 0, sizea);
		}