Jump to content
  • Advertisement
Sign in to follow this  
mderdem

Encrypted File IO in C++

This topic is 4836 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I have several file loaders which are based on ifstream and ofstream. I would like to be encrypt and decrytp while load and saving the files. I consider writing a derived class from ifstream to do the encryption in the ::read() method but it is not a virtual method. Does anybody has some experience on this subject ? Thanks, Devrim

Share this post


Link to post
Share on other sites
Advertisement
If you want to change the behavior of a stream, you have to re-implement its "buffer". Streambuf that is :) It can be quite complicated to understand, but it's feasible. Google for streambuf, you should get some results.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
an elegant way of doing this would be the use of stream modifiers. like the stuff you use to set the representation of floats for instance for a stream. i could imagine to create decrypt/encrypt modifiers and use them like stream <

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
damn.. i mean
stream <

Share this post


Link to post
Share on other sites
If you want an even more obscure method, you could use a(n)? (en|de)crypting codecvt facet in your locale >;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!