Meaningless Drivel is fun!
The moose likes JBoss/WildFly and the fly likes Encrypted class loading with jboss 5.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Encrypted class loading with jboss 5.1" Watch "Encrypted class loading with jboss 5.1" New topic

Encrypted class loading with jboss 5.1

Iirfan Bbasha

Joined: Feb 08, 2013
Posts: 3
Hello All,

We are using jboss 5.1 to deploy our application. Now we want to secure our .class files, so we are trying to encrypt the .class files.
but once we use encrypted .class files, jboss throws error (rather warnings saying
WARN [org.jboss.detailed.classloader.ClassLoaderManager] (main) Unexpected error during load
java.lang.ClassFormatError: Unknown constant tag 80 in class file xxx/xxx/UserController)

To solve this issue, I got the source of jboss-classloader.jar (This jar is in /lib folder of jboss), and I saw that the class BaseClaseLoader is the class which finally calls jvm's classloader.
Hence I changed the code of BaseClassLoader's loadClassLocally method, and decrypted the class before it calls jvm's classloader. And it worked.

Now I dont want to modify jboss's source code hence I am looking for a way to do this without modifying the jboss libraries. I was going through and I feel it is possible to load encrypted classes into jboss by creating custom ClassLoaderPolicy. I tried a lot to do this, but I am not able to get it working.

Can some one tell me how I can add a custom class loader to jboss 5.1 which can decrypt the .class files before loading it.

It is sorta covered in the JavaRanch Style Guide.
subject: Encrypted class loading with jboss 5.1
It's not a secret anymore!