Possible Duplicate:
Jar executable that cannot be decompiled
How can I make "undecompilable" source in java? I have a microedition app that has code that I need to hide Is it possible?
Thanks in advance
Possible Duplicate:
Jar executable that cannot be decompiled
How can I make "undecompilable" source in java? I have a microedition app that has code that I need to hide Is it possible?
Thanks in advance
You can't. See this question:
http://stackoverflow.com/questions/919690/jar-executable-that-cannot-be-decompiled
Interesting-looking book on the subject:
http://apress.com/book/view/9781590592656
You can try obfuscation, but nobody will want to steal your sauce code anyway, so I guess it's more for peace of mind. When it comes down to it, everything is decompilable to a degree, otherwise operating systems wouldn't be able to run any programs!
In short. You can obfuscate your code to make it difficult for someone to read it and reuse it. If that is what you want, it could also make it difficult for someone to see what it does. But not impossible.
If you want your users to actually, you know, use the program, they need to be able to run the program. In order to be able to run the program, the CPU must be able to understand the program. CPUs are much stupider than humans, so this means that humans can understand the program, too.
If you obfuscate your program in such a way that it cannot be understood by humans, this also means that it cannot be executed.
If you don't want people to get access to your code, there is only one way: don't give it to them. Put it on a server and let your users connect to it via the network.
But all of that is completely unnecessary, since your code is automatically protected by copyright law anyway, which is much more powerful than any obfuscation.
Why do you say that it is impossible? You can make code undecompilable, the cuestion is how?
I have a fragment of code in java microedition that is undecompilable by jd:
public static void main(String args[]) {
int s = getSize("",false);
System.out.println(s);
}
public static int getSize(String recordStore, boolean available) {
RecordStore rs = null;
int size = -1;
try {
rs = RecordStore.openRecordStore(recordStore, true);
size = available ? rs.getSizeAvailable() : rs.getSize();
} catch (Exception ex) {
} finally {
if (rs != null) {
try {
rs.closeRecordStore();
} catch (RecordStoreNotOpenException ex) {
} catch (RecordStoreException ex) {
}
}
}
return size;
}
Another example? Try to decompile opera mini source code, inside it there is a fragment of code that you can't decompile (here is hidden the proxy server of opera mini)
Do you know what are the rules to make code undecompilable in order to avoid reverse engineering on java code?
Thanks for read me