Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Please suggest a good encryption library for VC++ 2008 [closed]

Tags:

c++

encryption

I am working on a small project and need your help. Here are the details:

  • My project is in VC++ 2008
  • I need to store some critical resource files bundles with my project exe in encrypted form
  • While running the exe, I want to decrypt and use these files on the fly (without storing decrypted files in temp location)
  • The files in question are binary files
  • Project is small and simple
  • Encryption can be simple or moderately secure

I am looking for a encryption library/sdk/toolkit for a simple project, the library should have following requirements

  • It should be small and simple to work with, I dont need lots of features and I am short on development time
  • It should be free to use
  • It should be able to decrypt streams, or decrypt files directly in memory without storing them in any temp location
  • It should have good tutorials/examples/community support, I am short on development time
  • It should support more than one encryption strategies so that I should be able to switch to a better algorithm if needed, without changing library

I am really new to encryption libraries, kindly give your suggestion and I'll do background research on my own.

Edit

Also, can you suggest a good way to hide my key inside an EXE? This is an click-and-run application without any registration or installation.

like image 366
coreSOLO Avatar asked Sep 21 '10 12:09

coreSOLO


1 Answers

Will decrypt key be hardcoded in your program, or supplied from eg. a license file?

If hardcoded, don't bother looking for any type of fancy encryption, all you can hope for is a (very thin!) layer of obfuscation - even a simple XOR scrambling would be no worse than AES.

That said, check out TomCrypt or Crypto++.

EDIT

You could also opt for something really simple such as TEA. Or you could stick with simple XOR encryption and compress your executable; a nice property of single-byte XOR encryption is that the encrypted data will still be compressible :) (caveat emptor: exe compression sometimes triggers false positives in antivirus apps).

The thing to keep in mind is that "if it runs, it can be broken", so focus on diverting casual prying eyes and forget about securing against "really interested people" - it takes a lot of effort and knowledge to do anything remotely successful.

EDIT 2

For "hiding" the decryption key, you can simply store the binary key (what the decryption algorithm itself uses) rather than a textual representation - or you could use a string of gibberish. Doesn't matter much, casual users won't be able to use the key anyway, and you can't hide it from determined people :)

like image 120
snemarch Avatar answered Oct 02 '22 22:10

snemarch