Ejemplo n.º 1
0
        protected override CipherConfiguration GetCipherConfiguration(CipherTestCase testCase)
        {
            var config = CipherConfigurationFactory.CreateStreamCipherConfiguration(Cipher, testCase.Key.Length * 8);

            config.InitialisationVector = testCase.IV;
            return(config);
        }
Ejemplo n.º 2
0
        protected override CipherConfiguration GetCipherConfiguration(CipherTestCase testCase)
        {
            if (String.IsNullOrEmpty(testCase.Extra))
            {
                throw new InvalidOperationException("Block cipher test cases require block & padding information (extra is null/empty).");
            }

            var extraDataSplit = testCase.Extra.Split(new[] { '/' }, StringSplitOptions.None);

            if (extraDataSplit.Length != 2)
            {
                throw new InvalidOperationException("Block cipher test cases require block & padding information.");
            }

            var config = CipherConfigurationFactory.CreateBlockCipherConfiguration(Cipher,
                                                                                   extraDataSplit[0].ToEnum <BlockCipherMode>(), extraDataSplit[1].ToEnum <BlockCipherPadding>(),
                                                                                   testCase.Key.Length * 8);

            config.InitialisationVector = testCase.IV;
            return(config);
        }
Ejemplo n.º 3
0
 protected abstract CipherConfiguration GetCipherConfiguration(CipherTestCase testCase);