public string DecryptAES(string encryptedString, string Key) { //First write to memory MemoryStream mmsStream = new MemoryStream(); StreamWriter srwTemp = new StreamWriter(mmsStream); //sBuffer is my encodedtext. srwTemp.Write(encryptedString); srwTemp.Flush(); mmsStream.Position = 0; MemoryStream outstream = new MemoryStream(); //CallingUUDecode Codecs.UUDecode(mmsStream, outstream); //Extract the bytes of each of the values byte[] input = outstream.ToArray(); byte[] key = Convert.FromBase64String(Key); string decryptedText = null; using (RijndaelManaged algorithm = new RijndaelManaged()) { // initialize settings to match those used by CF algorithm.Mode = CipherMode.ECB; algorithm.Padding = PaddingMode.PKCS7; algorithm.BlockSize = 128; algorithm.KeySize = 128; algorithm.Key = key; ICryptoTransform decryptor = algorithm.CreateDecryptor(); using (MemoryStream msDecrypt = new MemoryStream(input)) { using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)) { using (StreamReader srDecrypt = new StreamReader(csDecrypt)) { decryptedText = srDecrypt.ReadToEnd(); } } } } return(decryptedText); }