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 ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.