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

UNKNOWN: category="java"

Field Summary
protected Stringalias
The alias of signer.
protected Vectorfilesets
the filesets of the jars to sign
protected booleaninternalsf
protected Filejar
The name of the jar file.
protected Stringkeypass
protected booleanlazy
Whether to assume a jar which has an appropriate .SF file in is already signed.
protected booleansectionsonly
protected Stringsigfile
protected Filesignedjar
protected Stringstorepass
protected Stringstoretype
protected booleanverbose
Method Summary
voidaddFileset(FileSet set)
Adds a set of files to sign
voidexecute()
sign the jar(s)
protected booleanisSigned(File file)
test for a file being signed, by looking for a signature in the META-INF directory
protected booleanisUpToDate(File jarFile, File signedjarFile)
voidsetAlias(String alias)
the alias to sign under; required
voidsetInternalsf(boolean internalsf)
Flag to include the .SF file inside the signature; optional; default false
voidsetJar(File jar)
the jar file to sign; required
voidsetKeypass(String keypass)
password for private key (if different); optional
voidsetKeystore(String keystore)
keystore location; required
voidsetLazy(boolean lazy)
flag to control whether the presence of a signature file means a JAR is signed; optional, default false
voidsetMaxmemory(String max)
Set the maximum memory to be used by the jarsigner process
voidsetSectionsonly(boolean sectionsonly)
flag to compute hash of entire manifest; optional, default false
voidsetSigfile(String sigfile)
name of .SF/.DSA file; optional
voidsetSignedjar(File signedjar)
name of signed JAR file; optional
voidsetStorepass(String storepass)
password for keystore integrity; required
voidsetStoretype(String storetype)
keystore type; optional
voidsetVerbose(boolean verbose)
Enable verbose output when signing ; optional: default false

Field Detail

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 Detail

addFileset

public void addFileset(FileSet set)
Adds a set of files to sign

Since: Ant 1.4

execute

public void execute()
sign the jar(s)

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