AES Verschlüsselung klappt nicht mit Umlauten



Hallo,

ich verschlüssele Dateien mit der Rijndael Methode und wenn ich eine
Datei verschlüssele und wieder entschlüssele sind alle Umlaute in der
Datei weg.

hier meine 2 Methoden:

Public Sub EncryptAES(ByVal sourcePath As String, ByVal destPath
As String)
Dim rd As New System.Security.Cryptography.RijndaelManaged
Dim rijndaelIvLength As Integer = 16
Dim md5 As New
System.Security.Cryptography.MD5CryptoServiceProvider
Dim key() As Byte =
md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(mCryptPassword))
Dim cXMLFile As New System.IO.StreamReader(sourcePath)
md5.Clear()

Dim encdata() As Byte =
Convert.FromBase64String(cXMLFile.ReadToEnd.ToString)
cXMLFile.Close()
Dim ms As New System.IO.MemoryStream(encdata)
Dim iv(15) As Byte

ms.Read(iv, 0, rijndaelIvLength)
rd.IV = iv
rd.Key = key

Dim cs As New System.Security.Cryptography.CryptoStream(ms,
rd.CreateDecryptor,
System.Security.Cryptography.CryptoStreamMode.Read)

Dim data(ms.Length - rijndaelIvLength) As Byte
Dim i As Integer = cs.Read(data, 0, data.Length)
Dim eXMLFile As New System.IO.StreamWriter(destPath)
eXMLFile.Write(System.Text.Encoding.UTF8.GetString(data, 0,
i))
eXMLFile.Close()
cs.Close()
rd.Clear()
End Sub

Public Sub CryptAES(ByVal sourcePath As String, ByVal destPath As
String)
Dim rd As New System.Security.Cryptography.RijndaelManaged()
Dim md5 As New
System.Security.Cryptography.MD5CryptoServiceProvider
Dim key() As Byte =
md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(mCryptPassword))
Dim eXMLFile As New System.IO.StreamReader(sourcePath)

md5.Clear()
rd.Key = key
rd.GenerateIV()

Dim iv() As Byte = rd.IV
Dim ms As New System.IO.MemoryStream

ms.Write(iv, 0, iv.Length)

Dim cs As New System.Security.Cryptography.CryptoStream(ms,
rd.CreateEncryptor,
System.Security.Cryptography.CryptoStreamMode.Write)
Dim data() As Byte =
System.Text.Encoding.UTF8.GetBytes(eXMLFile.ReadToEnd.ToString)
eXMLFile.Close()
cs.Write(data, 0, data.Length)
cs.FlushFinalBlock()

Dim encdata() As Byte = ms.ToArray()
Dim cXMLFile As New System.IO.StreamWriter(destPath)
cXMLFile.Write(Convert.ToBase64String(encdata))
cs.Close()
rd.Clear()
cXMLFile.Close()
End Sub

Hat jemand ne Idee woran dies liegen könnte?

.