XML Serialization and Encryption
-
I have objects that I want to save to a file (XML format, generated by serialization). I also want the data to be encrypted. Should I encrypt the objects before they are serialized/saved to XML, or should I serialize and then encrypt the whole XML document? Which method is easier/more efficient, and why? On a side note, where can I find a good, straight-forward tutorial for encryption using .NET (specifically, C#)? Thanks in advance.
-
I have objects that I want to save to a file (XML format, generated by serialization). I also want the data to be encrypted. Should I encrypt the objects before they are serialized/saved to XML, or should I serialize and then encrypt the whole XML document? Which method is easier/more efficient, and why? On a side note, where can I find a good, straight-forward tutorial for encryption using .NET (specifically, C#)? Thanks in advance.
Traditionally its better to encrypt something that has little redundancy, i.e. with little repetition. This is often why text files are compressed before they are encrypted, then decrypted and decompressed at the other end. It's difficult to suggest something without a little more info about what it is you're trying to encrypt. Do you mean encrypt individual members of a type, like a string field containing a name or something? For ease its probably better to just encrypt the XML document, if you want to you could always find some .NET code to compress the document beforehand and then encrypt that. -- Paul "I need the secure packaging of Jockeys. My boys need a house!" - Kramer, in "The Chinese Woman" episode of Seinfeld MS Messenger: paul@oobaloo.co.uk Sonork: 100.22446