|
Question How do you protect your code from decompilers?
I have read in a few previous threads on the JDC forums, and elsewhere, about programs that can convert
This is definitely an issue that affects anyone deploying Java software. Does anyone know whether, in fact, this can be done? What can be done to prevent it? Tip A number of Java decompilers exist on and off the market (Mocha is one of the primordial utilities from which a number of subsequent, commercial and otherwise, versions have been derived). They vary widely in their effectiveness, but have gotten considerably better over the years.
The pseudo-art of bytecode protection is called obfuscation and generally relies heavily on name-mangling (rendering human-readable identifiers unintelligible in an attempt to cloak method, class, and variable names), adding empty or superfluous bytecode and/or actual bytecode modification. The last is 'safest' but breaks code (like Applet code) that must be verified. Encryption is a more general term that relates to the process of making (attempting to make) data indecipherable for transmission. Obfuscation is not quite the same, as it does not truly encipher Regarding decompilation - yes, the code produced by decompilers is often significantly different from the code that was originally compiled, reflecting bytecode optimization on the part of the compiler and/or the decompiler (and occasionally decompiler mistakes as well). And as pointed out the code returned can often be an optimized version of the programmer's original intent.
By way of example here is an unoptimized and rather ugly * Decomp.java
* Decomp.jad
Acknowledgments Thank you to member xhunterx for the solution to this question.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||