Ejemplo n.º 1
0
        /// <summary>
        /// <see cref="INfieldEncryptionUtility.DecryptText"/>
        /// </summary>
        public string DecryptText(string input, string key, string initializationVector)
        {
            if (string.IsNullOrEmpty(input))
            {
                throw new ArgumentNullException("input");
            }

            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException("key");
            }

            if (string.IsNullOrEmpty(initializationVector))
            {
                throw new ArgumentNullException("initializationVector");
            }

            var bytesInput = Convert.FromBase64String(input);
            var bytesKey   = Convert.FromBase64String(key);
            var bytesIv    = Convert.FromBase64String(initializationVector);

            var result = _aesWrapper.Decrypt(bytesInput, bytesKey, bytesIv);

            return(Encoding.UTF8.GetString(result));
        }