views:

234

answers:

4

I need to protect my program from disassembly. The first attempt would be by encrypting the program and decrypting its parts when needed. Perhaps encrypting again when decrypted code is executed.

Please give me a clue, how create this type of defense. Obviously without assambler this task is difficult, but I haven't found many resources.

If you have any URLs to share with information around this issue, please share.

+13  A: 

This is pointless. If you don't have control and support of the hardware, the code could always be run in an emulator that would read decrypted instructions.

Protect the data not the code.

Nikolai N Fetissov
+4  A: 

This is just wrong :/. If you encrypt/decrypt every function that will be executed, your program will have the speed as a ... i don't know. A stone perhaps?

There is no good solutions on how to completely protect against disassembly.

Burbas
I like stones :)
Juri Robl
Who doesn't? :)
Burbas
Stones can move very fast, though. For instance when involved in rockslides. But not if they're running on Windows.
amphetamachine
Stones also need to move fast to break windows too.
Jeffrey Kern
+2  A: 

Look at this article and also this one regarding binary-level encryption of executable code.

Other than that, just strip your debugging symbols and use gcc's -O2 flag; the bytecode will become more or less un-decompilable.

amphetamachine
well, even if the debug symbols are striped it is still possible to "decrypt" what the program does, but of course, it is very difficult and time consuming.
Quonux
@Quonux - I admit it wouldn't be as difficult as full code encryption, but it would serve its purpose as far as code hiding.
amphetamachine
A: 

You'll have to have the decrypting component in the clear, right? Which means that you have handed the attacker the key to unlock the box, right? So what, exactly, have you gained by doing this?

dmckee