2

我工作的公司有一个需要对客户端机器进行特殊访问的小程序,因此每个 Jar 文件都经过数字签名。小程序和公司的 Web 应用程序使用 javascript 进行交互以进行通信。

问题是第一次通过 javascript 使用小程序时,Java 会抛出一个警告安全弹出窗口,要求用户“允许”或“不允许”从网站访问小程序。

我已经检查了 Oracle 的指南,以对小程序进行数字签名,清单参数,但我无法删除安全警告。此外,每次我们测试应用程序时,我们都会通过 Java 控制面板清除浏览器的缓存和 Java 缓存。我们在 Windows 7 和 8 下工作。

以下是主小程序 jar 中的清单文件示例:

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=
....

以下是用于部署小程序的 JNLP 文件示例:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" href="launch-1.3.4.jnlp">
    <information>
        <title>Application Title</title>
        <vendor>Our Company</vendor>
        <homepage href="http://www.ourdomain.net" />
    </information>
    <security>
        <all-permissions/>
    </security>
    <update check="always" policy="always" />
    <resources os="Windows" arch="x86">
        <j2se version="1.7+" java-vm-args="-Djnlp.packEnabled=false" href="http://java.sun.com/products/autodl/j2se" />
        <jar href="firstjar.jar" version="1.3" download="progress"/>
        <jar href="secondjar.jar" main="true" version="1.49"/>
        ...
    </resources>
    <resources os="Windows" arch="x86_64">
        <j2se version="1.7+" java-vm-args="-Djnlp.packEnabled=false" href="http://java.sun.com/products/autodl/j2se" />
        <jar href="firstjar.jar" version="1.3" download="progress"/>
        <jar href="secondjar.jar" main="true" version="1.49"/>
        ...
    </resources>
    <resources os="Mac OS X">
        <j2se version="1.7+" java-vm-args="-Djnlp.packEnabled=false" href="http://java.sun.com/products/autodl/j2se" />
        <jar href="firstjar.jar" version="1.3" download="progress"/>
        <jar href="secondjar.jar" main="true" version="1.49"/>
        ...
    </resources>
    <applet-desc
        name="My Application Name"
        main-class="main.MainClass"
        width="300"
        height="300"
        progress-class="firstjar.ProgressIndicator">
        <param name="MAYSCRIPT" value="true" />
        <param name="scriptable" value="true" />
    </applet-desc>
</jnlp>

此外,每个签名的 jar 文件都包含以下两个特殊文件夹和文件:

jarfile.jar\
 +-META-INF\
 | +-MANIFEST.MF
 | +-CODESIGN.SF
 | +-CODESIGN.RSA
 +-JNLP-INF\
   +-APPLICATION.JNLP

数字签名是使用有效且 CA 批准的证书完成的,所以我几乎可以肯定问题不在于证书。

这是警告安全消息的屏幕截图:

安全警告截图

非常感谢您的关注和帮助。

4

1 回答 1

5

在当前版本的 Java 插件中存在一个已知问题,如果 Trusted-Library 属性也存在,则会导致 Caller-Allowable-Codebase 属性被忽略。

此外,根据我的测试,小程序必须由受信任的证书签名,才能尊重 Caller-Allowable-Codebase。

于 2013-12-14T20:10:31.937 回答