Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Encrypt an EXE

Posted on 2004-10-31
14
Medium Priority
?
389 Views
Last Modified: 2013-11-13
I want to encrypt an exe file. There should be a launcher application that checks for a password or something and decrypts and executes the encrypted exe file. The decrypted file should not be saved to disk, other wise the user can copy the decrypted exe while the program is running. Im using an algorithm for encryption, but my problem is I dont know how to execute the decrypted file without saving it to a file. How do i do this ?
0
Comment
Question by:kurian2z5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
  • +1
14 Comments
 
LVL 20

Expert Comment

by:hes
ID: 12456486
Why ?
0
 
LVL 1

Expert Comment

by:Yrag1
ID: 12456877
Exactly WHY?
no one will be able to read your code, if you want to limit access to the prog just password protect the program, so a user has to enter a password to run it.

Gary
0
 
LVL 8

Expert Comment

by:List244
ID: 12457557
The only way this is going to work is if you save the
decrypted file to disk. If you dont want to do that,
then have a launcher program.

Working Example:

Launcher:
   Command1_Click()
     Shell "Project1.exe Mypass"
   End Sub
 
Program:
   Form_Load()
     If Command$ <> "Mypass" Then End
   End Sub

That will create a program that can not be opened without
a password. Also will save a lot of time with getting rid of
the need for encryption.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Author Comment

by:kurian2z5
ID: 12461813
I need to encrypt a third party exe so i cant use your method List244.

I want to implement a harddisk lock for a third party exe using a launcher program. The launcher should decrypt and execute the third party exe if the user provides the correct key.

Actually i made a program for which i lost the source and so i cant implement the protection in the program itself. But this method can be extended to any other program using the launcher.

This is how SafeDisc 1 CD protection works isnt it ?

The program's exe is encrypted and saved as a .icd file.

The launcher progam verifies the Disc and decrypts the .icd file and executes it WITHOUT saving it to disc. If you check the running processes it shows the progam.icd file and not an .exe file.
0
 
LVL 8

Accepted Solution

by:
List244 earned 150 total points
ID: 12463443
Well, the problem is, what YOU are asking for, is not
Encryption/Decryption. You are asking for an emulator.
You would need your program to decrypt, then run
the other program. If you simply want to Encrypt/Decrypt
that is easy. Best way to do what you want, is to actually
encrypt the EXE. Then when you decrypt, decrypt it to a
new location, under a new name. On unload, you delete
the new created program, and then the security continues.
However it is not full proof security, most basic users can
not break it. Your file would be named like RandName.ROU,
and saved to a folder such as System, where it would not
be noticed, then its deleted.

And here is an example of encryption:

http://www.freevbcode.com/ShowCode.asp?ID=4398
0
 
LVL 4

Author Comment

by:kurian2z5
ID: 12470974
I just need to make a harddisk lock for a program without modifying the exe of the program.

The user should not be able to run the program on another computer, unless he obtains the original exe of the program.

If i save the decrypted exe to a file, it can be copied while the program is running, if you view the running processes to see where the file is running from.

How do i go about it ?
0
 
LVL 20

Expert Comment

by:hes
ID: 12472018
Why not just use activelock

http://www.activelock.com/
0
 
LVL 4

Author Comment

by:kurian2z5
ID: 12473125
I need to protect a third party exe, so i cant modify its source and hence i cant use activelock.

List244
I would have used your method but if i decrypt the exe to a new location or in some cases even rename it the program amy not work because it wont find its files etc..
0
 
LVL 4

Author Comment

by:kurian2z5
ID: 12473147
Im going to use ur method List, (except for programs that dont run with exe renamed) Ill save the exe under a different name in the same folder, probably readme.txt or something, so most of them should work.

I need to know how to detect if a program is running (by its exe name - not caption) and wait for it to close before deleting the exe.
0
 
LVL 4

Author Comment

by:kurian2z5
ID: 12826815
i was waiting for list244 to reply. id give him 30 points for a near complete answer.
0
 
LVL 8

Expert Comment

by:List244
ID: 12827105
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=33724&lngWId=1

I would suggest something like this. If you can find the running processes you can
check if the certain exe is running.
0
 
LVL 4

Author Comment

by:kurian2z5
ID: 12827749
this lists all the processes. if i keep refreshing the list and checking if the program's name has been removed, then i presume it has closed. but this is rather inefficiend and CPU usage goes up. there has to be a way to check for a specific process running. like if AppActivate(window title) returns false then the progam with the window title u passes is not running..
0
 
LVL 8

Expert Comment

by:List244
ID: 12831801
As far as I am aware, the only way to do this, is to enumerate the running
processes. However, if you want another way of going about it:

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21130332.html?query=exe+running&topics=93

But, other than enumerating processes, I do not know how to do this. Sorry.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question