In jdk1.1, you can use the Javakey command to generate the public key, private key, certificate, and signature jar files, please refer to the details: Http://java.sun.com/security/usingJavakey.html and Java 2 The signature mechanism has been improved to allow users more flexibility to set security permissions. Java 2 provides three tools: Keytool,policytool and Jarsigner to implement a signed applet. For example, Joe writes a signature Applet:SignedApplet.java, so the process of producing a simple signed applet is as follows:
Generates the key, the key alias is Joe, the password is sign12,
stored in the KeyStore joestore
keytool-genkey-alias joe-keypass
sign12-keystore
//Will signedapplet. Class and related files are packaged into jar file
jar CVF Signedappletdemo. Jar
///Generate Signed applet (JAR file)
Jarsigner-keystore Joestore-signedjar Joe.jar with Keytool generated self-signed certificate
Signedappletdemo.jar Joe
//Export self-signed certificate from KeyStore to file
keytool-export-keystore joestore
-alias joe-file Joe.cer |
For the recipient of the signed applet, Susan, you need to perform the following steps safely
Signed applet written by Joe:
Get Joe's certificate and read it into the KeyStore susanstore
keytool-import-alias joe-file
joe.cer-keystore susanstore
// Run Policytool generate policy files that meet Susan's requirements
Policytool
//Run with Appletviewer, or install Java plugin in a browser. |
For the deployment of a signed applet in the Java plugin, refer to the following Web page:
Http://java. Sun com/security/signexample12/
Note: For simplicity, the above example uses the self-signed certificate produced by Keytool. In fact, users can also use Keytool-certreq to apply for an electronic certificate to the commercial CA center.