问题
- we'd defend against the code crackers who can operate on the whole operation system who may read the encoded class-file via "java.io" and save the copy
- we'd protect java-based application's intellectual property
- this requirement was raised by several customers, so it has realistic value.
Simplex Java-JDK-JVM solution like securityManager without native code/tool can NOT be accepted because it's easy to be bypassed, since cracker have the admin privilege on the OS in this scenario.
回答1:
You are probably better off using a SecurityManager
to control access to Java APIs. The SecurityManager can call into native code if it wants.
Specifically, the checkRead method can be used to validate if a program is permitted to read from a given path, which covers not just FileInputStream.read()
but any other means of reading files in Java.
来源:https://stackoverflow.com/questions/22084982/can-i-stop-the-malicious-reading-the-class-files-via-java-io-function-with-nat