views:

20

answers:

1

i have implemented a custom class loader to securing my application

but when i load an encrypted class java throws IllegalAccessError but i sure that decryption is done accuratly because i have put decrypted class file in some where and compared it with the original class file.

according to java documentations about IllegalAccessError

"Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed. "

how can i define my decrypted class compatibly?

A: 

This error almost certainly indicates that your encryption/decryption process is corrupting the original class files. I suggest a very careful round-trip testing process. Take a very large collection of classes, run then through encryption and decryption, and (a) compare to the original and (b) try to load them with the standard class loader. I predict that you will get failures and that they explain your problem.

It is also possible that your problem is very specific to what you class loader does after decryption before handing the bytes to the JVM, in which case you'll just have to debug it, but I'd test the first possibility first.

bmargulies