예제 #1
0
            IMacFactory <A> IMacFactoryService.CreateMacFactory <A>(A algorithmDetails)
            {
                HmacEngineProvider macProvider = (HmacEngineProvider)hmacProviders[algorithmDetails.Algorithm];
                int defaultMacSize             = macProvider.MacSize;

                if (key != null)
                {
                    macProvider = new KeyedHmacEngineProvider(key, macProvider);
                }

                if (algorithmDetails.MacSizeInBits != defaultMacSize * 8)
                {
                    macProvider = new TruncatedHmacEngineProvider(macProvider, algorithmDetails.MacSizeInBits);
                }

                return((IMacFactory <A>) new MacFactory <AuthenticationParameters>(algorithmDetails as AuthenticationParameters, macProvider, algorithmDetails.MacSizeInBits / 8));
            }
예제 #2
0
 internal TruncatedHmacEngineProvider(HmacEngineProvider provider, int macSizeInBits) : base(macSizeInBits)
 {
     this.provider      = provider;
     this.macSizeInBits = macSizeInBits;
 }
예제 #3
0
 internal KeyedHmacEngineProvider(ISymmetricKey key, HmacEngineProvider provider) : base(provider.MacSize * 8)
 {
     this.key      = key;
     this.provider = provider;
 }