2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2001-02-13 12:32:01 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-02-03 22:00:42 +00:00
|
|
|
<title>SignJar Task</title>
|
2001-02-13 12:32:01 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h2><a name="signjar">SignJar</a></h2>
|
|
|
|
<h3>Description</h3>
|
2005-03-22 17:36:58 +00:00
|
|
|
<p>Signs JAR files with the <tt>jarsigner</tt> command line tool.
|
|
|
|
It will take a named file in the <tt>jar</tt> attribute, and an optional
|
2005-11-29 04:45:43 +00:00
|
|
|
<tt>destDir</tt> or <tt>signedJar</tt> attribute. Nested paths are also
|
2005-03-22 17:36:58 +00:00
|
|
|
supported; here only an (optional) <tt>destDir</tt> is allowed. If a destination
|
|
|
|
directory or explicit JAR file name is not provided, JARs are signed in place.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Dependency rules
|
|
|
|
</p>
|
|
|
|
<ul>
|
2005-07-08 16:59:46 +00:00
|
|
|
<li>Nonexistent destination JARs are created/signed</li>
|
2005-03-22 17:36:58 +00:00
|
|
|
<li>Out of date destination JARs are created/signed</li>
|
|
|
|
<li>If a destination file and a source file are the same,
|
|
|
|
and <tt>lazy</tt> is true, the JAR is only signed if it does not
|
2005-03-23 14:09:06 +00:00
|
|
|
contain a signature by this alias.</li>
|
2005-03-22 17:36:58 +00:00
|
|
|
<li>If a destination file and a source file are the same,
|
|
|
|
and <tt>lazy</tt> is false, the JAR is signed.</li>
|
|
|
|
</ul>
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Parameters</h3>
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">jar</td>
|
|
|
|
<td valign="top">the jar file to sign</td>
|
2005-11-29 04:45:43 +00:00
|
|
|
<td valign="top" align="center">Yes, unless nested paths have
|
2003-04-10 06:37:57 +00:00
|
|
|
been used.</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">alias</td>
|
|
|
|
<td valign="top">the alias to sign under</td>
|
|
|
|
<td valign="top" align="center">Yes.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">storepass</td>
|
|
|
|
<td valign="top">password for keystore integrity.</td>
|
|
|
|
<td valign="top" align="center">Yes.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">keystore</td>
|
|
|
|
<td valign="top">keystore location</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">storetype</td>
|
|
|
|
<td valign="top">keystore type</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">keypass</td>
|
|
|
|
<td valign="top">password for private key (if different)</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">sigfile</td>
|
|
|
|
<td valign="top">name of .SF/.DSA file</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">signedjar</td>
|
2005-03-22 17:36:58 +00:00
|
|
|
<td valign="top">name of signed JAR file. This can only be set when
|
|
|
|
the <tt>jar</tt> attribute is set.</td>
|
|
|
|
<td valign="top" align="center">No.</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">verbose</td>
|
|
|
|
<td valign="top">(true | false) verbose output when signing</td>
|
2001-12-12 06:59:31 +00:00
|
|
|
<td valign="top" align="center">No; default false</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">internalsf</td>
|
|
|
|
<td valign="top">(true | false) include the .SF file inside the signature
|
|
|
|
block</td>
|
2001-12-12 06:59:31 +00:00
|
|
|
<td valign="top" align="center">No; default false</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">sectionsonly</td>
|
|
|
|
<td valign="top">(true | false) don't compute hash of entire manifest</td>
|
2001-12-12 06:59:31 +00:00
|
|
|
<td valign="top" align="center">No; default false</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
2001-12-12 06:59:31 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">lazy</td>
|
|
|
|
<td valign="top">flag to control whether the presence of a signature
|
2005-03-22 17:36:58 +00:00
|
|
|
file means a JAR is signed. This is only used when the target JAR matches
|
|
|
|
the source JAR</td>
|
2001-12-12 06:59:31 +00:00
|
|
|
<td valign="top" align="center">No; default false</td>
|
2002-12-23 13:29:16 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">maxmemory</td>
|
|
|
|
<td valign="top">Specifies the maximum memory the jarsigner VM will use. Specified in the
|
|
|
|
style of standard java memory specs (e.g. 128m = 128 MBytes)</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
2004-11-26 09:52:06 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">preservelastmodified</td>
|
2005-03-22 17:36:58 +00:00
|
|
|
<td valign="top">Give the signed files the same last modified
|
|
|
|
time as the original jar files.</td>
|
2004-11-26 09:52:06 +00:00
|
|
|
<td valign="top" align="center">No; default false.</td>
|
|
|
|
</tr>
|
2005-03-23 15:06:48 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">tsaurl</td>
|
|
|
|
<td valign="top">URL for a timestamp authority for timestamped
|
|
|
|
JAR files in Java1.5+</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">tsacert</td>
|
|
|
|
<td valign="top">alias in the keystore for a timestamp authority for
|
|
|
|
timestamped JAR files in Java1.5+</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
2008-09-19 15:28:34 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">executable</td>
|
|
|
|
<td valign="top">Specify a particular <code>jarsigner</code> executable
|
|
|
|
to use in place of the default binary (found in the same JDK as
|
|
|
|
Ant is running in).<br/>
|
|
|
|
Must support the same command line options as the Sun JDK
|
|
|
|
jarsigner command.
|
|
|
|
<em>since Ant 1.8.0</em>.</td>
|
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
2009-04-09 14:17:38 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">force</td>
|
|
|
|
<td valign="top">Whether to force signing of the jar file even if
|
|
|
|
it doesn't seem to be out of date or already signed.
|
|
|
|
<em>since Ant 1.8.0</em>.</td>
|
|
|
|
<td align="center" valign="top">No; default false</td>
|
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
</table>
|
2001-12-12 06:59:31 +00:00
|
|
|
<h3>Parameters as nested elements</h3>
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
2005-11-29 04:45:43 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">path</td>
|
|
|
|
<td valign="top">path of JAR files to sign. <em>since Ant 1.7</em></td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
2001-12-12 06:59:31 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">fileset</td>
|
2005-03-22 17:36:58 +00:00
|
|
|
<td valign="top">fileset of JAR files to sign. </td>
|
2001-12-12 06:59:31 +00:00
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
2005-03-22 17:36:58 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">mapper</td>
|
|
|
|
<td valign="top">A mapper to rename jar files during signing</td>
|
|
|
|
<td valign="top" align="center">No, and only one can be supplied</td>
|
|
|
|
</tr>
|
2005-03-24 15:01:30 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">sysproperty</td>
|
|
|
|
<td valign="top">JVM system properties, with the syntax of Ant
|
|
|
|
<a href="exec.html#env">environment variables</a> </td>
|
|
|
|
<td valign="top" align="center">No, and only one can be supplied</td>
|
|
|
|
</tr>
|
2005-03-22 17:36:58 +00:00
|
|
|
</table>
|
2005-03-24 15:01:30 +00:00
|
|
|
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Examples</h3>
|
2005-03-09 17:26:03 +00:00
|
|
|
<blockquote><pre>
|
|
|
|
<signjar jar="${dist}/lib/ant.jar"
|
|
|
|
alias="apache-group" storepass="secret"/>
|
|
|
|
</pre></blockquote>
|
|
|
|
<p>
|
|
|
|
signs the ant.jar with alias "apache-group" accessing the
|
|
|
|
keystore and private key via "secret" password.
|
|
|
|
</p>
|
2005-03-24 15:01:30 +00:00
|
|
|
<blockquote><pre>
|
|
|
|
<signjar destDir="signed"
|
|
|
|
alias="testonly" keystore="testkeystore"
|
|
|
|
storepass="apacheant"
|
|
|
|
preservelastmodified="true">
|
2005-11-29 04:45:43 +00:00
|
|
|
<path>
|
|
|
|
<fileset dir="dist" includes="**/*.jar" />
|
|
|
|
</path>
|
2005-03-24 15:01:30 +00:00
|
|
|
<flattenmapper />
|
|
|
|
</signjar>
|
|
|
|
</pre></blockquote>
|
|
|
|
<p>
|
|
|
|
Sign all JAR files matching the dist/**/*.jar pattern, copying them to the
|
|
|
|
directory "signed" afterwards. The flatten mapper means that they will
|
|
|
|
all be copied to this directory, not to subdirectories.
|
2005-03-23 15:06:48 +00:00
|
|
|
|
2005-03-24 15:01:30 +00:00
|
|
|
</p>
|
|
|
|
<blockquote><pre>
|
|
|
|
<signjar
|
|
|
|
alias="testonly" keystore="testkeystore"
|
|
|
|
storepass="apacheant"
|
|
|
|
lazy="true"
|
|
|
|
>
|
2005-11-29 04:45:43 +00:00
|
|
|
<path>
|
|
|
|
<fileset dir="dist" includes="**/*.jar" />
|
|
|
|
</path>
|
2005-03-24 15:01:30 +00:00
|
|
|
</signjar>
|
|
|
|
</pre></blockquote>
|
|
|
|
<p>
|
|
|
|
Sign all the JAR files in dist/**/*.jar <i>in-situ</i>. Lazy signing is used,
|
|
|
|
so the files will only be signed if they are not already signed.
|
|
|
|
</p>
|
2005-03-23 15:06:48 +00:00
|
|
|
<h3>About timestamp signing</h3>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Timestamped JAR files are a new feature in Java1.5; a feature supported in Ant since
|
|
|
|
Ant 1.7. Ant does not yet support proxy setup for this singing process, and
|
|
|
|
the whole TSA feature is not tested yet. Furthermore, the
|
|
|
|
<a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/time-of-signing-beta1.html">
|
|
|
|
official TSA documentation</a>
|
|
|
|
warns that the API is subject to change. If a future version of Java changes the
|
|
|
|
API, Ant will break. It may be possible to hide changes if and when they occur,
|
|
|
|
but this can not be guaranteed.
|
|
|
|
</p>
|
|
|
|
|
2006-09-11 04:33:25 +00:00
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|