首页 文章

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

提问于
浏览
0

我正在文件夹JNLP-INF下的jar文件中签署一个具有APPLICATION.JNLP的JNLP文件 . 我的APPLICATION.JNLP放在 jar 里看起来如下所示

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

我面临的问题是使用此APPLICATION.JNLP我收到“签名的JNLP文件与下载的jnlp文件不匹配” . 在添加精确的参数参数时它可以工作我想使用动态启动参数 . 我做错了什么?

2 回答

  • 0

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

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

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

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

    如果我正确读取了doc,那么签名的.jar文件中的JNLP模板应命名为JNLP-INF / APPLICATION_TEMPLATE.JNLP

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

相关问题