Name

genkey

Synopsis

Generates a key-pair, adding them to a keystore file. This is essentially a wrapper around the keytool -genkey command. The keytool application is included with the JDK, and manages private keys and public certificates.

Attributes

alias (all, String, Y)

The identity of the new keystore entry.

dname (all, String, *)

The X.500 distinguished name associated with the alias.

keyalg (all, String, N)

The algorithm used to generate the entry.

keypass (all, String, *)

The password used to protect the private key.

keysize (all, String, N)

The size of the generated key.

keystore (all, String, N)

The name of the keystore file. Defaults to .keystore in the user’s home directory.

sigalg (all, String, N)

The algorithm used to sign the certificate.

storepass (all, String, Y)

The password used to protect the keystore.

storetype (all, String, N)

The keystore type.

validity (all, String, N)

Number of days the generated certificate is valid.

verbose (all, boolean, N)

Verbose mode. Defaults to false.

The dname attribute is only required if the <dname> content is not specified. keypass is required if the private key password is different than the keystore password.

Content

0,1 nested <dname> elements (all)

Optionally used in place of the dname attribute. Contains 0-n nested <param> elements as shown in the example.

Example Usage

The following example generates a new keystore entry:

<genkey dname="CN=Eric Burke, OU=Authors, O=O'Reilly, L=Sebastopol, S=California, C=US" alias="ericb" storepass="aidansdaddy" ...

Get Ant: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.