summary refs log tree commit diff
path: root/crypto/test/src/asn1
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2013-12-17 19:16:20 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2013-12-17 19:16:20 +0700
commit53e57085de728ff9f23734f64e1a877ee39a327c (patch)
treef82964c348a778251b6cea473f048c84ae1b153c /crypto/test/src/asn1
parentMore porting from Java TLS, mainly enum replacement (diff)
downloadBouncyCastle.NET-ed25519-53e57085de728ff9f23734f64e1a877ee39a327c.tar.xz
Clean up all the special handling for IDEA stuff, back to a single release assembly.
Diffstat (limited to 'crypto/test/src/asn1')
-rw-r--r--crypto/test/src/asn1/test/MiscTest.cs168
1 files changed, 81 insertions, 87 deletions
diff --git a/crypto/test/src/asn1/test/MiscTest.cs b/crypto/test/src/asn1/test/MiscTest.cs
index 44213c71d..42f5dbd01 100644
--- a/crypto/test/src/asn1/test/MiscTest.cs
+++ b/crypto/test/src/asn1/test/MiscTest.cs
@@ -10,91 +10,85 @@ using Org.BouncyCastle.Utilities.Test;
 
 namespace Org.BouncyCastle.Asn1.Tests
 {
-	[TestFixture]
-	public class MiscTest
-		: ITest
-	{
-		public ITestResult Perform()
-		{
-			byte[] testIv = { 1, 2, 3, 4, 5, 6, 7, 8 };
-
-			Asn1Encodable[] values =
-			{
-				new Cast5CbcParameters(testIv, 128),
-				new NetscapeCertType(NetscapeCertType.Smime),
-				new VerisignCzagExtension(new DerIA5String("hello")),
-#if INCLUDE_IDEA
-				new IdeaCbcPar(testIv),
-#endif
-				new NetscapeRevocationUrl(new DerIA5String("http://test"))
-			};
-
-#if INCLUDE_IDEA
-			byte[] data = Base64.Decode("MA4ECAECAwQFBgcIAgIAgAMCBSAWBWhlbGxvMAoECAECAwQFBgcIFgtodHRwOi8vdGVzdA==");
-#else
-			byte[] data = Base64.Decode("MA4ECAECAwQFBgcIAgIAgAMCBSAWBWhlbGxvFgtodHRwOi8vdGVzdA==");
-#endif
-
-			try
-			{
-				MemoryStream bOut = new MemoryStream();
-				Asn1OutputStream aOut = new Asn1OutputStream(bOut);
-
-				for (int i = 0; i != values.Length; i++)
-				{
-					aOut.WriteObject(values[i]);
-				}
-
-				if (!Arrays.AreEqual(bOut.ToArray(), data))
-				{
-					return new SimpleTestResult(false, Name + ": Failed data check");
-				}
-
-				Asn1InputStream aIn = new Asn1InputStream(bOut.ToArray());
-
-				for (int i = 0; i != values.Length; i++)
-				{
-					Asn1Object o = aIn.ReadObject();
-
-					if (!values[i].Equals(o))
-					{
-						return new SimpleTestResult(false, Name + ": Failed equality test for " + o);
-					}
-
-					if (o.GetHashCode() != values[i].GetHashCode())
-					{
-						return new SimpleTestResult(false, Name + ": Failed hashCode test for " + o);
-					}
-				}
-
-				return new SimpleTestResult(true, Name + ": Okay");
-			}
-			catch (Exception e)
-			{
-				return new SimpleTestResult(false, Name + ": Failed - exception " + e.ToString(), e);
-			}
-		}
-
-		public string Name
-		{
-			get { return "Misc"; }
-		}
-
-		public static void Main(
-			string[] args)
-		{
-			ITest test = new MiscTest();
-			ITestResult result = test.Perform();
-
-			Console.WriteLine(result);
-		}
-
-		[Test]
-		public void TestFunction()
-		{
-			string resultText = Perform().ToString();
-
-			Assert.AreEqual(Name + ": Okay", resultText);
-		}
-	}
+    [TestFixture]
+    public class MiscTest
+        : ITest
+    {
+        public ITestResult Perform()
+        {
+            byte[] testIv = { 1, 2, 3, 4, 5, 6, 7, 8 };
+
+            Asn1Encodable[] values =
+            {
+                new Cast5CbcParameters(testIv, 128),
+                new NetscapeCertType(NetscapeCertType.Smime),
+                new VerisignCzagExtension(new DerIA5String("hello")),
+                new IdeaCbcPar(testIv),
+                new NetscapeRevocationUrl(new DerIA5String("http://test"))
+            };
+
+            byte[] data = Base64.Decode("MA4ECAECAwQFBgcIAgIAgAMCBSAWBWhlbGxvMAoECAECAwQFBgcIFgtodHRwOi8vdGVzdA==");
+
+            try
+            {
+                MemoryStream bOut = new MemoryStream();
+                Asn1OutputStream aOut = new Asn1OutputStream(bOut);
+
+                for (int i = 0; i != values.Length; i++)
+                {
+                    aOut.WriteObject(values[i]);
+                }
+
+                if (!Arrays.AreEqual(bOut.ToArray(), data))
+                {
+                    return new SimpleTestResult(false, Name + ": Failed data check");
+                }
+
+                Asn1InputStream aIn = new Asn1InputStream(bOut.ToArray());
+
+                for (int i = 0; i != values.Length; i++)
+                {
+                    Asn1Object o = aIn.ReadObject();
+
+                    if (!values[i].Equals(o))
+                    {
+                        return new SimpleTestResult(false, Name + ": Failed equality test for " + o);
+                    }
+
+                    if (o.GetHashCode() != values[i].GetHashCode())
+                    {
+                        return new SimpleTestResult(false, Name + ": Failed hashCode test for " + o);
+                    }
+                }
+
+                return new SimpleTestResult(true, Name + ": Okay");
+            }
+            catch (Exception e)
+            {
+                return new SimpleTestResult(false, Name + ": Failed - exception " + e.ToString(), e);
+            }
+        }
+
+        public string Name
+        {
+            get { return "Misc"; }
+        }
+
+        public static void Main(
+            string[] args)
+        {
+            ITest test = new MiscTest();
+            ITestResult result = test.Perform();
+
+            Console.WriteLine(result);
+        }
+
+        [Test]
+        public void TestFunction()
+        {
+            string resultText = Perform().ToString();
+
+            Assert.AreEqual(Name + ": Okay", resultText);
+        }
+    }
 }