Exemplo n.º 1
0
            private IBlockCipherBuilder <ParametersWithIV> DoCreateBlockCipherBuilder(bool forEncryption, ParametersWithIV parameters)
            {
                IBufferedCipher cipher = ProviderUtils.CreateBufferedCipher("FipsTripleDes", parameters.Algorithm.Mode, parameters, forEncryption, desEdeEngineProvider);

                cipher.Init(forEncryption, new Internal.Parameters.ParametersWithIV(null, parameters.GetIV()));
                return(new BlockCipherBuilderImpl <ParametersWithIV>(forEncryption, parameters, cipher));
            }
Exemplo n.º 2
0
            private ICipherBuilder <ParametersWithIV> DoCreateCipherBuilder(bool forEncryption, ParametersWithIV parameters)
            {
                IBufferedCipher cipher = ProviderUtils.CreateBufferedCipher("FipsAES", parameters.Algorithm.Mode, parameters, forEncryption, aesEngineProvider);

                cipher.Init(forEncryption, Internal.Parameters.ParametersWithIV.ApplyOptionalIV(null, parameters.GetIV()));
                return(new CipherBuilderImpl <ParametersWithIV>(parameters, cipher));
            }
Exemplo n.º 3
0
            private IBlockCipherBuilder <Parameters> DoCreateBlockCipherBuilder(bool forEncryption, Parameters parameters)
            {
                EngineUsage     engineUsage = forEncryption ? EngineUsage.ENCRYPTION : EngineUsage.DECRYPTION;
                IBufferedCipher cipher      = ProviderUtils.CreateBufferedCipher("FipsTripleDES", parameters.Algorithm.Mode, parameters, desEdeEngineProvider.CreateEngine(engineUsage));

                cipher.Init(forEncryption, null);
                return(new BlockCipherBuilderImpl <Parameters>(forEncryption, parameters, cipher));
            }
        private IBlockCipherBuilder <TParamWithIV> DoCreateBlockCipherBuilder(bool forEncryption, TParamWithIV parameters)
        {
            if (CryptoServicesRegistrar.IsInApprovedOnlyMode())
            {
                throw new CryptoUnapprovedOperationError("attempt to create unapproved block cipher builder in approved only mode");
            }

            IBufferedCipher cipher = ProviderUtils.CreateBufferedCipher(name, parameters.Algorithm.Mode, parameters, forEncryption, engineProvider);

            cipher.Init(forEncryption, ParametersWithIV.ApplyOptionalIV(null, parameters.GetIV()));
            return(new BlockCipherBuilderImpl <TParamWithIV>(forEncryption, parameters, cipher));
        }
Exemplo n.º 5
0
        public IBlockCipherBuilder <TParam> CreateBlockEncryptorBuilder(TParam parameters)
        {
            if (CryptoServicesRegistrar.IsInApprovedOnlyMode())
            {
                throw new CryptoUnapprovedOperationError("Attempt to create unapproved BlockCipherBuilder in approved only mode");
            }

            IBufferedCipher cipher = ProviderUtils.CreateBufferedCipher(name, parameters.Algorithm.Mode, parameters, engineProvider.CreateEngine(EngineUsage.ENCRYPTION));

            cipher.Init(true, null);

            return(new BlockCipherBuilderImpl <TParam>(true, parameters, cipher));
        }