Click here to Skip to main content
15,891,910 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
how to read the .exe file to encrypt and decrypt in c++ any one help plz

What I have tried:

i look into many sites source codes but i m unable to understand the main concept help me plz
Posted
Updated 2-Aug-17 18:38pm

EXE files aren't normally encrypted - they are binary instructions that the computer can obey.

You can't "decrypt" a normal EXE file to get anything like the original input: the compiler "translates" a higher level language such as C++ into machine code, optimises it, and produces a binary file which cannot easily be converted back to C++ again.

If your particular EXE is encrypted, you would need to ask the original authors how to decrypt it, as we are not involved in that at all as it is in violation of copyright and licence agreements.
 
Share this answer
 
Maybe you can use a PE format packer, here is an overview: Executable compression - Wikipedia[^]
Here is an interesting article about "Packers": [these-packers-are-not-from-wisconsin]
 
Share this answer
 
v2
1. Encrypt your executable ( as mentioned by Richard, see: Encrypting and Decrypting (Windows)[^] ) and save the encrypted file to disk.
2. Embed the encrypted file as a resource in your executable: How to: Import and Export Resources[^]
3. Use FindResource[^] and then LoadResource[^] to access the encrypted file.
4. Decrypt the file data ( as mentioned by Richard above )

Best regards
Espen Harlinn
 
Share this answer
 
You need to use directly a FileStream or:

byte[] buffer = File.ReadAllBytes(@"c:\1.exe");
string base64Encoded = Convert.ToBase64String(buffer);
// TODO: do something with the bas64 encoded string

buffer = Convert.FromBase64String(base64Encoded);
File.WriteAllBytes(@"c:\2.exe", buffer);


---------------Encryption and Decryption-----------
Concept is, we can do encrypt files using AesCryptoServiceProvider(that configure Keys with encoding) and Encoding(That encrypt file based on that key and same way decryption).

Please review the following Link:
File Encryption and Decryption in C#[^]
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900