Example #1
0
        /// <summary>
        /// Decrypts the data.
        /// </summary>
        /// <param name="encryptedData">The encrypted data.</param>
        /// <param name="password">The password.</param>
        /// <returns>A <see cref="string/> containing the decrypted data.</returns>
        private static string DecryptData(byte[] encryptedData, string password)
        {
            string normalText;

            using (var encryptedStream = new MemoryStream(encryptedData))
            {
                using (var normalStream = new MemoryStream())
                {
                    Crypt.Decrypt(password, encryptedStream, normalStream);
                    var normalBytes = normalStream.ToArray();
                    normalText = Encoding.UTF8.GetString(normalBytes);
                }
            }
            return(normalText);
        }