简体   繁体   中英

When i encrypt a file, how can prevent the file's icon from being encrypted?

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 ?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM