I'm writing a desktop java application. The program receives XML files from the customer's server. The data in a couple of tags is of type integer and is "encrypted" with some math formulas.
When my program parses XML files, I need to decrypt those tags. The formulas for decryption looks like this:
int decrypted = (int) Math.ceil(Math.pow ((idProduct + 1) / 3, 1.5));
The decrypted data is then saved to H2 database, which is encrypted with AES-128.
What I need is to somehow hide such formulas from decompilation.
My attempts:
1. To hide the formulas I tried to use obfuscators, but I haven't found any that did smth with formula. Here's a piece of code obfuscated by ProGuard 4.8 and decompiled by JAD:
private String d(String paramString) {
long l = Long.valueOf(paramString).longValue();
int i = (int)Math.ceil(Math.pow((l + 1L) / 3L, 1.5D));
String str = String.valueOf(i);
return str;
}
As you can see ProGuard did nothing with formula. We can not afford to use commercial obfuscators like Zelix KlassMaster.
2. I was thinking to try JET Excelsior (but it appears that java 7 apps're not supported yet). In addition I don't think it would be appreciated by my boss.
3. I also thought about using some wrappers like launch4j, but I don't know whether it's hard or not to extract the .jar from it.
4. Then I thought about writing an external lib in C and using JNI. But it seems that competitors would be able just to use that library.
5. The good solution IMO is to write decryption functions in ASM and paste it directly to java code like we can do this is C. Unfortunately, this is not possible.
6. The encryption of classes is pointless to use.
I understand that everything could be decompiled/disassembled, I just want to make it a little bit harder than just run JAD and get it at once.
Please advise me