Thursday January 31, 2008
Obfuscation
Today I was asked about obfuscation. In fact, the question was "how to obfuscate code in NetBeans". Well, code in NetBeans is like any other Java code anywhere else. And others have had the same need. I looked into it and came up with the following:
- Download ProGuard.
- In your build.xml, add the target outlined in this handy FAQ: Can I obfuscate a module? Just make sure to replace ${proguard.jar.path} with the full path to the proguard.jar, which can be anywhere. Also remove the dependency on init target, in the obfuscate target outlined in the above FAQ.
- Build your application. When you do so, the Output window shows that ProGuard writes a new folder with your own module's obfuscated classes:
- Look in the folder indicated above and there's the 'obfuscated' folder with the obfuscated classes:
Next I tried to decompile the classes, but all 3 of the decompiler plugins in the Plugin Portal failed me. But, if one wanted to decompile, there are many decompilers out there that could be used. The point is that obfuscation is not difficult to achieve, via the handy Ant target above. And, it's clear that if you have some top secret code that you need to obfuscate, there's a well trodden path that you can follow.
Jan 31 2008, 06:07:59 PM PST Permalink


