c++ - Protecting Content Files -


I want a simple layer of security for my content (resource) files in my application, for example, I have my There are various sound and image files used in the application. I think I can wrap them in the SFX collection (possibly packed with WinRAR), then in my application, start SFX XE with some parameters , Like-syntent but this This is not the best way to do this, so if you can give me some tips, then it will be great.

P.S. I know that this is not impossible (such as one, as it is), but for some reasons it is necessary.

PS

Thank you.

Do not use the SFX archive.

A lot depends on how you use your resources. If you have a lot of library code for which a file name is required, then the files is to keep them on the hard drive for a while. If you can, you want to know whether your voice and media library pointer can pass, you can load files up to yourself, decrypt them, and decrypted buffers in the Media API Can pass.

Use either an archive file format as a real encryption, something like this gives you the ability to store all your data files in a single encrypted archive and expand them into memory. .

Or enter your own copy-file encryption Lots of rolled on home XOR encryption when it is fast

Nearly all file encryption comes down:

  • A "key". A small string.
  • Use the key to start a random number generator.
  • To encrypt the data, encrypt the data with the RNG to the byte to the XO.
  • Later, to decrypt the data:
  • Start with the same key, start RNG
  • which will generate the same flow of bytes < / Li>
  • To decrypt the encrypted data.

The problem is (obviously) that the key in the customer is required, so any fixed hacker can get it. So there is no real point in being very fancy here. Just generate 256 bytes of "random" data and use it to encrypt and decrypt your files such as you load them in memory- or put them in a temporary folder.

If you want to write ttemp files, you may be able to use the temporary folder to clean itself without leaving the encrypted resources on disk.


Comments