Advertisement Jump to content
Sign in to follow this  
mderdem

Encrypted File IO in C++

This topic is 4990 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!