I want to encrypt my .class files in ear.
I guess I need a custom ClassLoader to decrypt them at run-time.
It should behave just as usual JBoss classloader but also should be able to decrypt my class files right before loading.
How can I supply such classloader to JBoss?
That is too low level an integration point. Use a custom deployer or even a custom org.jboss.deployment.scanner.URLDeploymentScanner