Digital Signature
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.
& Lt html & gt
& Lt head & gt
& Lt meta http-equiv = "Content-Type" content = "text/html; charset = gb2312" & gt
& Lt meta name = "GENERATOR" content = "Microsoft FrontPage 4.0" & gt
& Lt meta name = "ProgId" content = "FrontPage. Editor. Document" & gt
& Lt title & gtNew Page 1 & lt/title & gt
& Lt/head & gt
& Lt body & gt
& Lt! -- Automatically downloads the jre package -- & gt
& Lt OBJECT
Classid = "clsid: CAFEEFAC-0014-0000-0000-ABCDEFFEDCBA"
WIDTH = 300 HEIGHT = 300
Codebase = "jinstall-1_4_0-win.cab # Version =," & gt
& Lt param name = code value = "test. class" & gt
& Lt param name = archive value = "test. jar" & gt
& Lt param name = "type" VALUE = "application/x-java-applet; jpi-version = 1.4" & gt
& Lt param name = "scriptable" VALUE = "false" & gt
& Lt/object & gt
& Lt/body & gt
& Lt/html & gt