Пример #1
0
        public static string EncryptString(string val)
        {
            if (val == null)
            {
                return(null);
            }

            var saltBytes = Convert.FromBase64String(Salt);

            var    encryptedBytes = AES256CryptoEngine.EncryptAes(val, Password, saltBytes);
            string encryptedVal   = Convert.ToBase64String(encryptedBytes);

            return(encryptedVal);
        }
Пример #2
0
        public static string DecryptString(string encryptedVal)
        {
            if (encryptedVal == null)
            {
                return(null);
            }

            var saltBytes = Convert.FromBase64String(Salt);

            var encryptedBytes = Convert.FromBase64String(encryptedVal);
            var decryptedVal   = AES256CryptoEngine.DecryptAes(encryptedBytes, Password, saltBytes);

            return(decryptedVal);
        }