Пример #1
0
        public IKdf GetKdfInstance(KdfModes kdfMode, MacModes macMode, CounterLocations counterLocation, int counterLength = 0)
        {
            var mac = GetMacInstance(macMode);

            switch (kdfMode)
            {
            case KdfModes.Counter:
                return(new CounterKdf(mac, counterLocation, counterLength));

            case KdfModes.Feedback:
                return(new FeedbackKdf(mac, counterLocation, counterLength));

            case KdfModes.Pipeline:
                return(new PipelineKdf(mac, counterLocation, counterLength));

            default:
                throw new ArgumentException("KDF Mode not supported");
            }
        }
Пример #2
0
        public void ShouldReturnProperKdfInstance(KdfModes kdfType, Type expectedType)
        {
            var result = _subject.GetKdfInstance(kdfType, MacModes.CMAC_AES128, CounterLocations.None);

            Assert.IsInstanceOf(expectedType, result);
        }