Top Description Inners Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class GenerateKey

extends Task
Class Inheritance
Imports
java.util.Collections, .Enumeration, .List, .Vector, java.util.stream.Collectors, org.apache.tools.ant.BuildException, .Task, org.apache.tools.ant.types.Commandline, org.apache.tools.ant.util.JavaEnvUtils

Generates a key in a keystore.
Since
Ant 1.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
GenerateKey.DistinguishedName

A class corresponding to the dname nested element.

public static class
GenerateKey.DnameParam

A DistinguishedName parameter.

Field Summary

Modifier and TypeField and Description
protected String
alias

The alias of signer.

protected String
protected GenerateKey.DistinguishedName
protected String
protected String
protected int
protected String
keystore

The name of keystore file.

protected String
protected String
protected String
protected String
protected int
protected boolean
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public GenerateKey.DistinguishedName

Returns:

Distinguished name container.
createDname
()

Distinguished name list.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Execute the task.
public void
setAlias(final String
alias to add under
alias
)

The alias to add under.

public void
setDname(final String
distinguished name
dname
)

The distinguished name for entity.

public void
setKeyalg(final String
algorithm
keyalg
)

The method to use when generating name-value pair.

public void
setKeypass(final String
password
keypass
)

Password for private key (if different).

public void
setKeysize(final String
size of key
keysize
)

Indicates the size of key generated.

public void
setKeystore(final String
location
keystore
)

Keystore location.

public void
setSaname(final String
subject alternative name
saname
)

The subject alternative name for entity.

public void
setSigalg(final String
algorithm
sigalg
)

The algorithm to use in signing.

public void
setStorepass(final String
password
storepass
)

Password for keystore integrity.

public void
setStoretype(final String
type
storetype
)

Keystore type.

public void
setValidity(final String
days valid
validity
)

Indicates how many days certificate is valid.

public void
setVerbose(final boolean
verbose or not
verbose
)

If true, verbose output when signing.

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

aliasback to summary
protected String alias

The alias of signer.

dnameback to summary
protected String dname
expandedDnameback to summary
protected GenerateKey.DistinguishedName expandedDname
keyalgback to summary
protected String keyalg
keypassback to summary
protected String keypass
keysizeback to summary
protected int keysize
keystoreback to summary
protected String keystore

The name of keystore file.

sanameback to summary
protected String saname
sigalgback to summary
protected String sigalg
storepassback to summary
protected String storepass
storetypeback to summary
protected String storetype
validityback to summary
protected int validity
verboseback to summary
protected boolean verbose

Constructor Detail

GenerateKeyback to summary
public GenerateKey()

Method Detail

createDnameback to summary
public GenerateKey.DistinguishedName createDname() throws BuildException

Distinguished name list.

Returns:GenerateKey.DistinguishedName

Distinguished name container.

Exceptions
BuildException:
If specified more than once or dname attribute is used.
executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Execute the task.

Annotations
@Override
Exceptions
BuildException:
on error
setAliasback to summary
public void setAlias(final String alias)

The alias to add under.

Parameters
alias:String

alias to add under

setDnameback to summary
public void setDname(final String dname)

The distinguished name for entity.

Parameters
dname:String

distinguished name

setKeyalgback to summary
public void setKeyalg(final String keyalg)

The method to use when generating name-value pair.

Parameters
keyalg:String

algorithm

setKeypassback to summary
public void setKeypass(final String keypass)

Password for private key (if different).

Parameters
keypass:String

password

setKeysizeback to summary
public void setKeysize(final String keysize) throws BuildException

Indicates the size of key generated.

Parameters
keysize:String

size of key

Exceptions
BuildException:
If not an Integer
setKeystoreback to summary
public void setKeystore(final String keystore)

Keystore location.

Parameters
keystore:String

location

setSanameback to summary
public void setSaname(final String saname)

The subject alternative name for entity.

Parameters
saname:String

subject alternative name

Since
Ant 1.9.14
setSigalgback to summary
public void setSigalg(final String sigalg)

The algorithm to use in signing.

Parameters
sigalg:String

algorithm

setStorepassback to summary
public void setStorepass(final String storepass)

Password for keystore integrity. Must be at least 6 characters long.

Parameters
storepass:String

password

setStoretypeback to summary
public void setStoretype(final String storetype)

Keystore type.

Parameters
storetype:String

type

setValidityback to summary
public void setValidity(final String validity) throws BuildException

Indicates how many days certificate is valid.

Parameters
validity:String

days valid

Exceptions
BuildException:
If not an Integer
setVerboseback to summary
public void setVerbose(final boolean verbose)

If true, verbose output when signing.

Parameters
verbose:boolean

verbose or not

org.apache.tools.ant.taskdefs back to summary

public Class GenerateKey.DistinguishedName

extends Object
Class Inheritance

A class corresponding to the dname nested element.

Field Summary

Modifier and TypeField and Description
private List<GenerateKey.DnameParam>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

a DnameParam object to be configured.
createParam
()

Create a param nested element.

public String

Returns:

the encoded value.
encode
(final String
the value to be encoded
string
)

Encode a name or value.

public Enumeration<GenerateKey.DnameParam>

Returns:

an enumeration of the nested parameters.
getParams
()

Get the nested parameters.

public String

Returns:

a string rep of this name
toString
()

Overrides java.lang.Object.toString.

Generate a string rep of this distinguished name.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

paramsback to summary
private List<GenerateKey.DnameParam> params

Constructor Detail

DistinguishedNameback to summary
public DistinguishedName()

Method Detail

createParamback to summary
public Object createParam()

Create a param nested element.

Returns:Object

a DnameParam object to be configured.

encodeback to summary
public String encode(final String string)

Encode a name or value. The encoded result is the same as the input string except that each ',' is replaced by a '\,'.

Parameters
string:String

the value to be encoded

Returns:String

the encoded value.

getParamsback to summary
public Enumeration<GenerateKey.DnameParam> getParams()

Get the nested parameters.

Returns:Enumeration<GenerateKey.DnameParam>

an enumeration of the nested parameters.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Generate a string rep of this distinguished name. The format is each of the parameters (name = value) separated by ','. This is used on the command line.

Returns:String

a string rep of this name

Annotations
@Override
org.apache.tools.ant.taskdefs back to summary

public Class GenerateKey.DnameParam

extends Object
Class Inheritance

A DistinguishedName parameter. This is a nested element in a dname nested element.

Field Summary

Modifier and TypeField and Description
private String
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the name.
getName
()

Get the name attribute.

public String

Returns:

the value.
getValue
()

Get the value attribute.

public boolean
public void
setName(String
a String value
name
)

Set the name attribute.

public void
setValue(String
a String value
value
)

Set the value attribute.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
private String name
valueback to summary
private String value

Constructor Detail

DnameParamback to summary
public DnameParam()

Method Detail

getNameback to summary
public String getName()

Get the name attribute.

Returns:String

the name.

getValueback to summary
public String getValue()

Get the value attribute.

Returns:String

the value.

isCompleteback to summary
public boolean isComplete()
setNameback to summary
public void setName(String name)

Set the name attribute.

Parameters
name:String

a String value

setValueback to summary
public void setValue(String value)

Set the value attribute.

Parameters
value:String

a String value