コード例 #1
0
        public void Setup()
        {
            _engine        = new Mock <IBlockCipherEngine>();
            _engineFactory = new Mock <IBlockCipherEngineFactory>();
            _engineFactory
            .Setup(s => s.GetSymmetricCipherPrimitive(It.IsAny <BlockCipherEngines>()))
            .Returns(_engine.Object);
            _algo = new Mock <IModeBlockCipher <SymmetricCipherResult> >();
            _algo
            .Setup(s => s.ProcessPayload(It.IsAny <IModeBlockCipherParameters>()))
            .Returns(() => new SymmetricCipherResult(new BitString(128)));
            _modeFactory = new Mock <IModeBlockCipherFactory>();
            _modeFactory
            .Setup(s => s.GetStandardCipher(_engine.Object, It.IsAny <BlockCipherModesOfOperation>()))
            .Returns(_algo.Object);
            _keyMaker = new Mock <IMonteCarloKeyMakerAes>();
            _keyMaker
            .Setup(s => s.MixKeys(It.IsAny <BitString>(), It.IsAny <BitString>(), It.IsAny <BitString>()))
            .Returns(() => new BitString(128));

            _subject = new MonteCarloAesOfb(_engineFactory.Object, _modeFactory.Object, _keyMaker.Object);
        }