XML Encryption on StreamWriter
-
Hi, My application has a class
CUser
which represents a user. The application serializes the user object to XML like this:CUser aUser = new CUser("firstname", "surname", "address");
XmlSerializer serializer = new XmlSerializer(typeof(CUser));
StreamWriter streamWriter = new StreamWriter("user.xml");
serializer.Serialize(streamWriter, aUser);
streamWriter.Close();I've been asked to have the user details encrypted so people can't casually look at the user details. From the above I'd like to encrypt the XML strings as they're written to the file but is there an easy way of doing it? It seems that it would be convenient to have the data encrypted by the
StreamWriter
and then decrypted by aStreamReader
. I'll need a password so how do I manage that within the application? Thanks :)