org.apache.tools.ant.taskdefs
Class GenerateKey

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.GenerateKey

public class GenerateKey
extends Task

Generates a key in a keystore.

Since:
Ant 1.2

Nested Class Summary
static class GenerateKey.DistinguishedName
           
static class GenerateKey.DnameParam
           
 
Field Summary
protected  java.lang.String alias
          The alias of signer.
protected  java.lang.String dname
           
protected  GenerateKey.DistinguishedName expandedDname
           
protected  java.lang.String keyalg
           
protected  java.lang.String keypass
           
protected  int keysize
           
protected  java.lang.String keystore
          The name of keystore file.
protected  java.lang.String sigalg
           
protected  java.lang.String storepass
           
protected  java.lang.String storetype
           
protected  int validity
           
protected  boolean verbose
           
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
GenerateKey()
           
 
Method Summary
 GenerateKey.DistinguishedName createDname()
          Distinguished name list.
 void execute()
          Called by the project to let the task do its work.
 void setAlias(java.lang.String alias)
          The alias to add under.
 void setDname(java.lang.String dname)
          The distinguished name for entity.
 void setKeyalg(java.lang.String keyalg)
          The method to use when generating name-value pair.
 void setKeypass(java.lang.String keypass)
          Password for private key (if different).
 void setKeysize(java.lang.String keysize)
          Indicates the size of key generated.
 void setKeystore(java.lang.String keystore)
          Keystore location.
 void setSigalg(java.lang.String sigalg)
          The algorithm to use in signing.
 void setStorepass(java.lang.String storepass)
          Password for keystore integrity.
 void setStoretype(java.lang.String storetype)
          Keystore type.
 void setValidity(java.lang.String validity)
          Indicates how many days certificate is valid.
 void setVerbose(boolean verbose)
          If true, verbose output when signing.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alias

protected java.lang.String alias
The alias of signer.


keystore

protected java.lang.String keystore
The name of keystore file.


storepass

protected java.lang.String storepass

storetype

protected java.lang.String storetype

keypass

protected java.lang.String keypass

sigalg

protected java.lang.String sigalg

keyalg

protected java.lang.String keyalg

dname

protected java.lang.String dname

expandedDname

protected GenerateKey.DistinguishedName expandedDname

keysize

protected int keysize

validity

protected int validity

verbose

protected boolean verbose
Constructor Detail

GenerateKey

public GenerateKey()
Method Detail

createDname

public GenerateKey.DistinguishedName createDname()
                                          throws BuildException
Distinguished name list.

Returns:
Distinguished name container.
Throws:
BuildException - If specified more than once or dname attribute is used.

setDname

public void setDname(java.lang.String dname)
The distinguished name for entity.

Parameters:
dname - distinguished name

setAlias

public void setAlias(java.lang.String alias)
The alias to add under.

Parameters:
alias - alias to add under

setKeystore

public void setKeystore(java.lang.String keystore)
Keystore location.

Parameters:
keystore - location

setStorepass

public void setStorepass(java.lang.String storepass)
Password for keystore integrity. Must be at least 6 characters long.

Parameters:
storepass - password

setStoretype

public void setStoretype(java.lang.String storetype)
Keystore type.

Parameters:
storetype - type

setKeypass

public void setKeypass(java.lang.String keypass)
Password for private key (if different).

Parameters:
keypass - password

setSigalg

public void setSigalg(java.lang.String sigalg)
The algorithm to use in signing.

Parameters:
sigalg - algorithm

setKeyalg

public void setKeyalg(java.lang.String keyalg)
The method to use when generating name-value pair.

Parameters:
keyalg - algorithm

setKeysize

public void setKeysize(java.lang.String keysize)
                throws BuildException
Indicates the size of key generated.

Parameters:
keysize - size of key
Throws:
BuildException - If not an Integer
To do:
Could convert this to a plain Integer setter.

setValidity

public void setValidity(java.lang.String validity)
                 throws BuildException
Indicates how many days certificate is valid.

Parameters:
validity - days valid
Throws:
BuildException - If not an Integer

setVerbose

public void setVerbose(boolean verbose)
If true, verbose output when signing.

Parameters:
verbose - verbose or not

execute

public void execute()
             throws BuildException
Description copied from class: Task
Called by the project to let the task do its work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 target2" will run all tasks in target3 twice.

Overrides:
execute in class Task
Throws:
BuildException - if something goes wrong with the build


Copyright 2000-2005 Apache Software Foundation. All Rights Reserved.