Create a trusted applet to access the local file system (2)

Source: Internet
Author: User

After creating a trusted applet to access the local file system (2 ),
Written by Olexiy & Alexander prokhorenko
Translated by caiyi0903 (willpower), 2004.1.29

This statement generates a key certificate named testapplet, which is stored in your. keystore file. Validity indicates the key's validity period. The default value is 180. However, it takes one year, so we set it to 365. Run this statement in the Windows Command Prompt line window. You will get a lot of short questions to be answered from keytool, as shown in:

You may have understood that the most important thing is the password. You can use your own password, but do not forget it. As I mentioned earlier, creating a trusted applet is a simple operation, but you need to understand each step. Here, we have almost completed its operations, but we still need to say a few words for keytool. I suggest you pay more attention to it. It is necessary to read the keytool manual to understand the usage of each parameter. It is helpful for you to deeply understand its features. Now that we have our own keys, let's make a simple operation: just use our keys to design our applet. Use the following command line (change the current directory to the directory where testapplet. jar is stored ):

Jarsigner testapplet. Jar testapplet

The first parameter is our JAR file, and the second is the key alias (Key alias) just created above ). The jarsigner command is not user-friendly, so you will not see any information.

Congratulations, you have successfully created your first real signature applet! I think you may wish to try its functions right away. I can't find any reason not to let you do it. Upload the JAR file you signed to the directory where testapplet.html and testapplet. jar are stored first, and then overwrite the testapplet. jar file. View testapplet.html in the browser.

Then your applet will load and display a window, as shown below:

It asks whether you accept or reject the signature applet. Click "no" to display the applet with the old unsigned version, so it is still in the "sandbox" and has many constraints on "outside world. Click "yes" to get more freedom from your applet.

Here, we click "yes" and our applet is opened. Now, I want to do the same operation: Enter the path of our local file (C:/demo.txt) and click the "LOAD" button:

I believe you have the same result. Our task is completed. All problems are neither difficult nor complex. You only need to understand why each step is doing so. If you are interested in this topic, please browseHttp://java.sun.com/j2se/1.3/docs/tooldocs/win32/jarsigner.htmlFor more official information.

(Full text ...)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.