O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Signing Code for the Java Plug-In

The Java Plug-In uses the built-in Java security model, so it uses your key store for certificates and your .java.policy file to establish the security policy.

Back in Chapter 36, "Java Security Features," you saw how to create a private key and a certificate and then use the two to sign a JAR file. You use the same procedure when you want to sign applet code. Just package the applet code into a JAR file and sign the JAR.

Listing 45.1 shows an example applet that reads a file called journal from your home directory (what Java calls user.home). You edit the file using the TextArea displayed on the screen and click the Save button at the bottom to save the text.

Code Listing 45.1. Source Code for JournalApplet.java ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required