Exemple #1
0
        public void ShouldGFSboxCorrectlyEncrypt(string expectedText, AlgoArrayResponse algoArrayResponse)
        {
            var param = new ModeBlockCipherParameters(
                BlockCipherDirections.Encrypt,
                algoArrayResponse.IV,
                algoArrayResponse.Key,
                algoArrayResponse.PlainText
                );
            var result = _subject.ProcessPayload(param);

            Assert.IsTrue(result.Success, nameof(result.Success));
            Assert.AreEqual(algoArrayResponse.CipherText, result.Result, expectedText);
        }
Exemple #2
0
        public void ShouldCorrectlyMMTEncrypt128()
        {
            BitString key                = new BitString("6338d754c3f35ce008a8ed612e79f423");
            BitString iv                 = new BitString("353f818e1dbcab65d52115a0fa675faa");
            BitString plainText          = new BitString("6c1533fde353c984ac1f3516b7f315a3cad26feb2e2e0088a90ad02fac5c0a33ccb50b4a7623b994df5716d93b0315132f86ac2c88cb2a082d6ecbc652218943ef4f36e071ffc886affaf4e71f30fe064a58cff97dd748edc2e3d66c0ee846dbbc2adb473aad9e610352f6c6cd427884038f00da751901404faf19a74777e9021b9023053bf5e42dc2a54500ab012d9642756958d85afe08bb1bbd02669719c1");
            BitString expectedCipherText = new BitString("8ad652ff0a1d8bc599dd7176e8be92b1fd6d8febb9abe6e2c942f8e1376ae316aee80abaec45494133aa50f8f0d5c87a8132009d5f05de03b683f27b1755f9f0cbcda5eb762272c025c7eedd2c7442b4723941987eec91b69679cecf27d9b187c9250395cd302f463af0a85fee8da0e074f61a3b55ef39e9ce34afceb324eb7826587117b9d4a9c6372a580d4689e88e0d28ceba8b6e8d543c2788f471111fdf");

            var param = new ModeBlockCipherParameters(
                BlockCipherDirections.Encrypt,
                iv,
                key,
                plainText
                );
            var result = _subject.ProcessPayload(param);

            Assert.AreEqual(expectedCipherText.ToHex(), result.Result.ToHex());
        }
Exemple #3
0
        public void ShouldCorrectlyMMTEncrypt128()
        {
            BitString key                = new BitString("811747ce1fea043a39c342625ec52b1a");
            BitString iv                 = new BitString("e09c8d3be53be9bdd63f99b70f630149");
            BitString plainText          = new BitString("eb0a89a9e21abb266eaf");
            BitString expectedCipherText = new BitString("751c5e72da27a3a616f4");

            var param = new ModeBlockCipherParameters(
                BlockCipherDirections.Encrypt,
                iv,
                key,
                plainText
                );
            var result = _subject.ProcessPayload(param);

            Assert.AreEqual(expectedCipherText, result.Result);
        }
Exemple #4
0
        public void ShouldMMTEncrypt1Byte128BitKey()
        {
            BitString key                = new BitString("2695b44439192d099f0a31b89f24dc0f");
            BitString iv                 = new BitString("5086c0ed84593ed006919af33d4c8902");
            BitString plainText          = new BitString(MsbLsbConversionHelpers.GetBitArrayFromStringOf1sAnd0sReversed("11"));
            BitString expectedCipherText = new BitString(MsbLsbConversionHelpers.GetBitArrayFromStringOf1sAnd0sReversed("11"));

            var param = new ModeBlockCipherParameters(
                BlockCipherDirections.Encrypt,
                iv,
                key,
                plainText
                );
            var result = _subject.ProcessPayload(param);

            Assert.AreEqual(expectedCipherText, result.Result);
        }