1

I am writing a simple software protection tool which works by reading the input file as array of bytes, then encrypts this array of bytes using AES, and store the result into another file which is responsible to decrypt itself.

Till now, the software works like a charm, but there's only one problem, is that when i encrypt a file, the output file ( protected file ) lose it's icon, i think because all the file's resources are encrypted. And therefore the icon is no longer available.

I tried to use a class which is written in my previous question to change the file's icon after encrypting it, but it seems that is doesn't work with the encrypted file even it works correctly with any other exe file.

So in order to make this works, i decided to first change the input file's icon, then ENCRYPT THE FILE WHITHOUT ENCRYPTING IT'S ICON

This should work, if i can only strip the icon's resources from being encrypted.

How can prevent the input file's icon from being encrypted ?

Community
  • 1
  • 1
Rafik Bari
  • 4,867
  • 18
  • 73
  • 123
  • so you want to extract the icon of the exe out so that you can encrypt the exe and then set the icon? Why all the extra work for an icon? – AdamV Mar 21 '12 at 19:53
  • @AdamD Even if i extract the file's icon, i cannot set the icon again after encrypting the file. I recommend you to see my previous question to see why. The only solution that should work is to Set a file icon before encryption, then encrypt the file and strip icon from being crypted ( preserve icon ). Or preseve directly the file's icon ( in the case the file already has an icon ) – Rafik Bari Mar 21 '12 at 19:58
  • Can't you encrypt the exe, then append it to an existing .exe with the same icon? That .exe might even do the decryption (after giving it the key from outside, of course). – Maarten Bodewes Mar 21 '12 at 20:24
  • @owlstead Thankyou very much. You solution works like a chram ! Please repost it as an answer & i'll accept it. Thankyou – Rafik Bari Mar 21 '12 at 20:28

2 Answers2

2

You may encrypt the .exe and append the encrypted data to an existing .exe with the same icon. That icon may also perform the decryption. You should supply the key from outside though.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
1

Extract the icon from the input file

Store it in the memory

Encrypt the file

Add your icon (as a resource) and the encrypted file to a new exe.

Flot2011
  • 4,601
  • 3
  • 44
  • 61
  • Hmm, this might be the same idea as I just commented, maybe use "Add your icon and the encrypted file to a new .exe"? Try and use full sentences too, please. – Maarten Bodewes Mar 21 '12 at 20:26
  • I didn't see your comment while writing my answer. Please repost your comment as an answer, the OP already mentioned that he will accept it. – Flot2011 Mar 21 '12 at 20:41