This is a brainstorming question about what\'s possible in Java (or not). I want to know if it is possible to hide a secret within a class and prevent anymore from accessing
There is another angle to this issue: Java delivered Permissions. In a context where the environment is controlled, one can assign a set of permissions to classes loaded with a secure class loader.
Java delivers 3 permissions objects related to the implementation of security:
PrivateCredentialPermission SecurityPermission AuthPermission
These can help improve and control access to functionalities when implementing a cryptography system. They are necessarily sufficient to make the system secure.