|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
The combination of a public key, identifying information, and a certification authoritys signature is called a certificate. The current generation of the standard for certificates is X.509v3. For more information about certificates and public-key encryption, see the section, Signing Your JARs, later in this chapter. Version 1.2 of the JDK includes new APIs for parsing certificates and maintaining local databases of X.509v3 certificates. New Security ToolsVersion 1.2 of the JDK also includes tools to help you manage X.509v3 certificates. Within your company, for example, you may decide to issue certificates to any employee. The Java keytool, new in version 1.2, enables each user to generate a public/private keypair. The user can also use keytool to generate his or her own certificate (although the certificate is to a slightly older standardX.509v1).
You use jarsigner in combination with your certificate to digitally sign Java archives (JARs).
You can write an external security configuration file that specifies your machines security policy. The easiest way to write such a file is to use Suns policytool, also new in JDK 1.2. Making a JARIn the earliest versions of Java, it was common to write simple applets that had only a single class file. More sophisticated applets may have dozens of class files as well as supporting files such as images and sounds. It became common to use the popular DOS archive format, .zip, to bundle class files together. The Java Virtual Machine can read the .zip format, so its not necessary to unzip these files. Unfortunately, many users automatically unzip any arriving .zip file, breaking the applet. In JDK 1.2 Sun provides tools for working with the Java archive format, JAR. A JAR file is still a .zip file, but includes a special manifest file to identify its contents. By using a suffix that is more clearly Java related, Sun has decreased the likelihood that end users will open the archive. You can place all the files associated with an applet into a JAR file and write <APPLET CODE=TMyApplet.class ARCHIVE=;MyArchive.jar, AnotherArchive.jar WIDTH=200 HEIGHT=200> </APPLET> This bit of code tells the browser to download the two JARs named. The browser can expect that the components of TMyApplet will all be found in those two JARs. Furthermore, if the browser already has a current copy of one or both of those JAR files in its cache, it may be able to skip the download and display the applet right away. Figure 41.5 illustrates how the class files for TMyApplet are distributed across the two JAR files.
As an applet developer, you get six benefits from JARs:
Although you can use PKZIP-based tools to make and change JARs, Sun provides a tool specifically designed for the task. This utility is called jarversions for all supported platforms are offered. Suppose you have the directory structure shown in Figure 41.6: several .class files plus an images directory. You could use the jar utility to put all these into a new JAR file. Well name it MyApplet.jar. The general format for the jar command line is jar options filenames
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |