private string Decrypt(string password, IIronEncryptionAlgorithm algorithm, byte[] data) { if (String.IsNullOrEmpty(password)) { throw new ArgumentNullException("password"); } if (algorithm == null) { throw new ArgumentNullException("algorithm"); } IronEncryptionKey key = GenerateKey(password, algorithm); return(algorithm.Decrypt(key, data)); }
private EncryptionData Encrypt(string password, IIronEncryptionAlgorithm algorithm, string data) { if (String.IsNullOrEmpty(password)) { throw new ArgumentNullException("password"); } if (algorithm == null) { throw new ArgumentNullException("algorithm"); } IronEncryptionKey key = GenerateKey(password, algorithm); return(new EncryptionData { Data = algorithm.Encrypt(key, data), Key = key }); }