diff options
author | Peter Dettman <peter.dettman@gmail.com> | 2022-06-22 23:29:08 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@gmail.com> | 2022-06-22 23:29:08 +0700 |
commit | 9a6df113d3192c4246832388299a4b45b3668d6c (patch) | |
tree | b2513fd29bb03935220761e1608f3aeb238b81f2 /crypto/test | |
parent | Code cleanup (diff) | |
download | BouncyCastle.NET-ed25519-9a6df113d3192c4246832388299a4b45b3668d6c.tar.xz |
Warnings cleanup
Diffstat (limited to 'crypto/test')
-rw-r--r-- | crypto/test/src/crypto/test/NaccacheSternTest.cs | 70 |
1 files changed, 2 insertions, 68 deletions
diff --git a/crypto/test/src/crypto/test/NaccacheSternTest.cs b/crypto/test/src/crypto/test/NaccacheSternTest.cs index 732f0a02a..3f89768f1 100644 --- a/crypto/test/src/crypto/test/NaccacheSternTest.cs +++ b/crypto/test/src/crypto/test/NaccacheSternTest.cs @@ -30,8 +30,6 @@ namespace Org.BouncyCastle.Crypto.Tests public class NaccacheSternTest : SimpleTest { - private const bool debug = false; - static readonly NaccacheSternEngine cryptEng = new NaccacheSternEngine(); static readonly NaccacheSternEngine decryptEng = new NaccacheSternEngine(); @@ -105,16 +103,7 @@ namespace Org.BouncyCastle.Crypto.Tests // Initialize Engines with KeyPair - if (debug) - { - Console.WriteLine("initializing encryption engine"); - } cryptEng.Init(true, pair.Public); - - if (debug) - { - Console.WriteLine("initializing decryption engine"); - } decryptEng.Init(false, pair.Private); byte[] data = paperTest.ToByteArray(); @@ -132,12 +121,6 @@ namespace Org.BouncyCastle.Crypto.Tests // 768 Bit test // - if (debug) - { - Console.WriteLine(); - Console.WriteLine("768 Bit TEST"); - } - // specify key generation parameters NaccacheSternKeyGenerationParameters genParam = new NaccacheSternKeyGenerationParameters(new SecureRandom(), 768, 8, 30); @@ -157,16 +140,7 @@ namespace Org.BouncyCastle.Crypto.Tests // Initialize Engines with KeyPair - if (debug) - { - Console.WriteLine("initializing " + genParam.Strength + " bit encryption engine"); - } cryptEng.Init(true, pair.Public); - - if (debug) - { - Console.WriteLine("initializing " + genParam.Strength + " bit decryption engine"); - } decryptEng.Init(false, pair.Private); // Basic data input @@ -261,11 +235,6 @@ namespace Org.BouncyCastle.Crypto.Tests { // expected } - - if (debug) - { - Console.WriteLine("All tests successful"); - } } private byte[] enDeCrypt( @@ -276,13 +245,6 @@ namespace Org.BouncyCastle.Crypto.Tests Array.Copy(input, 0, data, 0, data.Length); // Perform encryption like in the paper from Naccache-Stern - if (debug) - { - Console.WriteLine("encrypting data. Data representation\n" - // + "As string:.... " + new string(data) + "\n" - + "As BigInteger: " + new BigInteger(1, data)); - Console.WriteLine("data length is " + data.Length); - } try { @@ -290,42 +252,18 @@ namespace Org.BouncyCastle.Crypto.Tests } catch (InvalidCipherTextException e) { - if (debug) - { - Console.WriteLine("failed - exception " + e + "\n" + e.Message); - } Fail("failed - exception " + e + "\n" + e.Message); } - if (debug) - { - Console.WriteLine("enrypted data representation\n" - // + "As string:.... " + new string(data) + "\n" - + "As BigInteger: " + new BigInteger(1, data)); - Console.WriteLine("data length is " + data.Length); - } - try { data = decryptEng.ProcessData(data); } catch (InvalidCipherTextException e) { - if (debug) - { - Console.WriteLine("failed - exception " + e + "\n" + e.Message); - } Fail("failed - exception " + e + "\n" + e.Message); } - if (debug) - { - Console.WriteLine("decrypted data representation\n" - // + "As string:.... " + new string(data) + "\n" - + "As BigInteger: " + new BigInteger(1, data)); - Console.WriteLine("data length is " + data.Length); - } - return data; } @@ -337,13 +275,9 @@ namespace Org.BouncyCastle.Crypto.Tests Assert.AreEqual(Name + ": Okay", resultText); } - public static void Main( - string[] args) + public static void Main(string[] args) { - ITest test = new NaccacheSternTest(); - ITestResult result = test.Perform(); - - Console.WriteLine(result); + RunTest(new NaccacheSternTest()); } } } |