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)); }
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)); }
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)); }
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)); }