Exemple #1
0
        public virtual ITestResult Perform()
        {
            byte[] key1 = new byte[] { (byte)0x01, (byte)0x23, (byte)0x45, (byte)0x67, (byte)0x89, (byte)0xAB, (byte)0xCD, (byte)0xEF };
            byte[] key2 = new byte[] { (byte)0x01, (byte)0x23, (byte)0x45, (byte)0x67, (byte)0x89, (byte)0xAB, (byte)0xCD, (byte)0xEF, (byte)0xee, (byte)0xff };
            byte[] iv   = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };

            ITest       test   = new CTSTester(this, 1, new DesEngine(), new KeyParameter(key1), in1, out1);
            ITestResult result = test.Perform();

            if (!result.IsSuccessful())
            {
                return(result);
            }

            test   = new CTSTester(this, 2, new CbcBlockCipher(new DesEngine()), new ParametersWithIV(new KeyParameter(key1), iv), in1, out2);
            result = test.Perform();

            if (!result.IsSuccessful())
            {
                return(result);
            }

            test   = new CTSTester(this, 3, new CbcBlockCipher(new SkipjackEngine()), new ParametersWithIV(new KeyParameter(key2), iv), in2, out3);
            result = test.Perform();

            if (!result.IsSuccessful())
            {
                return(result);
            }

            return(new SimpleTestResult(true, Name + ": Okay"));
        }
Exemple #2
0
        public virtual ITestResult Perform()
        {
            byte[] key1 = new byte[]{(byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF};
            byte[] key2 = new byte[]{(byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF, (byte) 0xee, (byte) 0xff };
            byte[] iv = new byte[]{1, 2, 3, 4, 5, 6, 7, 8};

            ITest test = new CTSTester(this, 1, new DesEngine(), new KeyParameter(key1), in1, out1);
            ITestResult result = test.Perform();

            if (!result.IsSuccessful())
            {
                return result;
            }

            test = new CTSTester(this, 2, new CbcBlockCipher(new DesEngine()), new ParametersWithIV(new KeyParameter(key1), iv), in1, out2);
            result = test.Perform();

            if (!result.IsSuccessful())
            {
                return result;
            }

            test = new CTSTester(this, 3, new CbcBlockCipher(new SkipjackEngine()), new ParametersWithIV(new KeyParameter(key2), iv), in2, out3);
            result = test.Perform();

            if (!result.IsSuccessful())
            {
                return result;
            }

            return new SimpleTestResult(true, Name + ": Okay");
        }