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