public NetFXCryptoService(ICryptoAlgorithmFactory cryptoAlgorithmFactory, CryptographicKey encryptionKey, CryptographicKey validationKey, bool predictableIV = false) { _cryptoAlgorithmFactory = cryptoAlgorithmFactory; _encryptionKey = encryptionKey; _validationKey = validationKey; _predictableIV = predictableIV; }
// This constructor is used only for testing purposes and by the singleton provider // and should not otherwise be called during ASP.NET request processing. internal AspNetCoreCryptoServiceProvider(MachineKeyConfig machineKeyConfig = null, ICryptoAlgorithmFactory cryptoAlgorithmFactory = null, IMasterKeyProvider masterKeyProvider = null, IDataProtectorFactory dataProtectorFactory = null, KeyDerivationFunction keyDerivationFunction = null) { _machineKeyConfig = machineKeyConfig; _cryptoAlgorithmFactory = cryptoAlgorithmFactory; _masterKeyProvider = masterKeyProvider; _dataProtectorFactory = dataProtectorFactory; _keyDerivationFunction = keyDerivationFunction; // The DataProtectorCryptoService is active if specified as such in config _isDataProtectorEnabled = (machineKeyConfig != null && !String.IsNullOrWhiteSpace(machineKeyConfig.DataProtectorType)); }
// This constructor is used only for testing purposes and by the singleton provider // and should not otherwise be called during ASP.NET request processing. internal AspNetCryptoServiceProvider(MachineKeySection machineKeySection = null, ICryptoAlgorithmFactory cryptoAlgorithmFactory = null, IMasterKeyProvider masterKeyProvider = null, IDataProtectorFactory dataProtectorFactory = null, KeyDerivationFunction keyDerivationFunction = null) { _machineKeySection = machineKeySection; _cryptoAlgorithmFactory = cryptoAlgorithmFactory; _masterKeyProvider = masterKeyProvider; _dataProtectorFactory = dataProtectorFactory; _keyDerivationFunction = keyDerivationFunction; // This CryptoServiceProvider is active if specified as such in the <system.web/machineKey> section IsDefaultProvider = (machineKeySection != null && machineKeySection.CompatibilityMode >= MachineKeyCompatibilityMode.Framework45); // The DataProtectorCryptoService is active if specified as such in config _isDataProtectorEnabled = (machineKeySection != null && !String.IsNullOrWhiteSpace(machineKeySection.DataProtectorType)); }
private byte[] _encryptionIV = null;//SORCE_CHANGED added encryption IV to re-ecrypt the data // This constructor is used only for testing purposes and by the singleton provider // and should not otherwise be called during ASP.NET request processing. internal AspNetCryptoServiceProvider(string strValidationKey, string strValAlgo, string strDecryptionKey, string strDecAlgo) { MachineKeySection machineKeySection = new MachineKeySection(); machineKeySection.DecryptionKey = strDecryptionKey; machineKeySection.Decryption = strDecAlgo; machineKeySection.ValidationKey = strValidationKey; machineKeySection.ValidationAlgorithm = strValAlgo; _machineKeySection = machineKeySection; _cryptoAlgorithmFactory = new MachineKeyCryptoAlgorithmFactory(machineKeySection); _masterKeyProvider = new MachineKeyMasterKeyProvider(machineKeySection); _dataProtectorFactory = new MachineKeyDataProtectorFactory(machineKeySection); _keyDerivationFunction = SP800_108.DeriveKey; // This CryptoServiceProvider is active if specified as such in the <system.web/machineKey> section IsDefaultProvider = (machineKeySection != null && machineKeySection.CompatibilityMode >= MachineKeyCompatibilityMode.Framework45); // The DataProtectorCryptoService is active if specified as such in config _isDataProtectorEnabled = (machineKeySection != null && !String.IsNullOrWhiteSpace(machineKeySection.DataProtectorType)); }
private AspNetCryptoServiceProvider(ICryptoAlgorithmFactory cryptoAlgorithmFactory, IMasterKeyProvider masterKeyProvider) { _cryptoAlgorithmFactory = cryptoAlgorithmFactory; _masterKeyProvider = masterKeyProvider; }