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 signature support is based on Java 8
| Modifier and Type | Field and Description |
|---|---|
| protected File | destDir
the output directory when using paths. |
| private String | digestAlg
digest algorithm |
| public static final String | ERROR_BAD_MAP
error string for unit test verification: Cannot map source file to anything sensible: |
| public static final String | ERROR_MAPPER_WITHOUT_DEST
error string for unit test verification: The destDir attribute is required if a mapper is set |
| public static final String | ERROR_NO_ALIAS
error string for unit test verification: alias attribute must be set |
| public static final String | ERROR_NO_STOREPASS
error string for unit test verification: storepass attribute must be set |
| public static final String | ERROR_SIGNEDJAR_AND_PATHS
error string for unit test verification You cannot specify the signed JAR when using paths or filesets |
| public static final String | ERROR_TODIR_AND_SIGNEDJAR
error string for unit test verification: \'destdir\' and \'signedjar\' cannot both be set |
| public static final String | ERROR_TOO_MANY_MAPPERS
error string for unit test verification: Too many mappers |
| private static final FileUtils | |
| private boolean | force
force signing even if the jar is already signed. |
| 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. |
| private FileNameMapper | mapper
mapper for todir work |
| private boolean | preserveLastModified
flag to preserve timestamp on modified files |
| protected boolean | sectionsonly
sign sections only? |
| private String | sigAlg
signature algorithm |
| 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 |
| private String | tsaDigestAlg
tsa digest algorithm |
| protected String | tsaproxyhost
Proxy host to be used when connecting to TSA server |
| protected String | tsaproxyport
Proxy port to be used when connecting to TSA server |
| protected String | tsaurl
URL for a tsa; null implies no tsa support |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private void | |
| private void | addTimestampAuthorityCommands(final ExecTask
the exec task. cmd)If the tsa parameters are set, this passes them to the command. |
| public void | |
| public String | |
| public FileNameMapper | |
| public String | |
| public String | |
| public String | |
| public String | |
| public String | |
| public String | |
| public boolean | |
| protected boolean | |
| protected boolean | Returns: true if the signedjarFile is considered up to datethe unsigned jar file jarFile, File the result signed jar file signedjarFile)Compare a jar file with its corresponding signed jar. |
| public void | setDestDir(File
the directory in which to place signed jars destDir)Optionally sets the output directory to be used. |
| public void | |
| public void | |
| public void | setInternalsf(final boolean
if true include the .SF file inside the signature internalsf)Flag to include the .SF file inside the signature; optional; default false |
| public void | setLazy(final boolean
flag to control whether the presence of a signature lazy)flag to control whether the presence of a signature file means a JAR is signed; optional, default false |
| public void | setPreserveLastModified(boolean
if true preserve the last modified time preserveLastModified)true to indicate that the signed jar modification date remains the same as the original. |
| public void | setSectionsonly(final boolean
flag to compute hash of entire manifest sectionsonly)flag to compute hash of entire manifest; optional, default false |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| private void |
| destDir | back to summary |
|---|---|
| protected File destDir the output directory when using paths. | |
| digestAlg | back to summary |
|---|---|
| private String digestAlg digest algorithm | |
| ERROR_BAD_MAP | back to summary |
|---|---|
| public static final String ERROR_BAD_MAP error string for unit test verification: Cannot map source file to anything sensible: | |
| ERROR_MAPPER_WITHOUT_DEST | back to summary |
|---|---|
| public static final String ERROR_MAPPER_WITHOUT_DEST error string for unit test verification: The destDir attribute is required if a mapper is set | |
| ERROR_NO_ALIAS | back to summary |
|---|---|
| public static final String ERROR_NO_ALIAS error string for unit test verification: alias attribute must be set | |
| ERROR_NO_STOREPASS | back to summary |
|---|---|
| public static final String ERROR_NO_STOREPASS error string for unit test verification: storepass attribute must be set | |
| ERROR_SIGNEDJAR_AND_PATHS | back to summary |
|---|---|
| public static final String ERROR_SIGNEDJAR_AND_PATHS error string for unit test verification You cannot specify the signed JAR when using paths or filesets | |
| ERROR_TODIR_AND_SIGNEDJAR | back to summary |
|---|---|
| public static final String ERROR_TODIR_AND_SIGNEDJAR error string for unit test verification: \'destdir\' and \'signedjar\' cannot both be set | |
| ERROR_TOO_MANY_MAPPERS | back to summary |
|---|---|
| public static final String ERROR_TOO_MANY_MAPPERS error string for unit test verification: Too many mappers | |
| FILE_UTILS | back to summary |
|---|---|
| private static final FileUtils FILE_UTILS | |
| force | back to summary |
|---|---|
| private boolean force force signing even if the jar is already signed. | |
| internalsf | back to summary |
|---|---|
| protected boolean internalsf flag for internal sf signing | |
| lazy | back to summary |
|---|---|
| protected boolean lazy Whether to assume a jar which has an appropriate .SF file in is already signed. | |
| mapper | back to summary |
|---|---|
| private FileNameMapper mapper mapper for todir work | |
| preserveLastModified | back to summary |
|---|---|
| private boolean preserveLastModified flag to preserve timestamp on modified files | |
| sectionsonly | back to summary |
|---|---|
| protected boolean sectionsonly sign sections only? | |
| sigAlg | back to summary |
|---|---|
| private String sigAlg signature algorithm | |
| sigfile | back to summary |
|---|---|
| protected String sigfile name to a signature file | |
| signedjar | back to summary |
|---|---|
| protected File signedjar name of a single jar | |
| tsacert | back to summary |
|---|---|
| protected String tsacert alias for the TSA in the keystore | |
| tsaDigestAlg | back to summary |
|---|---|
| private String tsaDigestAlg tsa digest algorithm | |
| tsaproxyhost | back to summary |
|---|---|
| protected String tsaproxyhost Proxy host to be used when connecting to TSA server | |
| tsaproxyport | back to summary |
|---|---|
| protected String tsaproxyport Proxy port to be used when connecting to TSA server | |
| tsaurl | back to summary |
|---|---|
| protected String tsaurl URL for a tsa; null implies no tsa support | |
| SignJar | back to summary |
|---|---|
| public SignJar() | |
| add | back to summary |
|---|---|
| public void add(FileNameMapper newMapper) add a mapper to determine file naming policy. Only used with toDir processing.
| |
| addProxyFor | back to summary |
|---|---|
| private void addProxyFor(final ExecTask cmd, final String scheme) | |
| addTimestampAuthorityCommands | back to summary |
|---|---|
| private void addTimestampAuthorityCommands(final ExecTask cmd) If the tsa parameters are set, this passes them to the command. There is no validation of java version, as third party JDKs may implement this on earlier/later jarsigner implementations.
| |
| execute | back to summary |
|---|---|
| public void execute() throws BuildException Overrides org. sign the jar(s)
| |
| getDigestAlg | back to summary |
|---|---|
| public String getDigestAlg() Digest Algorithm; optional
| |
| getMapper | back to summary |
|---|---|
| public FileNameMapper getMapper() get the active mapper; may be null
| |
| getSigAlg | back to summary |
|---|---|
| public String getSigAlg() Signature Algorithm; optional
| |
| getTsacert | back to summary |
|---|---|
| public String getTsacert() get the -tsacert option
| |
| getTSADigestAlg | back to summary |
|---|---|
| public String getTSADigestAlg() TSA Digest Algorithm; optional
| |
| getTsaproxyhost | back to summary |
|---|---|
| public String getTsaproxyhost() Get the proxy host to be used when connecting to the TSA url
| |
| getTsaproxyport | back to summary |
|---|---|
| public String getTsaproxyport() Get the proxy host to be used when connecting to the TSA url
| |
| getTsaurl | back to summary |
|---|---|
| public String getTsaurl() get the -tsaurl url
| |
| isForce | back to summary |
|---|---|
| public boolean isForce() Should the task force signing of a jar even it is already signed?
| |
| isSigned | back to summary |
|---|---|
| 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.
| |
| isUpToDate | back to summary |
|---|---|
| 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 doesn't exist, or the destfile has an out of date timestamp, then the return value is false. If we are signing ourself, the check | |
| setDestDir | back to summary |
|---|---|
| public void setDestDir(File destDir) Optionally sets the output directory to be used.
| |
| setDigestAlg | back to summary |
|---|---|
| public void setDigestAlg(String digestAlg) Digest Algorithm; optional
| |
| setForce | back to summary |
|---|---|
| public void setForce(boolean b) Whether to force signing of a jar even it is already signed.
| |
| setInternalsf | back to summary |
|---|---|
| public void setInternalsf(final boolean internalsf) Flag to include the .SF file inside the signature; optional; default false
| |
| setLazy | back to summary |
|---|---|
| public void setLazy(final boolean lazy) flag to control whether the presence of a signature file means a JAR is signed; optional, default false
| |
| setPreserveLastModified | back to summary |
|---|---|
| public void setPreserveLastModified(boolean preserveLastModified) true to indicate that the signed jar modification date remains the same as the original. Defaults to false
| |
| setSectionsonly | back to summary |
|---|---|
| public void setSectionsonly(final boolean sectionsonly) flag to compute hash of entire manifest; optional, default false
| |
| setSigAlg | back to summary |
|---|---|
| public void setSigAlg(String sigAlg) Signature Algorithm; optional
| |
| setSigfile | back to summary |
|---|---|
| public void setSigfile(final String sigfile) name of .SF/.DSA file; optional
| |
| setSignedjar | back to summary |
|---|---|
| public void setSignedjar(final File signedjar) name of signed JAR file; optional
| |
| setTsacert | back to summary |
|---|---|
| public void setTsacert(String tsacert) set the alias in the keystore of the TSA to use;
| |
| setTSADigestAlg | back to summary |
|---|---|
| public void setTSADigestAlg(String digestAlg) TSA Digest Algorithm; optional
| |
| setTsaproxyhost | back to summary |
|---|---|
public void setTsaproxyhost(String tsaproxyhost)
| |
| setTsaproxyport | back to summary |
|---|---|
public void setTsaproxyport(String tsaproxyport)
| |
| setTsaurl | back to summary |
|---|---|
public void setTsaurl(String tsaurl)
| |
| signOneJar | back to summary |
|---|---|
| private void signOneJar(File jarSource, File jarTarget) throws BuildException Sign one jar.
The signing only takes place if
| |