Ejemplo n.º 1
0
        private ICryptoTransform GetDecryptor()
        {
            var rijndael = new RijndaelManaged {
                Key = KeyProvider.GetKey(), IV = KeyProvider.GetIV()
            };

            return(rijndael.CreateDecryptor());
        }
Ejemplo n.º 2
0
        private ICryptoTransform GetEncryptor(string password)
        {
            if (!KeyProvider.CorrectPassword(password))
            {
                throw new Exception("Password isn`t correct");
            }
            var rijndael = new RijndaelManaged()
            {
                Key = KeyProvider.GetKey(), IV = KeyProvider.GetIV()
            };

            return(rijndael.CreateEncryptor());
        }