使用动态参数对 JNLP 文件进行签名



我正在签署一个具有应用程序的JNLP文件。JNLP 在文件夹 JNLP-INF 下的 jar 文件中。我的应用程序。放置在罐子中的 JNLP 如下所示

<jnlp spec="1.0" codebase="https://www.example.com:7008/abc">
<information>
    <title>XYZ</title>
    <vendor>XYZ</vendor>
    <description>XYZ</description>
</information>
<security>
    <all-permissions/>
</security>
<resources>
    <j2se version="1.6+" />
    <jar href="abc.jar" />
</resources>
<application-desc main-class="tempclass.Class1">
    <argument>*</argument>
    <argument>*</argument>
    <argument>*</argument>
    <argument>*</argument>
    <argument>*</argument>
    <argument>*</argument>
    <argument>*</argument>
</application-desc>
</jnlp>

我从 jsp 生成的 JNLP 文件如下所示

<jnlp spec="1.0" codebase="https://www.example.com:7008/abc">
<information>
    <title>XYZ</title>
    <vendor>XYZ</vendor>
    <description>XYZ</description>
</information>
<security>
    <all-permissions/>
</security>
<resources>
    <j2se version="1.6+" />
    <jar href="abc.jar" />
</resources>
<application-desc main-class="tempclass.Class1">
    <argument>1</argument>
    <argument>2</argument>
    <argument>3</argument>
    <argument>4</argument>
    <argument>5</argument>
    <argument>6</argument>
    <argument>7</argument>
</application-desc>
</jnlp>

我面临的问题是使用此应用程序。JNLP 我收到"签名的 JNLP 文件与下载的 jnlp 文件不匹配"。在添加确切的参数参数时,它可以工作。我想使用动态启动参数。我做错了什么?

从 Java 8 更新 161 开始,您可以在 JNLP 中定义安全参数。在 resources 元素内插入属性

  <property name="jnlp.secure.argument.<argument-name>" value="true"/>

您还可以使用通配符,以便所有参数都标记为安全

  <property name="jnlp.secure.argument.*" value="true"/>

如果我正确阅读了文档,则签名.jar文件中的 JNLP 模板应命名为 JNLP-INF/APPLICATION_TEMPLATE。JNLP

JNLP-INF/APPLICATION.JNLP 适用于无动态情况。

最新更新