예제 #1
0
        public void ShouldCorrectlyDeriveKey(MacModes mac, CounterLocations ctrLocation, int rLen, int outLen, string kI, string fixedInput, string kO, int breakLocation = 0)
        {
            var keyIn          = new BitString(kI);
            var fixedInputData = new BitString(fixedInput);
            var expectedKey    = new BitString(kO);

            var kdf = _factory.GetKdfInstance(KdfModes.Counter, mac, ctrLocation, rLen);

            var result = kdf.DeriveKey(keyIn, fixedInputData, outLen, breakLocation: breakLocation);

            Assert.IsTrue(result.Success, result.ErrorMessage);
            Assert.AreEqual(expectedKey, result.DerivedKey);
        }
예제 #2
0
        public void ShouldReturnProperKdfInstance(KdfModes kdfType, Type expectedType)
        {
            var result = _subject.GetKdfInstance(kdfType, MacModes.CMAC_AES128, CounterLocations.None);

            Assert.IsInstanceOf(expectedType, result);
        }