hello guys i have a encryption and decryption code

in project settings i have a stored encrypted data for myslq connection but when i try to decrypt the string it says "BAD DATA"

here is my sample decryption code

i think memory streaming is the problem but how can i resolve it thanks for your help guys

private void Decryption(string Encrypted) {

            byte[] ecrypted = Convert.FromBase64String(Encrypted);
            MemoryStream ms = new MemoryStream();
            CryptoStream decrypt = new CryptoStream(ms, tripledes.CreateDecryptor(),CryptoStreamMode.Write);
            decrypt.Write(ecrypted, 0 ,ecrypted.Length);
            decrypt.FlushFinalBlock();
            MessageBox.Show(Encoding.Unicode.GetString(ms.ToArray()));

        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.