Reading/Writing XML from/to a binary file

Started by
3 comments, last by murdock 15 years, 11 months ago
Does anyone know of a class or have links to resources that I can read up on writing XML files to encoded binary files? I am considering saving some of my game information to xml files and need the files to be encrypted where the users can't access it easily.
Advertisement
Binary serialization and encryption are not the same thing.
I guess the easiest solution would be using an encrypted compression scheme for your purposes. I've heard about zlib, check it out.
[ my blog ]
Using XML and encryption at the same time is almost contradictory, but still... it's of course possible :)

If you use tinyxml (or a similar library), which is very advisable for its extreme ease of use, it is trivial to do.
You can ask for the whole xml document as a string at any time. Filter that through whatever encryption algorithm you want (tea, blowfish, AES, whatever) and write the output to a file.
To read the file back, first decode it using the encryption algorithm of your choice and hand the resulting string to the xml library, which will henceforth let you walk through elements and read/write nodes as you want, again.
Well, the terminology may not be exactly correct, but the point is I want to be able to save data to an XML file

<something>
<somethingelse>
</somethingelse>
</something>

and then have that file be where no one can change the data in that file.

my question is what is the best way to do this and where can I get more information about this.
thanks for the info. =)

This topic is closed to new replies.

Advertisement