我工作的公司有一个小程序,需要特殊访问客户机,所以每个Jar文件都是以数字方式签名的.applet和公司的Web应用程序使用javascript进行交互.
问题是第一次通过javascript使用applet时,Java会抛出一个Warnign Security弹出窗口,要求用户"允许"或"不允许"从网站访问applet.
我检查过Oracle的指南,对applet和Manifest参数进行数字签名,但是我无法删除安全警告.此外,每次我们测试应用程序时,我们都会通过Java控制面板清除浏览器的缓存和Java缓存.我们在Windows 7和8下工作.
以下是主applet jar中Manifest文件的示例:
Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.1 Trusted-Library: true Application-Library-Allowable-Codebase: one.developdomain.net two.developdomain.net *.developdomain.net productiondomain1.net productiondomain2.net productiondomain3.net Trusted-Only: false Built-By: My Name Application-Name: My Application Name Permissions: all-permissions Created-By: 1.7.0_45-b18 (Oracle Corporation) Caller-Allowable-Codebase: one.developdomain.net two.developdomain.net *.developdomain.net productiondomain1.net productiondomain2.net productiondomain3.net Codebase: one.developdomain.net two.developdomain.net *.developdomain.net productiondomain1.net productiondomain2.net productiondomain3.net Name: services/xmpp/ChatPanel$4.class SHA1-Digest: 7On19s6cztysSsrtARTlT5g1R8U= ....
以下是用于部署applet的JNLP文件示例:
Application Title Our Company ... ... ...
此外,每个签名的jar文件包含以下两个特殊文件夹和文件:
jarfile.jar\ +-META-INF\ | +-MANIFEST.MF | +-CODESIGN.SF | +-CODESIGN.RSA +-JNLP-INF\ +-APPLICATION.JNLP
数字签名是使用有效的CA批准的证书完成的,因此我几乎可以肯定问题不在于证书.
以下是警告安全消息的屏幕截图:
非常感谢您的关注和帮助.
当前版本的Java插件中存在一个已知问题,如果Trusted-Library属性也存在,则会导致Caller-Allowable-Codebase属性被忽略.
此外,根据我的测试,applet必须由Caller-Allowable-Codebase 的可信证书签名才能得到尊重.