예제 #1
0
 public RoundKeyProvider(byte[] encryptionKey,
                         IKeyExpander expander,
                         IConvertProcessor <List <byte[, ]>, byte[]> processor)
 {
     byte[] expandedKey = expander.ExpandKey(encryptionKey);
     _keys      = processor.ConvertTo(expandedKey);
     KeysNumber = _keys.Count;
 }
예제 #2
0
        public byte[] Decrypt(byte[] key, IDataSource dataSource)
        {
            List <byte[, ]> blocks          = _dataProcessor.ConvertTo(dataSource.GetData());
            AesAlgorithmImp aes             = _algorithmFactory.GetAlgorithm(key);
            List <byte[, ]> decryptedBlocks = aes.Decrypt(blocks);

            return(_padDataProcessor.ConvertBack(decryptedBlocks));
        }