org.apache.tools.ant.taskdefs
Class SignJar
- Cloneable
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.
Timestamp driven signing is based on the unstable and inadequately documented
information in the Java1.5 docs
ERROR_NO_SOURCE , JARSIGNER_COMMAND , alias , filesets , jar , keypass , keystore , maxMemory , storepass , storetype , verbose |
void | add(FileNameMapper newMapper) - add a mapper to determine file naming policy.
|
void | execute() - sign the jar(s)
|
FileNameMapper | getMapper() - get the active mapper; may be null
|
String | getTsacert() - get the -tsacert option
|
String | getTsaurl() - get the -tsaurl url
|
protected boolean | isSigned(File file) - test for a file being signed, by looking for a signature in the META-INF
directory with our alias.
|
protected boolean | isUpToDate(File jarFile, File signedjarFile) - Compare a jar file with its corresponding signed jar.
|
void | setDestDir(File destDir) - Optionally sets the output directory to be used.
|
void | setInternalsf(boolean internalsf) - Flag to include the .SF file inside the signature; optional; default
false
|
void | setLazy(boolean lazy) - flag to control whether the presence of a signature file means a JAR is
signed; optional, default false
|
void | setPreserveLastModified(boolean preserveLastModified) - true to indicate that the signed jar modification date remains the same
as the original.
|
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 | setTsacert(String tsacert) - set the alias in the keystore of the TSA to use;
|
void | setTsaurl(String tsaurl)
|
addFileset , addSysproperty , addValue , beginExecution , bindToKeystore , createJarSigner , createPath , createUnifiedSourcePath , createUnifiedSources , declareSysProperty , endExecution , getRedirector , hasResources , setAlias , setCommonOptions , setJar , setKeypass , setKeystore , setMaxmemory , setStorepass , setStoretype , setVerbose |
bindToOwner , execute , getOwningTarget , getRuntimeConfigurableWrapper , getTaskName , getTaskType , getWrapper , handleErrorFlush , handleErrorOutput , handleFlush , handleInput , handleOutput , init , isInvalid , log , log , log , log , maybeConfigure , perform , reconfigure , setOwningTarget , setRuntimeConfigurableWrapper , setTaskName , setTaskType |
ERROR_BAD_MAP
public static final String ERROR_BAD_MAP
error string for unit test verification:
ERROR_MAPPER_WITHOUT_DEST
public static final String ERROR_MAPPER_WITHOUT_DEST
error string for unit test verification:
ERROR_NO_ALIAS
public static final String ERROR_NO_ALIAS
error string for unit test verification:
ERROR_NO_STOREPASS
public static final String ERROR_NO_STOREPASS
error string for unit test verification:
ERROR_SIGNEDJAR_AND_PATHS
public static final String ERROR_SIGNEDJAR_AND_PATHS
error string for unit test verification
ERROR_TODIR_AND_SIGNEDJAR
public static final String ERROR_TODIR_AND_SIGNEDJAR
error string for unit test verification:
ERROR_TOO_MANY_MAPPERS
public static final String ERROR_TOO_MANY_MAPPERS
error string for unit test verification:
destDir
protected File destDir
the output directory when using paths.
internalsf
protected boolean internalsf
flag for internal sf signing
lazy
protected boolean lazy
Whether to assume a jar which has an appropriate .SF file in is already
signed.
sectionsonly
protected boolean sectionsonly
sign sections only?
sigfile
protected String sigfile
name to a signature file
signedjar
protected File signedjar
name of a single jar
tsacert
protected String tsacert
alias for the TSA in the keystore
tsaurl
protected String tsaurl
URL for a tsa; null implies no tsa support
add
public void add(FileNameMapper newMapper)
add a mapper to determine file naming policy. Only used with toDir
processing.
newMapper
- the mapper to add.
getMapper
public FileNameMapper getMapper()
get the active mapper; may be null
getTsacert
public String getTsacert()
get the -tsacert option
- a certificate alias or null
getTsaurl
public String getTsaurl()
get the -tsaurl url
isSigned
protected boolean isSigned(File file)
test for a file being signed, by looking for a signature in the META-INF
directory with our alias.
file
- the file to be checked
- true if the file is signed
isUpToDate
protected boolean isUpToDate(File jarFile,
File signedjarFile)
Compare a jar file with its corresponding signed jar. The logic for this
is complex, and best explained in the source itself. Essentially if
either file doesnt exist, or the destfile has an out of date timestamp,
then the return value is false.
If we are signing ourself, the check
isSigned(File)
is used to
trigger the process.
jarFile
- the unsigned jar filesignedjarFile
- the result signed jar file
- true if the signedjarFile is considered up to date
setDestDir
public void setDestDir(File destDir)
Optionally sets the output directory to be used.
destDir
- the directory in which to place signed jars
setInternalsf
public void setInternalsf(boolean internalsf)
Flag to include the .SF file inside the signature; optional; default
false
internalsf
- if true include the .SF file inside the signature
setLazy
public void setLazy(boolean lazy)
flag to control whether the presence of a signature file means a JAR is
signed; optional, default false
lazy
- flag to control whether the presence of a signature
setPreserveLastModified
public void setPreserveLastModified(boolean preserveLastModified)
true to indicate that the signed jar modification date remains the same
as the original. Defaults to false
preserveLastModified
- if true preserve the last modified time
setSectionsonly
public void setSectionsonly(boolean sectionsonly)
flag to compute hash of entire manifest; optional, default false
sectionsonly
- flag to compute hash of entire manifest
setSigfile
public void setSigfile(String sigfile)
name of .SF/.DSA file; optional
sigfile
- the name of the .SF/.DSA file
setSignedjar
public void setSignedjar(File signedjar)
name of signed JAR file; optional
signedjar
- the name of the signed jar file
setTsacert
public void setTsacert(String tsacert)
set the alias in the keystore of the TSA to use;
tsacert
- the cert alias.
setTsaurl
public void setTsaurl(String tsaurl)