VerifyJar (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs, class: VerifyJar

# Class VerifyJar

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.AbstractJarSignerTask
org.apache.tools.ant.taskdefs.VerifyJar

All Implemented Interfaces:
  `Cloneable`

public class VerifyJar extends AbstractJarSignerTask
JAR verification task. For every JAR passed in, we fork jarsigner to verify that it is correctly signed. This is more rigorous than just checking for the existence of a signature; the entire certification chain is tested

Since:
  Ant 1.7

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ERROR_NO_FILE`
  no file message "Not found :"
  `static final String`
  `ERROR_NO_VERIFY`
  Error output if there is a failure to verify the jar.

  ### Fields inherited from class AbstractJarSignerTask

  `alias, ERROR_NO_SOURCE, filesets, jar, JARSIGNER_COMMAND, keypass, keystore, maxMemory, storepass, storetype, strict, verbose`
  Modifier and Type
  Field
  Description
  `protected String`
  `alias`
  The alias of signer.
  `static final String`
  `ERROR_NO_SOURCE`
  error string for unit test verification: "jar must be set through jar attribute or nested filesets"
  `protected Vector<FileSet>`
  `filesets`
  the filesets of the jars to sign
  `protected File`
  `jar`
  The name of the jar file.
  `protected static final String`
  `JARSIGNER_COMMAND`
  name of JDK program we are looking for
  `protected String`
  `keypass`
  password for the key in the store
  `protected String`
  `keystore`
  The url or path of keystore file.
  `protected String`
  `maxMemory`
  The maximum amount of memory to use for Jar signer
  `protected String`
  `storepass`
  password for the store
  `protected String`
  `storetype`
  type of store,-storetype param
  `protected boolean`
  `strict`
  strict checking
  `protected boolean`
  `verbose`
  verbose output

  ### Fields inherited from class Task

  `target, taskName, taskType, wrapper`
  Modifier and Type
  Field
  Description
  `protected Target`
  `target`
  Deprecated.
  since 1.6.x.
  `protected String`
  `taskName`
  Deprecated.
  since 1.6.x.
  `protected String`
  `taskType`
  Deprecated.
  since 1.6.x.
  `protected RuntimeConfigurable`
  `wrapper`
  Deprecated.
  since 1.6.x.

  ### Fields inherited from class ProjectComponent

  `description, location, project`
  Modifier and Type
  Field
  Description
  `protected String`
  `description`
  Deprecated.
  since 1.6.x.
  `protected Location`
  `location`
  Deprecated.
  since 1.6.x.
  `protected Project`
  `project`
  Deprecated.
  since 1.6.x.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VerifyJar()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `beginExecution()`
  init processing logic; this is retained through our execution(s)
  `protected void`
  `endExecution()`
  any cleanup logic
  `void`
  `execute()`
  verify our jar files
  `void`
  `setCertificates(boolean certificates)`
  Ask for certificate information to be printed

  ### Methods inherited from class AbstractJarSignerTask

  `addArg, addArgument, addFileset, addSysproperty, addValue, bindToKeystore, createJarSigner, createPath, createUnifiedSourcePath, createUnifiedSources, declareSysProperty, getRedirector, hasResources, setAlias, setCommonOptions, setExecutable, setJar, setKeypass, setKeystore, setMaxmemory, setProviderArg, setProviderClass, setProviderName, setStorepass, setStoretype, setStrict, setVerbose`
  Modifier and Type
  Method
  Description
  `void`
  `addArg(Commandline.Argument arg)`
  Adds a nested <arg> element that can be used to specify command line arguments not supported via specific attributes.
  `protected void`
  `addArgument(ExecTask cmd, Commandline.Argument arg)`
  add an argument to a command
  `void`
  `addFileset(FileSet set)`
  Adds a set of files to sign
  `void`
  `addSysproperty(Environment.Variable sysp)`
  Add a system property.
  `protected void`
  `addValue(ExecTask cmd, String value)`
  add a value argument to a command
  `protected void`
  `bindToKeystore(ExecTask cmd)`
  bind to a keystore if the attributes are there
  `protected ExecTask`
  `createJarSigner()`
  create the jarsigner executable task
  `Path`
  `createPath()`
  Adds a path of files to sign.
  `protected Path`
  `createUnifiedSourcePath()`
  clone our path and add all explicitly specified FileSets as well, patch in the jar attribute as a new fileset if it is defined.
  `protected Vector<FileSet>`
  `createUnifiedSources()`
  clone our filesets vector, and patch in the jar attribute as a new fileset, if is defined
  `protected void`
  `declareSysProperty(ExecTask cmd, Environment.Variable property)`
  `RedirectorElement`
  `getRedirector()`
  get the redirector.
  `protected boolean`
  `hasResources()`
  Has either a path or a fileset been specified?
  `void`
  `setAlias(String alias)`
  the alias to sign under; required
  `protected void`
  `setCommonOptions(ExecTask cmd)`
  these are options common to signing and verifying
  `void`
  `setExecutable(String executable)`
  Sets the actual executable command to invoke, instead of the binary `jarsigner` found in Ant's JDK.
  `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`
  `setMaxmemory(String max)`
  Set the maximum memory to be used by the jarsigner process
  `void`
  `setProviderArg(String providerArg)`
  Sets the value for the -providerArg command line argument.
  `void`
  `setProviderClass(String providerClass)`
  Sets the value for the -providerClass command line argument.
  `void`
  `setProviderName(String providerName)`
  Sets the value for the -providerName command line argument.
  `void`
  `setStorepass(String storepass)`
  password for keystore integrity; required
  `void`
  `setStoretype(String storetype)`
  keystore type; optional
  `void`
  `setStrict(boolean strict)`
  do strict checking
  `void`
  `setVerbose(boolean verbose)`
  Enable verbose output when signing; optional: default false

  ### Methods inherited from class Task

  `bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`
  Modifier and Type
  Method
  Description
  `final void`
  `bindToOwner(Task owner)`
  Bind a task to another; use this when configuring a newly created task to do work on behalf of another.
  `Target`
  `getOwningTarget()`
  Returns the container target of this task.
  `RuntimeConfigurable`
  `getRuntimeConfigurableWrapper()`
  Returns the wrapper used for runtime configuration.
  `String`
  `getTaskName()`
  Returns the name to use in logging messages.
  `String`
  `getTaskType()`
  Return the type of task.
  `protected RuntimeConfigurable`
  `getWrapper()`
  Return the runtime configurable structure for this task.
  `protected void`
  `handleErrorFlush(String output)`
  Handles an error line by logging it with the WARN priority.
  `protected void`
  `handleErrorOutput(String output)`
  Handles an error output by logging it with the WARN priority.
  `protected void`
  `handleFlush(String output)`
  Handles output by logging it with the INFO priority.
  `protected int`
  `handleInput(byte[] buffer, int offset, int length)`
  Handle an input request by this task.
  `protected void`
  `handleOutput(String output)`
  Handles output by logging it with the INFO priority.
  `void`
  `init()`
  Called by the project to let the task initialize properly.
  `protected final boolean`
  `isInvalid()`
  Has this task been marked invalid?
  `void`
  `log(String msg)`
  Logs a message with the default (INFO) priority.
  `void`
  `log(String msg, int msgLevel)`
  Logs a message with the given priority.
  `void`
  `log(String msg, Throwable t, int msgLevel)`
  Logs a message with the given priority.
  `void`
  `log(Throwable t, int msgLevel)`
  Logs a message with the given priority.
  `void`
  `maybeConfigure()`
  Configures this task - if it hasn't been done already.
  `final void`
  `perform()`
  Performs this task if it's still valid, or gets a replacement version and performs that otherwise.
  `void`
  `reconfigure()`
  Force the task to be reconfigured from its RuntimeConfigurable.
  `void`
  `setOwningTarget(Target target)`
  Sets the target container of this task.
  `void`
  `setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper)`
  Sets the wrapper to be used for runtime configuration.
  `void`
  `setTaskName(String name)`
  Sets the name to use in logging messages.
  `void`
  `setTaskType(String type)`
  Sets the name with which the task has been invoked.

  ### Methods inherited from class ProjectComponent

  `clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`
  Modifier and Type
  Method
  Description
  `Object`
  `clone()`
  `String`
  `getDescription()`
  Returns the description of the current action.
  `Location`
  `getLocation()`
  Returns the file/location where this task was defined.
  `Project`
  `getProject()`
  Returns the project to which this component belongs.
  `void`
  `setDescription(String desc)`
  Sets a description of the current action.
  `void`
  `setLocation(Location location)`
  Sets the file/location where this task was defined.
  `void`
  `setProject(Project project)`
  Sets the project object of this component.

  ### Methods inherited from class Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### ERROR_NO_FILE

    public static final String ERROR_NO_FILE
    no file message "Not found :"
    See Also:
      - Constant Field Values

  - ### ERROR_NO_VERIFY

    public static final String ERROR_NO_VERIFY
    Error output if there is a failure to verify the jar.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### VerifyJar

    public VerifyJar()

- ## Method Details

  - ### setCertificates

    public void setCertificates(boolean certificates)
    Ask for certificate information to be printed
    Parameters:
      `certificates` - if true print certificates.

  - ### execute

    public void execute() throws BuildException
    verify our jar files
    Overrides:
      `execute` in class `Task`
    Throws:
      `BuildException` - on error.

  - ### beginExecution

    protected void beginExecution()
    Description copied from class: `AbstractJarSignerTask`
    init processing logic; this is retained through our execution(s)
    Overrides:
      `beginExecution` in class `AbstractJarSignerTask`
    Since:
      1.10.3

  - ### endExecution

    protected void endExecution()
    Description copied from class: `AbstractJarSignerTask`
    any cleanup logic
    Overrides:
      `endExecution` in class `AbstractJarSignerTask`
    Since:
      1.10.3