Help with Serialization

Hi Everyone,

I am attempting to write some code that serializes an object and saves it to file. However for secuirty reasons i dont want anyone to be able to open one of these files and read the xml text within, so i wish to pass it through an RC4 class i have written, the RC4 side of things is working nicely, however I am having issues with the encrypted text being saved to file. The only thing i can think of is that due the the actual characters appearing in the encrypted text objects are interpreting them differently.

For example, loading the encrypted text from the file using StreamReader gives you different text than if i were to load it via a FileStream, filling a buffer and using Encoding.GetString()

I am at a loss as to what to do, can anyone offer any suggestions?

Thanks,

Xavier.
LVL 1
locdangAsked:
Who is Participating?
 
Miguel OzConnect With a Mentor Software EngineerCommented:
Save The RC4 string as CDATA.
http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.createcdatasection.aspx

Note: Be careful with the Encoding when reading/writing the file. Unicode (UTF-16) would be the way to go
0
 
locdangAuthor Commented:
Exactly what i needed, thanks a lot!
0
All Courses

From novice to tech pro — start learning today.