View | Details | Raw Unified | Return to bug 52344
Collapse All | Expand All

(-)src/main/org/apache/tools/ant/taskdefs/SignJar.java (+52 lines)
Lines 110-115 Link Here
110
    private boolean force = false;
110
    private boolean force = false;
111
111
112
    /**
112
    /**
113
     * signature algorithm
114
     */
115
    private String sigAlg;
116
117
    /**
118
     * digest algorithm
119
     */
120
    private String digestAlg;
121
122
    /**
113
     * error string for unit test verification: {@value}
123
     * error string for unit test verification: {@value}
114
     */
124
     */
115
    public static final String ERROR_TODIR_AND_SIGNEDJAR
125
    public static final String ERROR_TODIR_AND_SIGNEDJAR
Lines 276-281 Link Here
276
    }
286
    }
277
287
278
    /**
288
    /**
289
     * Signature Algorithm; optional
290
     *
291
     * @param sigAlg the signature algorithm
292
     */
293
    public void setSigAlg(String sigAlg) {
294
        this.sigAlg = sigAlg;
295
    }
296
297
    /**
298
     * Signature Algorithm; optional
299
     */
300
    public String getSigAlg() {
301
        return sigAlg;
302
    }
303
304
    /**
305
     * Digest Algorithm; optional
306
     *
307
     * @param digestAlg the digest algorithm
308
     */
309
    public void setDigestAlg(String digestAlg) {
310
        this.digestAlg = digestAlg;
311
    }
312
313
    /**
314
     * Digest Algorithm; optional
315
     */
316
    public String getDigestAlg() {
317
        return digestAlg;
318
    }
319
320
    /**
279
     * sign the jar(s)
321
     * sign the jar(s)
280
     *
322
     *
281
     * @throws BuildException on errors
323
     * @throws BuildException on errors
Lines 420-425 Link Here
420
            addValue(cmd, "-sectionsonly");
462
            addValue(cmd, "-sectionsonly");
421
        }
463
        }
422
464
465
        if (sigAlg != null) {
466
            addValue(cmd, "-sigalg");
467
            addValue(cmd, sigAlg);
468
        }
469
470
        if (digestAlg != null) {
471
            addValue(cmd, "-digestalg");
472
            addValue(cmd, digestAlg);
473
        }
474
423
        //add -tsa operations if declared
475
        //add -tsa operations if declared
424
        addTimestampAuthorityCommands(cmd);
476
        addTimestampAuthorityCommands(cmd);
425
477
(-)manual/Tasks/signjar.html (+29 lines)
Lines 158-163 Link Here
158
      <em>since Ant 1.8.0</em>.</td>
158
      <em>since Ant 1.8.0</em>.</td>
159
    <td align="center" valign="top">No; default false</td>
159
    <td align="center" valign="top">No; default false</td>
160
  </tr>  
160
  </tr>  
161
  <tr>
162
    <td valign="top">sigalg</td>
163
    <td valign="top">name of signature algorithm</td>
164
    <td valign="top" align="center">No</td>
165
  </tr>
166
  <tr>
167
    <td valign="top">digestalg</td>
168
    <td valign="top">name of digest algorithm</td>
169
    <td valign="top" align="center">No</td>
170
  </tr>
161
</table>
171
</table>
162
<h3>Parameters as nested elements</h3>
172
<h3>Parameters as nested elements</h3>
163
<table border="1" cellpadding="2" cellspacing="0">
173
<table border="1" cellpadding="2" cellspacing="0">
Lines 231-237 Link Here
231
Sign all the JAR files in dist/**/*.jar <i>in-situ</i>. Lazy signing is used,
241
Sign all the JAR files in dist/**/*.jar <i>in-situ</i>. Lazy signing is used,
232
so the files will only be signed if they are not already signed.
242
so the files will only be signed if they are not already signed.
233
</p>
243
</p>
244
  <blockquote><pre>
245
&lt;signjar
246
    alias="testonly" keystore="testkeystore"
247
    storepass="apacheant"
248
    sigalg="MD5withRSA"
249
    digestalg="SHA1"&gt;
250
  &lt;path&gt;
251
    &lt;fileset dir="dist" includes="**/*.jar" /&gt;
252
  &lt;/path&gt;
253
&lt;/signjar&gt;
254
</pre></blockquote>
255
<p>
256
Sign all the JAR files in dist/**/*.jar using the digest algorithm SHA1 and the
257
signature algorithm MD5withRSA. This is especially useful when you want to use
258
the JDK 7 jarsigner (which uses SHA256 and SHA256withRSA as default) to create
259
signed jars that will be deployed on platforms not supporting SHA256 and
260
SHA256withRSA.
261
</p>
234
<h3>About timestamp signing</h3>
262
<h3>About timestamp signing</h3>
263
<h3>About timestamp signing</h3>
235
264
236
<p>
265
<p>
237
Timestamped JAR files are a new feature in Java1.5; a feature supported in Ant since
266
Timestamped JAR files are a new feature in Java1.5; a feature supported in Ant since

Return to bug 52344