首页 文章

签名小程序中的安全警告

提问于
浏览
2

我工作的公司有一个小程序,需要特殊访问客户机,所以每个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文件示例:

<?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批准的证书完成的,因此我几乎可以肯定问题不在于证书 .

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

Security Warning screenshot

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

1 回答

  • 5

    当前版本的Java插件中存在known issue,如果Trusted-Library属性也存在,则会忽略Caller-Allowable-Codebase属性 .

    此外,根据我的测试,applet必须由Caller-Allowable-Codebase的可信证书签名才能得到尊重 .

相关问题