Is it possible to encrypt a java class file?

851 views Asked by At

Is it possible to encrypt a java class file with MD5 & decrypt it for execution?

I have a client & I'd like to try encrypting my class files that have to be decrypted via a jar file in my dropbox. I have md5 text enryption in java, but how would I set the text to be encrypted as the text in the class file?

I've searched around but haven't found anything with someone trying to attemt it, hense I want to try this method.

3

There are 3 answers

9
Elliott Frisch On BEST ANSWER

MD5 is not a reversible function. Further, no one-way hash should be a reversible function.

1
Sven On

MD5 is message-digest algorithm (Hash function) not encryption algorithm, and it is meant to be irreversible.
http://en.wikipedia.org/wiki/MD5,
and for class encryption refer this How can you protect/encrypt your Java classes?

0
Javier On

As it was pointed out in other answers, MD5 is not an encryption algorithm.

Leave aside that, if the client is able to execute the code, it will need and will be able to decrypt the classes.

Third, [security through obscurity][1] (i.e. not using a "known method", but developing your own instead) gives only a false sense of security. If the security approach is sound, using a known algorithmn (well tested, with a solid implementation and without known attacks) makes it even stronger. If the approach is not sound, your only defense is the inability of the potential attacker to discover your method.

1: http://en.wikipedia.org/wiki/Security_through_obscurity