예제 #1
0
        public byte[] Encrypt(byte[] key, IDataSource dataSource)
        {
            List <byte[, ]> blocks          = _padDataProcessor.ConvertTo(dataSource.GetData());
            AesAlgorithmImp aes             = _algorithmFactory.GetAlgorithm(key);
            List <byte[, ]> encryptedBlocks = aes.Encrypt(blocks);

            return(_dataProcessor.ConvertBack(encryptedBlocks));
        }
예제 #2
0
        //Determine server that is alive and choose right algorithm
        private Server DetermineServer()
        {
            IAlgorithm algo = CurrentAlgorithm;

            if (algo == null || (SelectedAlgorithm != PreviousAlgorithm))
            {
                algo = CurrentAlgorithm = AlgoFactory.GetAlgorithm(SelectedAlgorithm);
                PreviousAlgorithm = SelectedAlgorithm;
            }
            return(algo.GetServer(Servers.Where((x) => x.Alive == true).ToList()));
        }