public class SignJar
extends org.apache.tools.ant.taskdefs.AbstractJarSignerTask
| Modifier and Type | Class and Description |
|---|---|
static class |
SignJar.JarConfigResolved |
static class |
SignJar.JarsConfig |
static interface |
SignJar.SigningListener |
| Modifier and Type | Field and Description |
|---|---|
protected File |
destDir
the output directory when using paths.
|
static String |
ERROR_BAD_MAP
error string for unit test verification: "Cannot map source file to anything sensible: "
|
static String |
ERROR_MAPPER_WITHOUT_DEST
error string for unit test verification: "The destDir attribute is required if a mapper is set"
|
static String |
ERROR_NO_ALIAS
error string for unit test verification: "alias attribute must be set"
|
static String |
ERROR_NO_STOREPASS
error string for unit test verification: "storepass attribute must be set"
|
static String |
ERROR_SIGNEDJAR_AND_PATHS
error string for unit test verification "You cannot specify the signed JAR when using paths or filesets"
|
static String |
ERROR_TODIR_AND_SIGNEDJAR
error string for unit test verification: "\'destdir\' and \'signedjar\' cannot both be set"
|
static String |
ERROR_TOO_MANY_MAPPERS
error string for unit test verification: "Too many mappers"
|
protected boolean |
internalsf
flag for internal sf signing
|
protected boolean |
lazy
Whether to assume a jar which has an appropriate .SF file in is already
signed.
|
protected boolean |
sectionsonly
sign sections only?
|
protected String |
sigfile
name to a signature file
|
protected File |
signedjar
name of a single jar
|
protected String |
tsacert
alias for the TSA in the keystore
|
protected String |
tsaurl
URL for a tsa; null implies no tsa support
|
| Constructor and Description |
|---|
SignJar() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(org.apache.tools.ant.util.FileNameMapper newMapper)
add a mapper to determine file naming policy.
|
void |
execute()
sign the jar(s)
|
File |
getBasedir() |
String |
getDigestAlg()
Digest Algorithm; optional
|
List<org.apache.tools.ant.taskdefs.Property> |
getExtraManifestAttributes() |
SignJar.SigningListener |
getJarListener() |
List<SignJar.JarsConfig> |
getJarsConfigs() |
org.apache.tools.ant.util.FileNameMapper |
getMapper()
get the active mapper; may be null
|
Integer |
getPack200Effort() |
String |
getSigAlg()
Signature Algorithm; optional
|
String |
getTsacert()
get the -tsacert option
|
String |
getTsaurl()
get the -tsaurl url
|
boolean |
isDestFlatten() |
boolean |
isForce()
Should the task force signing of a jar even it is already
signed?
|
boolean |
isPack200() |
protected boolean |
isSigned(File file)
test for a file being signed, by looking for a signature in the META-INF
directory with our alias/sigfile.
|
boolean |
isUnsignFirst() |
protected boolean |
isUpToDate(File jarFile,
File signedjarFile)
Compare a jar file with its corresponding signed jar.
|
void |
setBasedir(File basedir) |
void |
setDestDir(File destDir)
Optionally sets the output directory to be used.
|
void |
setDestFlatten(boolean destFlatten) |
void |
setDigestAlg(String digestAlg)
Digest Algorithm; optional
|
void |
setExtraManifestAttributes(List<org.apache.tools.ant.taskdefs.Property> extraManifestAttributes) |
void |
setForce(boolean b)
Whether to force signing of a jar even it is already signed.
|
void |
setInternalsf(boolean internalsf)
Flag to include the .SF file inside the signature; optional; default
false
|
void |
setJarsConfigs(List<SignJar.JarsConfig> jarsConfigs) |
void |
setLazy(boolean lazy)
flag to control whether the presence of a signature file means a JAR is
signed; optional, default false
|
void |
setPack200(boolean pack200) |
void |
setPack200Effort(Integer pack200Effort) |
void |
setPreserveLastModified(boolean preserveLastModified)
true to indicate that the signed jar modification date remains the same
as the original.
|
void |
setRetryCount(int retryCount) |
void |
setSectionsonly(boolean sectionsonly)
flag to compute hash of entire manifest; optional, default false
|
void |
setSigAlg(String sigAlg)
Signature Algorithm; optional
|
void |
setSigfile(String sigfile)
name of .SF/.DSA file; optional
|
void |
setSignedjar(File signedjar)
name of signed JAR file; optional
|
void |
setSigningListener(SignJar.SigningListener jarListener) |
void |
setTsacert(String tsacert)
set the alias in the keystore of the TSA to use;
|
void |
setTsaurl(String tsaurl) |
void |
setUnsignFirst(boolean unsignFirst) |
addFileset, addSysproperty, addValue, beginExecution, bindToKeystore, createJarSigner, createPath, createUnifiedSourcePath, createUnifiedSources, declareSysProperty, endExecution, getRedirector, hasResources, setAlias, setCommonOptions, setExecutable, setJar, setKeypass, setKeystore, setMaxmemory, setStorepass, setStoretype, setStrict, setVerbosebindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeprotected String sigfile
protected File signedjar
protected boolean internalsf
protected boolean sectionsonly
protected boolean lazy
protected File destDir
protected String tsaurl
protected String tsacert
public static final String ERROR_TODIR_AND_SIGNEDJAR
public static final String ERROR_TOO_MANY_MAPPERS
public static final String ERROR_SIGNEDJAR_AND_PATHS
public static final String ERROR_BAD_MAP
public static final String ERROR_MAPPER_WITHOUT_DEST
public static final String ERROR_NO_ALIAS
public static final String ERROR_NO_STOREPASS
public void setSigningListener(SignJar.SigningListener jarListener)
public SignJar.SigningListener getJarListener()
public void setRetryCount(int retryCount)
public void setSigfile(String sigfile)
sigfile - the name of the .SF/.DSA filepublic void setSignedjar(File signedjar)
signedjar - the name of the signed jar filepublic void setInternalsf(boolean internalsf)
internalsf - if true include the .SF file inside the signaturepublic void setSectionsonly(boolean sectionsonly)
sectionsonly - flag to compute hash of entire manifestpublic void setLazy(boolean lazy)
lazy - flag to control whether the presence of a signaturepublic void setDestDir(File destDir)
destDir - the directory in which to place signed jarspublic void add(org.apache.tools.ant.util.FileNameMapper newMapper)
newMapper - the mapper to add.public org.apache.tools.ant.util.FileNameMapper getMapper()
public String getTsaurl()
public void setTsaurl(String tsaurl)
tsaurl - the tsa url.public String getTsacert()
public void setTsacert(String tsacert)
tsacert - the cert alias.public void setForce(boolean b)
public boolean isForce()
public void setSigAlg(String sigAlg)
sigAlg - the signature algorithmpublic String getSigAlg()
public void setDigestAlg(String digestAlg)
digestAlg - the digest algorithmpublic String getDigestAlg()
public boolean isUnsignFirst()
public void setUnsignFirst(boolean unsignFirst)
public List<org.apache.tools.ant.taskdefs.Property> getExtraManifestAttributes()
public void setExtraManifestAttributes(List<org.apache.tools.ant.taskdefs.Property> extraManifestAttributes)
public List<SignJar.JarsConfig> getJarsConfigs()
public void setJarsConfigs(List<SignJar.JarsConfig> jarsConfigs)
public File getBasedir()
public void setBasedir(File basedir)
public boolean isDestFlatten()
public void setDestFlatten(boolean destFlatten)
public boolean isPack200()
public void setPack200(boolean pack200)
public Integer getPack200Effort()
public void setPack200Effort(Integer pack200Effort)
public void execute()
throws org.apache.tools.ant.BuildException
execute in class org.apache.tools.ant.Taskorg.apache.tools.ant.BuildException - on errorsprotected boolean isUpToDate(File jarFile, File signedjarFile)
isSigned(File) is used to
trigger the process.jarFile - the unsigned jar filesignedjarFile - the result signed jar fileprotected boolean isSigned(File file)
file - the file to be checkedIsSigned.isSigned(File, String)public void setPreserveLastModified(boolean preserveLastModified)
preserveLastModified - if true preserve the last modified timeCopyright © 2013–2015 Codehaus. All rights reserved.