Sign in to follow this  
murdock

Reading/Writing XML from/to a binary file

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this