Esempio n. 1
0
        /// <summary>
        /// Encrypts message using password and stores the result as the cypher
        /// </summary>
        /// <param name="message"></param>
        /// <param name="password"></param>
        public void Encrypt(byte[] message, byte[] password)
        {
            var validated = PreProcess(message, ValidityCheck);

            Cipher = Encryptor.Encrypt(validated, DeriveKey(password), InitializationVector);
        }
Esempio n. 2
0
 /// <summary>
 /// Returns the AES key from a plaintext password
 /// </summary>
 /// <param name="password"></param>
 /// <returns></returns>
 private byte[] DeriveKey(byte[] password) => Encryptor.DeriveKey(password, Salt, Iterations);