Create a trust applet (2) for accessing the local file system

zhaozj2021-02-16  47

Create a trust applet (2) for local file system Written by Olexiy & Alexander Prokhorenko Translated by Caiyi0903 (Willpower), 2004.1.29

This statement will generate a key certificate that is called TestApplet, which will be stored in your .keystore file. Validity refers to the validity period of the key, the default is 180, but here we take a year, so we set it to 365. Run this statement in the Windows command prompt window, you will get a lot of short problems you need to answer from KeyTool, as shown below:

Maybe you have already understood that the most important thing is of course a password. You can use your own password, but don't forget it. I have said before, creating trust applet is a very simple operation, but you have to understand the truth of each step. Here, we have completed its operations almost, but you still have to say a few words for KeyTool. I suggest you pay more attention to it, read KeyTool's manual to understand the usage of each parameter is necessary, which is very helpful for you to understand it in depth. Ok, since we have produced our own key, let's do a simple operation: just use our key to design our applet. Use the following command line (please change the current directory to TestApplet.jar):

Jarsigner testapplet.jar Testapplet

The first parameter is our JAR file, the second is the key alias that has just created above. The jarsigner command is not friendly, so you will see any information.

Congratulations, you have successfully created your first real signature applet! I think you can't wait to try it right away, I can't find any reason not to do this. Upload or just copy your signature JAR file to the directory of your previous TestApplet.html and Testapplet.jar, then override the TestApplet.jar file. Browse TestApplet.html in your browser.

Then your applet will load and display a window as follows:

It asks if you accept or reject this signature app. Click "NO" to display the applet with the old unqualified version, which is still in the "sandbox" and has a lot of constraints on the "outside world". Click "Yes" to get more freedom with your applet.

Here, we click "Yes", and our applet is opened. Now, I have to do the same operation: Enter the path to our local file (c: /demo.txt), click on the "Load" button:

I believe that you also got the same result. Our mission is completed. All problems are not very difficult, nor is it a complicated. You just have to understand why every step is to do so. If you are interested in this topic, please visit http://java.sun.com/j2se/1.3/docs/tooldocs/win32/jarsigner.html to get more official information.

(Full text ...)

转载请注明原文地址:https://www.9cbs.com/read-24916.html

New Post(0)