org.apache.tools.ant.taskdefs

Class SignJar


public class SignJar
extends Task

Signs JAR or ZIP files with the javasign command line tool. The tool detailed dependency checking: files are only signed if they are not signed. The signjar attribute can point to the file to generate; if this file exists then its modification date is used as a cue as to whether to resign any JAR file.
Since:
Ant 1.1

Field Summary

protected String
alias
The alias of signer.
protected Vector
filesets
the filesets of the jars to sign
protected boolean
internalsf
protected File
jar
The name of the jar file.
protected String
keypass
protected boolean
lazy
Whether to assume a jar which has an appropriate .SF file in is already signed.
protected boolean
sectionsonly
protected String
sigfile
protected File
signedjar
protected String
storepass
protected String
storetype
protected boolean
verbose

Fields inherited from class org.apache.tools.ant.Task

description, location, target, taskName, taskType, wrapper

Fields inherited from class org.apache.tools.ant.ProjectComponent

project

Method Summary

void
addFileset(FileSet set)
Adds a set of files to sign
void
execute()
sign the jar(s)
protected boolean
isSigned(File file)
test for a file being signed, by looking for a signature in the META-INF directory
protected boolean
isUpToDate(File jarFile, File signedjarFile)
void
setAlias(String alias)
the alias to sign under; required
void
setInternalsf(boolean internalsf)
Flag to include the .SF file inside the signature; optional; default false
void
setJar(File jar)
the jar file to sign; required
void
setKeypass(String keypass)
password for private key (if different); optional
void
setKeystore(String keystore)
keystore location; required
void
setLazy(boolean lazy)
flag to control whether the presence of a signature file means a JAR is signed; optional, default false
void
setMaxmemory(String max)
Set the maximum memory to be used by the jarsigner process
void
setSectionsonly(boolean sectionsonly)
flag to compute hash of entire manifest; optional, default false
void
setSigfile(String sigfile)
name of .SF/.DSA file; optional
void
setSignedjar(File signedjar)
name of signed JAR file; optional
void
setStorepass(String storepass)
password for keystore integrity; required
void
setStoretype(String storetype)
keystore type; optional
void
setVerbose(boolean verbose)
Enable verbose output when signing ; optional: default false

Methods inherited from class org.apache.tools.ant.Task

execute, getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

Methods inherited from class org.apache.tools.ant.ProjectComponent

getProject, log, log, setProject

Field Details

alias

protected String alias
The alias of signer.

filesets

protected Vector filesets
the filesets of the jars to sign

internalsf

protected boolean internalsf

jar

protected File jar
The name of the jar file.

keypass

protected String keypass

lazy

protected boolean lazy
Whether to assume a jar which has an appropriate .SF file in is already signed.

sectionsonly

protected boolean sectionsonly

sigfile

protected String sigfile

signedjar

protected File signedjar

storepass

protected String storepass

storetype

protected String storetype

verbose

protected boolean verbose

Method Details

addFileset

public void addFileset(FileSet set)
Adds a set of files to sign
Since:
Ant 1.4

execute

public void execute()
            throws BuildException
sign the jar(s)
Overrides:
execute in interface Task

isSigned

protected boolean isSigned(File file)
test for a file being signed, by looking for a signature in the META-INF directory
Parameters:
file -
Returns:
true if the file is signed

isUpToDate

protected boolean isUpToDate(File jarFile,
                             File signedjarFile)

setAlias

public void setAlias(String alias)
the alias to sign under; required

setInternalsf

public void setInternalsf(boolean internalsf)
Flag to include the .SF file inside the signature; optional; default false

setJar

public void setJar(File jar)
the jar file to sign; required

setKeypass

public void setKeypass(String keypass)
password for private key (if different); optional

setKeystore

public void setKeystore(String keystore)
keystore location; required

setLazy

public void setLazy(boolean lazy)
flag to control whether the presence of a signature file means a JAR is signed; optional, default false

setMaxmemory

public void setMaxmemory(String max)
Set the maximum memory to be used by the jarsigner process
Parameters:
max - a string indicating the maximum memory according to the JVM conventions (e.g. 128m is 128 Megabytes)

setSectionsonly

public void setSectionsonly(boolean sectionsonly)
flag to compute hash of entire manifest; optional, default false

setSigfile

public void setSigfile(String sigfile)
name of .SF/.DSA file; optional

setSignedjar

public void setSignedjar(File signedjar)
name of signed JAR file; optional

setStorepass

public void setStorepass(String storepass)
password for keystore integrity; required

setStoretype

public void setStoretype(String storetype)
keystore type; optional

setVerbose

public void setVerbose(boolean verbose)
Enable verbose output when signing ; optional: default false

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.