gpt4 book ai didi

java - 签名小程序中的安全警告

转载 作者:行者123 更新时间:2023-11-30 06:21:23 26 4
gpt4 key购买 nike

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

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

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

这是主小程序 jar 中的 list 文件示例:

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 批准的证书完成的,所以我几乎可以肯定问题不在证书上。

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

Security Warning screenshot

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

最佳答案

有一个known issue在 Java 插件的当前版本中,如果还存在 Trusted-Library 属性,则导致忽略 Caller-Allowable-Codebase 属性。

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

关于java - 签名小程序中的安全警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20587601/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com