Java security model

You can download Java™ applets from any system; thus, security mechanisms exist within the Java virtual machine to protect against malicious applets. The Java runtime system verifies the bytecodes as the Java virtual machine loads them. This ensures that they are valid bytecodes and that the code does not violate any of the restrictions that the Java virtual machine places on Java applets.

Just as with applets, the byte code loader and verifier check that the byte codes are valid and data types are used properly. They also check that registers and memory are accessed correctly, and that the stack does not overflow or underflow. These checks ensure that the Java virtual machine can safely run the class without compromising the integrity of the system.

Java applets are restricted in what operations they can perform, how they access memory, and how they use the Java virtual machine. The restrictions are in place to prevent a Java applet from gaining access to underlying operating system or data on the system. This is the "sandbox" security model, because the Java applet can only "play" in its own sandbox.

The "sandbox" security model is a combination of the class loader, class file verifier, and the java.lang.SecurityManager class.

For more information about security, see the Security by Sun Microsystems, Inc. documentation and Secure applications with SSL.

Related concepts
Java Cryptography Extension
Java Secure Socket Extension
Java Authentication and Authorization Service
IBM Java Generic Security Service (JGSS)