Esempio n. 1
0
        static void Main(string[] args)
        {
            ConsoleUtils.SizeConsole(80, 60);
            ConsoleUtils.CenterConsole();
            Console.Title        = "CEX Test Suite";
            Console.BufferHeight = 600;
            //GetHXVectors();

            Console.WriteLine("**********************************************");
            Console.WriteLine("* CEX Version 1.5                            *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("* Release:   v1.5.6                          *");
            Console.WriteLine("* Date:      May 28, 2016                    *");
            Console.WriteLine("* Contact:   [email protected]               *");
            Console.WriteLine("**********************************************");
            Console.WriteLine("");

            Console.WriteLine("******TESTING BLOCK CIPHERS******");
            RunTest(new RijndaelTest());
            RunTest(new AesAvsTest());
            RunTest(new AesFipsTest());
            RunTest(new SerpentTest());
            RunTest(new TwofishTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING IO AND CIPHER MODES******");
            RunTest(new CipherModeTest());
            RunTest(new IOTest());
            RunTest(new ParallelModeTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING CIPHER PADDING MODES******");
            RunTest(new PaddingTest());

            Console.WriteLine("******TESTING STREAM CIPHERS******");
            RunTest(new ChaChaTest());
            RunTest(new SalsaTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING MESSAGE DIGESTS******");
            RunTest(new Blake2Test());
            RunTest(new KeccakTest());
            RunTest(new Sha2Test());
            RunTest(new SkeinTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING MESSAGE AUTHENTICATION CODE GENERATORS******");
            RunTest(new HMacTest());
            RunTest(new CMacTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING CRYPTOGRAPHIC STREAM PROCESSORS******");
            RunTest(new CipherStreamTest());
            RunTest(new DigestStreamTest());
            RunTest(new MacStreamTest());
            RunTest(new KeyFactoryTest());
            RunTest(new FactoryStructureTest());

            Console.WriteLine("******TESTING DETERMINISTIC RANDOM BYTE GENERATORS******");
            RunTest(new HkdfTest());
            RunTest(new DgcDrbgTest());
            RunTest(new Pbkdf2Test());
            RunTest(new Pkcs5Test());
            Console.WriteLine("");

            Console.WriteLine("******TESTING PSEUDO RANDOM SEED GENERATORS******");
            RunTest(new ISCRsgTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING PSEUDO RANDOM NUMBER GENERATORS******");
            RunTest(new SecureRandomTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING THE BIGINTEGER IMPLEMENTATION******");
            RunTest(new BigIntegerTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING COMPRESSION ENGINE******");
            RunTest(new CompressionTest());
            Console.WriteLine("");


            Console.WriteLine(">>> RING-LWE IMPLEMENTATION TESTS <<<");
            Console.WriteLine("");
            // encrypt
            Console.WriteLine("******TESTING ENCRYPTION AND DECRYPTION******");
            RunTest(new RLWEEncryptionTest());
            Console.WriteLine("");

            // serialization tests
            Console.WriteLine("******TESTING KEY SERIALIZATION******");
            RunTest(new RLWEKeyTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING PARAMETERS******");
            RunTest(new RLWEParamTest());
            Console.WriteLine("");

            // cca2 encryption
            Console.WriteLine("******TESTING SIGNING FUNCTIONS******");
            RunTest(new RLWESignTest());
            Console.WriteLine("");


            Console.WriteLine(">>> MCELIECE IMPLEMENTATION TESTS <<<");
            Console.WriteLine("");
            // encrypt
            Console.WriteLine("******TESTING ENCRYPTION AND DECRYPTION******");
            RunTest(new McElieceEncryptionTest());
            Console.WriteLine("");

            // serialization tests
            Console.WriteLine("******TESTING KEY SERIALIZATION******");
            RunTest(new McElieceKeyTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING PARAMETERS******");
            RunTest(new McElieceParamTest());
            Console.WriteLine("");

            // cca2 encryption
            Console.WriteLine("******TESTING SIGNING FUNCTIONS******");
            RunTest(new McElieceSignTest());
            Console.WriteLine("");


            // note: the full test suite used by the java tbuktu version is implemented
            // on the NTRU Sharp git entry: https://github.com/Steppenwolfe65/NTRU-Sharp
            Console.WriteLine(">>> NTRU IMPLEMENTATION TESTS <<<");
            Console.WriteLine("");

            Console.WriteLine("******TESTING KEYPAIR IMPLEMENTATION******");
            RunTest(new NtruKeyPairTest());

            Console.WriteLine("******TESTING ENCRYPTION ENGINE******");
            RunTest(new NtruEncryptTest());

            Console.WriteLine("******TESTING KEY SERIALIZATION******");
            RunTest(new NtruKeyTest());

            Console.WriteLine("******TESTING PARAMETER SERIALIZATION******");
            RunTest(new NtruParametersTest());

            Console.WriteLine("******TESTING PASSPHRASE BASED RNG******");
            RunTest(new PBPRngTest());
            Console.WriteLine("");


            Console.WriteLine(">>> RAINBOW IMPLEMENTATION TESTS <<<");
            Console.WriteLine("");

            // serialization tests
            Console.WriteLine("******TESTING KEY SERIALIZATION******");
            RunTest(new RNBWKeyTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING PARAMETERS******");
            RunTest(new RNBWParamTest());
            Console.WriteLine("");

            // sign and verify
            Console.WriteLine("******TESTING SIGNING FUNCTIONS******");
            RunTest(new RNBWSignTest());
            Console.WriteLine("");


            Console.WriteLine(">>> GMSS IMPLEMENTATION TESTS <<<");
            Console.WriteLine("");

            // serialization tests
            Console.WriteLine("******TESTING KEY SERIALIZATION******");
            RunTest(new GMSSKeyTest());
            Console.WriteLine("");

            Console.WriteLine("******TESTING PARAMETERS******");
            RunTest(new GMSSParamTest());
            Console.WriteLine("");

            // sign and verify
            Console.WriteLine("******TESTING SIGNING FUNCTIONS******");
            RunTest(new GMSSSignTest());
            Console.WriteLine("");


            Console.WriteLine("Completed! Press any key to close..");
            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            ConsoleUtils.SizeConsole(80, 60);
            ConsoleUtils.CenterConsole();
            Console.Title = "Rainbow Test Suite";

            // header
            Console.WriteLine("**********************************************");
            Console.WriteLine("* Rainbow Sign in C# (RNBW Sharp)            *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("* Release:   v1.0                            *");
            Console.WriteLine("* Date:      July 04, 2015                   *");
            Console.WriteLine("* Contact:   [email protected]               *");
            Console.WriteLine("**********************************************");
            Console.WriteLine("");
            Console.WriteLine("COMPILE as Any CPU | Release mode, RUN the .exe for real timings");
            Console.WriteLine("");

            if (Debugger.IsAttached)
            {
                Console.WriteLine("You are running in Debug mode! Compiled times will be much faster..");
                Console.WriteLine("");
            }

            Console.WriteLine(CON_TITLE + "Run Validation Tests? Press 'Y' to run, any other key to skip..");
            ConsoleKeyInfo keyInfo = Console.ReadKey();

            Console.WriteLine("");

            if (keyInfo.Key.Equals(ConsoleKey.Y))
            {
                // serialization tests
                Console.WriteLine("******TESTING KEY SERIALIZATION******");
                RunTest(new RNBWKeyTest());
                Console.WriteLine("");/**/

                Console.WriteLine("******TESTING PARAMETERS******");
                RunTest(new RNBWParamTest());
                Console.WriteLine("");/**/

                // sign and verify
                Console.WriteLine("******TESTING SIGNING FUNCTIONS******");
                RunTest(new RNBWSignTest());
                Console.WriteLine("");/**/
            }

            Console.WriteLine("");
            Console.WriteLine(CON_TITLE + "Run Sign and Verify Speed Tests? Press 'Y' to run, all other keys close..");
            keyInfo = Console.ReadKey();
            Console.WriteLine("");

            if (keyInfo.Key.Equals(ConsoleKey.Y))
            {
                Console.WriteLine("");
                Console.WriteLine("******Looping: Sign and Verify Test******");
                Console.WriteLine(string.Format("Testing {0} Full Cycles, throws on all failures..", CYCLE_COUNT));
                Console.WriteLine("");
                try
                {
                    Console.WriteLine("Test cycle using the N33L5 parameter set.");
                    SignSpeed(CYCLE_COUNT);
                    Console.WriteLine("");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Loop test failed! " + ex.Message);
                }
            }

            Console.WriteLine("");
            Console.WriteLine(CON_TITLE + "Run Key Creation Speed Tests? Press 'Y' to run, any other key to skip..");
            keyInfo = Console.ReadKey();
            Console.WriteLine("");

            if (keyInfo.Key.Equals(ConsoleKey.Y))
            {
                KeyGenSpeed();
                Console.WriteLine("Speed Tests Completed!");
                Console.WriteLine("");
                Console.WriteLine(CON_TITLE + "All tests have completed, press any key to close..");
                Console.ReadKey();
            }
            else
            {
                Environment.Exit(0);
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            ConsoleUtils.SizeConsole(80, 60);
            ConsoleUtils.CenterConsole();
            Console.Title = "RLWE Sharp Test Suite";

            // header
            Console.WriteLine("**********************************************");
            Console.WriteLine("* Ring-LWE Encrypt in C# (RLWE Sharp)        *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("* Release:   v1.1                            *");
            Console.WriteLine("* Date:      June 8, 2015                    *");
            Console.WriteLine("* Contact:   [email protected]               *");
            Console.WriteLine("**********************************************");
            Console.WriteLine("");
            Console.WriteLine("COMPILE as Any CPU | Release mode, RUN the .exe for real timings");
            Console.WriteLine("");

            if (Debugger.IsAttached)
            {
                Console.WriteLine("You are running in Debug mode! Compiled times will be much faster..");
                Console.WriteLine("");
            }

            Console.WriteLine(CON_TITLE + "Run Validation Tests? Press 'Y' to run, any other key to skip..");
            ConsoleKeyInfo keyInfo = Console.ReadKey();

            Console.WriteLine("");

            if (keyInfo.Key.Equals(ConsoleKey.Y))
            {
                // encrypt
                Console.WriteLine("******TESTING ENCRYPTION AND DECRYPTION******");
                RunTest(new RLWEEncryptionTest());
                Console.WriteLine("");/**/

                // serialization tests
                Console.WriteLine("******TESTING KEY SERIALIZATION******");
                RunTest(new RLWEKeyTest());
                Console.WriteLine("");/**/

                Console.WriteLine("******TESTING PARAMETERS******");
                RunTest(new RLWEParamTest());
                Console.WriteLine("");/**/

                // cca2 encryption
                Console.WriteLine("******TESTING SIGNING FUNCTIONS******");
                RunTest(new RLWESignTest());
                Console.WriteLine("");/**/
            }

            Console.WriteLine("");
            Console.WriteLine(CON_TITLE + "Run Speed Tests? Press 'Y' to run, any other key to skip..");
            keyInfo = Console.ReadKey();
            Console.WriteLine("");

            if (keyInfo.Key.Equals(ConsoleKey.Y))
            {
                KeyGenSpeed(CYCLE_COUNT);
                EncryptionSpeed(CYCLE_COUNT);
                DecryptionSpeed(CYCLE_COUNT);
                Console.WriteLine("Speed Tests Completed!");
                Console.WriteLine("");
            }

            Console.WriteLine("");
            Console.WriteLine(CON_TITLE + "Run Looping Full-Cycle Tests? Press 'Y' to run, all other keys close..");
            keyInfo = Console.ReadKey();
            Console.WriteLine("");

            if (keyInfo.Key.Equals(ConsoleKey.Y))
            {
                Console.WriteLine("");
                Console.WriteLine("******Looping: Key Generation/Encryption/Decryption and Verify Test******");
                Console.WriteLine(string.Format("Testing {0} Full Cycles, throws on all failures..", CYCLE_COUNT));
                Console.WriteLine("");
                try
                {
                    Console.WriteLine("Test cycle using the RLWEN256Q7681 parameter set.");
                    CycleTest(CYCLE_COUNT, RLWEParamSets.RLWEN256Q7681);
                    Console.WriteLine("");
                    Console.WriteLine("Test cycle using the RLWEN512Q12289 parameter set.");
                    CycleTest(CYCLE_COUNT, RLWEParamSets.RLWEN512Q12289);
                    Console.WriteLine("");
                    Console.WriteLine(CON_TITLE + "All tests have completed, press any key to close..");
                    Console.ReadKey();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Loop test failed! " + ex.Message);
                    Console.WriteLine(CON_TITLE + "Press any key to close");
                    Console.ReadKey();
                }
            }
            else
            {
                Environment.Exit(0);
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            ConsoleUtils.SizeConsole(80, 60);
            ConsoleUtils.CenterConsole();
            Console.Title = "NTRU Sharp Test Suite";

            // header
            Console.WriteLine("**********************************************");
            Console.WriteLine("* NTRU Encrypt in C# (NTRU Sharp)            *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("* Release:   v1.0                            *");
            Console.WriteLine("* Date:      April 05, 2015                  *");
            Console.WriteLine("* Contact:   [email protected]               *");
            Console.WriteLine("**********************************************");
            Console.WriteLine("");
            Console.WriteLine("COMPILE as Any CPU | Release mode, RUN the .exe for real timings");
            Console.WriteLine("");

            if (Debugger.IsAttached)
            {
                Console.WriteLine("You are running in Debug mode! Compiled times will be much faster..");
                Console.WriteLine("");
            }

            Console.WriteLine(CON_TITLE + "Run Validation Tests? Press 'Y' to run, any other key to skip..");
            ConsoleKeyInfo keyInfo = Console.ReadKey();

            Console.WriteLine("");

            if (keyInfo.Key.Equals(ConsoleKey.Y))
            {
                // math
                Console.WriteLine("******TESTING BIGINTEGER MATH FUNCTIONS******");
                RunTest(new BigIntEuclideanTest());
                RunTest(new IntEuclideanTest());
                RunTest(new SchönhageStrassenTest());/**/

                // polynomials
                Console.WriteLine("******TESTING POLYNOMINAL FUNCTIONS******");
                RunTest(new BigDecimalPolynomialTest());
                RunTest(new BigIntPolynomialTest());
                RunTest(new DenseTernaryPolynomialTest());
                RunTest(new IntegerPolynomialTest());
                RunTest(new LongPolynomial2Test());
                RunTest(new LongPolynomial5Test());
                RunTest(new ProductFormPolynomialTest());
                RunTest(new SparseTernaryPolynomialTest());
                Console.WriteLine("");/**/

                // utils
                Console.WriteLine("******TESTING ARRAY ENCODERS******");
                RunTest(new ArrayEncoderTest());
                Console.WriteLine("");/**/

                // encrypt
                Console.WriteLine("******TESTING ENCRYPTION ENGINE******");
                RunTest(new BitStringTest());
                RunTest(new NtruKeyPairTest());
                RunTest(new NtruEncryptTest());
                RunTest(new NtruKeyTest());
                RunTest(new NtruParametersTest());
                RunTest(new IndexGeneratorTest());
                RunTest(new PBPRngTest());
                Console.WriteLine("");/**/

                Console.WriteLine("Validation Tests Completed!");
            }

            Console.WriteLine("");
            Console.WriteLine(CON_TITLE + "Run Speed Tests? Press 'Y' to run, any other key to skip..");
            keyInfo = Console.ReadKey();
            Console.WriteLine("");

            if (keyInfo.Key.Equals(ConsoleKey.Y))
            {
                EncryptionSpeed(CYCLE_COUNT);
                DecryptionSpeed(CYCLE_COUNT);
                KeyGenSpeed(CYCLE_COUNT);
                Console.WriteLine("Speed Tests Completed!");
                Console.WriteLine("");
            }

            Console.WriteLine("");
            Console.WriteLine(CON_TITLE + "Run Looping Full-Cycle Tests? Press 'Y' to run, all other keys close..");
            keyInfo = Console.ReadKey();
            Console.WriteLine("");

            if (keyInfo.Key.Equals(ConsoleKey.Y))
            {
                Console.WriteLine("");
                Console.WriteLine("******Looping: Key Generation/Encryption/Decryption and Verify Test******");
                Console.WriteLine(string.Format("Testing {0} Full Cycles, throws on all failures..", CYCLE_COUNT));
                try
                {
                    CycleTest(CYCLE_COUNT);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("!Loop test failed! " + ex.Message);
                }
                Console.WriteLine("");
                Console.WriteLine(CON_TITLE + "All tests have completed, press any key to close..");
                Console.ReadKey();
            }
            else
            {
                Environment.Exit(0);
            }
        }