Java Reference
In-Depth Information
An applet can also be signed, which involves creating a security certificate.
This is the typical way to create an applet that needs to perform tasks
outside the sandbox because it provides the user of the applet with some
assurance as to the source of the applet, letting the user decide whom he
or she trusts. Creating a certificate and associating permissions with it are
beyond the scope of this topic. For more information, check Sun's Java
Web site at http://java.sun.com/.
Classroom Q & A
Q: How does the sandbox enforce these rules?
A: The security permissions are enforced by the JVM.
Q: Suppose a programmer familiar with Java security writes an applet
that grants itself permission to break the rules. Can this be done?
A: I should say no, but there always seem to be holes in any security
mechanism. I will say this: It would be extremely difficult to write
an applet that steps outside its sandbox without the user granting
it permission. It is probably easier for someone to write an applet
that tricks a user into agreeing to a signed certificate so that the
applet could do anything it wanted on the person's machine than
it is to write Java code that bypasses the built-in security features
of applets and the JVM.
Q: So applets really are not that secure, are they?
A: No, I didn't say that. Applets by their nature are much safer than
other Web applications that do not have a sandbox-type security.
If a user has security turned on, an applet cannot leave its sandbox
without the express permission of the user. An applet has much
tighter security restrictions than HTML, JavaScript, and other widely
used Web development technologies.
Q: Can I turn off the security permissions so my own applets can run
on my machine and perform actions such as accessing the local
file system?
A: Certainly. Let me show you how to do this using Microsoft Internet
Explorer. You will find that Microsoft has hidden this feature deep
in the browser settings, so you will need to follow along closely.
Search WWH ::




Custom Search