有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Java小程序“阻止运行可能不安全的组件?”消息

自从最新的Java更新以来,我的两个小程序向我们的用户显示了一个警告弹出窗口,即使我们使用的两个jar文件都已签名。我已经验证了它们是使用jarsigner -verify MyJarFile.jar命令签名的。下面是我们看到的弹出消息

enter image description here

我的applet通过JNI调用C++ DLL。C++DLL调用C++的.NET模块。

有人知道我能做些什么让这个弹出窗口消失吗?它说应用程序包含有符号和无符号代码,但我对jar文件中的每个java文件(只有1个)都进行了签名。我需要更高级别的签名吗

编辑:这发生在最新的Java更新之后。见下面摘自this page的引文

Authors and vendors of applications deployed using either Java applets or Java Web Start technology – applications distributed to end users at runtime via the web browser or network - should sign their code using a trusted certificate for the best user experience. Specifically, all Java code executed within the client’s browser will prompt the user. The type of dialog messages presented depends upon risk factors like, code signed or unsigned, code requesting elevate privileges, JRE is above or below the security baseline, etc. Low risk scenarios present a very minimal dialog and include a checkbox to not display similar dialogs by the same vendor in the future. Higher risk scenarios, such as running unsigned jars, will require more user interaction given the increased risk.


共 (1) 个答案

  1. # 1 楼答案

    我找到了答案。我的eclipse项目中没有清单文件,所以我创建了一个名为manifest.mf的文件,并将以下代码放入其中

    Manifest-Version: 1.0
    Trusted-Library: true
    

    在eclipse中构建jar文件时,在第3页,它会要求您提供一个清单文件。我相信这个选项默认为“为我创建清单文件”,但这个清单文件只包含上面的第一行。选择“从工作区使用现有清单”选项,然后选择清单。你刚刚创建的mf文件。然后像平常一样在罐子上签名

    Trusted-Library属性解决了这个问题。有关此属性和其他特权代码jar文件的更多信息,请查看this page