Sunday 17 June 2012

Save your code from Java Decompilation

I took a break from the core, bottom-most almost hardware types kind of code - You know what I mean, to a little bit of securing my Java code. I used to work on a framework which was written in Java - A good one - robust, fast, highly scalable and even light. The problem with that framework was that it could easily be hacked - I mean decompiled. So, what I've seen many doing is, they rip code from such amazing frameworks and ship it as their own. I know it's not ethical but that's what happens many of times. So, how do you save yourself from such cheap yet occurring incidents of Java Code Decompilation? 


Of course from a bird's eye view, there needs to be some sort of locking implemented on your code or even encryption may be. To go about protecting your Java source code, we need obfuscators which helps us solve our problem. Obfuscators are good but really suck sometimes from the point of view of optimization. It's terrible that you write super optimized code and then pass it through some sorta machine and then it's all gone. It becomes junk again. So, while saving your code from decompilation, please do ensure that you're using the write obfuscator which still keeps your code optimized.


One another solution to protect your source code is to use Encrypted Jar Files. Well, I would not use this as a first option because of the process involved in encryption and decryption which is expensive. But well, this is a solution to save your code too!




Third option would be to compile your code directly to Platform specific Assembly. This destroys the entire motive of Java - Platform Independent. 


My Advice - Use a good obfuscator. Choose it wisely.




Here is Zelix Obfuscator which is good. Try it. Do some trials on various obfuscators and choose one which matches your code environment.



1 comment:

  1. Yes. We need to use Obfuscators. The other two methods you've mentioned are good. But Obfuscators are the best!

    Thanks for posting this.

    ReplyDelete

Do you like our Content?