00000004.htm
来自「水木清华BBS」· HTM 代码 · 共 264 行 · 第 1/2 页
HTM
264 行
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: rhythin (多米诺骨牌), 信区: Java <BR>标 题: Re: 请教:有关在JAR文档中进行数字签名的问题 <BR>发信站: BBS 水木清华站 (Wed Apr 7 13:17:59 1999) <BR> <BR>This is a webpage of java, in case you have no access to internet: <BR>Unfortunately the JDK 1.1 signing and verification is not supported by the web browsers (Netscape's <BR>and Microsoft's.) It is supported in HotJava, <A HREF="http://java.sun.com/products/hotjava">http://java.sun.com/products/hotjava</A> and appletviewer. <BR> <BR>You can use the Java Plug-in in the browsers to get access to more recent JDK technology, <BR><A HREF="http://java.sun.com/products/plugin.">http://java.sun.com/products/plugin.</A> You can run 1.1.x signed applets with the Plug-in plugged into the <BR>browsers. <BR> <BR>We are working with the Java licensees to get the standard Java signing working for people in an <BR>interoperable way. <BR> <BR>You can also exercise this example by downloading these files <BR> <BR> <BR> signedWriteFile.jar <BR> signedWriteFile.html <BR> Duke.x509 <BR> <BR> <BR>from the ftp.javasoft.com web site. You will be able to experiment with creating and using the identity <BR>database, and you will be able to load the signed applet from your local net. <BR> <BR> <BR> <BR>Running signed applets with the Java Plug-in <BR> <BR> 1.Get the latest version of the Java Plug-in <BR> <BR> To follow this example, you'll need to download and install the Java Plug-in. <BR> <BR> Full instructions for installing the Java Plug-in are on its download page. Briefly, on Solaris, <BR> <BR> % chmod +x plugin-11-solaris2-sparc.bin <BR> % /bin/sh plugin-11-solaris2-sparc.bin* <BR> <BR> % mkdir -p ~/.netscape/java/lib <BR> % touch ~/.netscape/java/lib/rt.jar <BR> <BR> The mkdir and touch commands are needed to workaround a known bug that will be fixed in <BR> the next release of the Java Plug-in. <BR> <BR> On Windows, double-click on the file named plugin-11-win32.exe, and InstallShield will go <BR> through the installation. <BR> <BR> 2.Observe the restrictions placed on applets by default <BR> <BR> Downloaded applets are prevented from writing files to your hard disk. <BR> <BR> Here's the source code for an applet that wants to do just that. It tries to write a file named <BR> /tmp/foo (or a file named "tmpfoo" if you're on a Windows system.) This is not a malicious <BR> applet, but it is trying to do something that the Java Applet Security Manager prevents it from <BR> doing. <BR> <BR> After you've installed the Plug-In, start the Plug-in Control Panel: <BR> <BR> On Windows: From the Start menu, choose the Programs option. Then choose the Java <BR> Plug-in Control Panel menu item. <BR> <BR> On Solaris: You can run the Control Panel using the following command: <BR> <BR> ~/.netscape/java/ControlPanel <BR> <BR> Once in the control panel, turn on the option to view the Java Console. Then visit this URL <BR> <BR> <A HREF="http://java.sun.com/security/signExample/pluginEx.html">http://java.sun.com/security/signExample/pluginEx.html</A> <BR> <BR> from your browser. <BR> <BR> On the pluginEx.html page, the applet display should read "writeFile: caught security exception." <BR> This is a good thing, and the expected behavior. A security exception doesn't mean that a security <BR> violation occurred - it means exactly the opposite. It means that the system caught the applet <BR> trying to escape the restrictions of the applet sandbox. To alert you to that fact, the system throws <BR> an exception. This is programmer terminology for "the system set off a warning bell." When you <BR> see a security exception on a Java system, you know that the system prevented the code from <BR> violating security. <BR> <BR> Note that the Java Console should have displayed some output, including the location of the User <BR> home directory. This is important information that you should remember for the next step. <BR> <BR> 3.Set up your system to accept code signed by Duke <BR> <BR> It turns out that Duke (our mascot) signed this applet and stored it in an archive named <BR> signedWriteFile.jar. If you get a copy of Duke's certificate, import it into your system's identity <BR> database and declare Duke to be a trusted entity, then you'll allow any applet signed by Duke to <BR> have full authority on your system. <BR> <BR> Here's the steps you need to take to accomplish that. <BR> <BR> 1.Get a copy of Duke's certificate and store it in a file named Duke.x509 <BR> <BR> 2.Create the identity "Duke" in your JDK 1.1 identity database. By passing the parameter <BR> "true", you're saying that you want Duke to be a trusted identity. <BR> <BR> % javakey -c Duke true <BR> <BR> <BR> 3.Import Duke's certificate into your identity database, assuming you have a copy of Duke's <BR> certifiate in the file named Duke.x509. Associate that certificate with the identity "Duke" <BR> by using that nickname as the first argument to the javakey command. <BR> <BR> % javakey -ic Duke Duke.x509 <BR> <BR> <BR> 4.Make sure your identity database is in the directory where the Plug-in expects it to be. Your <BR> identity database should be in the User home directory that was displayed as part of the <BR> output in the Java Console. If your identity database does not already reside in this <BR> directory, copy it there. <BR> <BR> 4.Exit and restart your browser <BR> <BR> 5.Run the applet signed by Duke <BR> <BR> Now go ahead and run the applet signed by Duke. You'll notice that it can now create and write a <BR> file on your local filesystem. Visit this URL from your browser, after you've installed the Plug-In, <BR> and after you've imported Duke's certificate: <BR> <BR> <A HREF="http://java.sun.com/security/signExample/signedPluginEx.html">http://java.sun.com/security/signExample/signedPluginEx.html</A> <BR> <BR>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?