If a Java Applet written using an applet has not been signed, the access to the client program will be subject to security restrictions after downloading it. how to add a Java Applet signature has attracted the attention of many people, these documents are also available for reference on the Internet, but they are not complete. Here I will provide a document for specific operations, hoping to help you.
Scenario: test. jar: contains the Java applet to be signed.
Result: After signing, the client can automatically download the Java Applet, And the Java Applet can access any resources of the client.
Steps:
(1) package Java applets
Jar CVF test. jar test. Class
(2) generate a keystore named chinani. Store and Its alias is chinani.
Keytool-genkey-keystore chinani. Store-alias chinani
Password: 123456 (enter the password as needed)
Enter the following as needed and confirm: Y
(3) export the chinani. Cer Digital Certificate
Keytool-export-keystore chinani. Store-alias chinani-file chinani. Cer
Password: 123456 (enter the password as needed)
(4) sign the test. JAR File
Jarsigner-keystore chinani. Store test. Jar chinani
Password: 123456 (enter the password as needed)
Finally, write an HTML file and run it to automatically download and install the Java applet.
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Meta name = "generator" content = "Microsoft FrontPage 4.0">
<Meta name = "progid" content = "FrontPage. Editor. Document">
<Title> New Page 1 </title>
</Head>
<Body>
<! -- Automatically downloads the JRE package -->
<Object
Classid = "CLSID: CAFEEFAC-0014-0000-0000-ABCDEFFEDCBA"
Width = 300 Height = 300
Codebase = "jinstall-1_4_0-win.cab # version =,">
<Param name = code value = "test. Class">
<Param name = archive value = "test. Jar">
<Param name = "type" value = "application/X-Java-applet; jpi-version = 1.4">
<Param name = "Scriptable" value = "false">
</Object>
</Body>
</Html>