Ejemplo n.º 1
0
		public void Test_BOOLEAN()
		{
			ASN1Boolean bl = new ASN1Boolean();

			Console.WriteLine("True and false:");
			BERWriter.DumpHEX(ASN1Boolean.TRUE);
			BERWriter.DumpHEX(ASN1Boolean.FALSE);

			Console.WriteLine("--------------------");

			bl.Assign(true);

			ASN1Boolean_type bl_t = new ASN1Boolean_type();
			ASN1Boolean bl2 = bl_t.CreateInstance(bl.asBER()) as ASN1Boolean;

			BERWriter.DumpHEX(bl2);
			
		}
Ejemplo n.º 2
0
		public void Test_CHOICE()
		{
			test_CHOICE t1 = new test_CHOICE();
			ASN1Boolean bl = new ASN1Boolean(true);

			t1.Assign(bl);
			BERWriter.DumpHEX(t1);
			BERWriter.DumpHEX(bl);

			/* CHOICE is an union type: therefore
			 * DERs of choice and underlying type are
			 * the same.. */
			
			Assert.IsTrue(BERComparer.Equals(t1.asDER(), bl.asDER()));

			BEREncoding ber = bl.asDER();

			test_CHOICE t2 = new test_CHOICE();
			t2.fromBER(ber);

			BERWriter.DumpHEX(t2);
			

			Console.WriteLine("Unfinished business");
		}