Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

encryption and decryption

 
Nesrin aboud
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to encrypt a class so that can not be decompiled by any decompiler and how to decrypt this class?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not possible. A JVM must be able to access the unencrypted bytecode at some point in order to execute it, and a technically savvy attacker can instrument the JVM to retrieve that bytecode.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48968
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is almost as easy as trisecting the angle, squaring the circle and drawing a map which really requires four colours to distinguish all the countries on it.
 
Nesrin aboud
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:That's not possible. A JVM must be able to access the unencrypted bytecode at some point in order to execute it, and a technically savvy attacker can instrument the JVM to retrieve that bytecode.


I used decompiler to decompile my classes and it was so easy to detect the code
so how to encrypt parts of it to prevent that?

do you mean that we can encrypt only parts of the code such as certain method in the class
and leave another method that calls the encrypted one not encrypted

sorry I did not understand your opinion enough would you please explain it more
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The key words of my post were "That's not possible." If you don't want anyone decompiling code, then don't give it to them. That's the only really safe solution.
 
Nesrin aboud
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to decompile a class and an error was present that there is a method can not find it
and when I tried to recompile the class with the same software, the operation failed

I thought about encryption and decryption but i failed to do the same with my class
do you have an idea about why these errors occurred in this class ?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Decompilers aren't perfect; sometimes they miss things or can't figure out something, and one would have to fix the generated source code manually. It's not unusual at all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic