Keytool Reference

Type keytool at the command prompt to get a list of the commands that you can use with the tool.

To access more information about a specific command, the list command for instance, just type:

keytool –h list

Syntax

keytool [OPTIONS]

The following is a summary of commands available to use with keytool.

Full command Shortened command Description

-liststores

-ls

Lists the available key store implementations.

-list

-l

Displays the contents of the key store.

-import

-i

Imports private keys in the store.

-remove

-r

Removes a key from the key store.

-setuser

-s

Set a user.

-setallusers

-a

Set multiple users.

-setmanager

-m

Set a manager.

-removeuser

-ru

Remove a user.

Note:

Long commands, for example, liststores, list and setuser are not case-sensitive but short commands, for example -ls, -l, -a,-s and -m are case sensitive.

If the commands are given incorrectly or in the wrong sequence, for example keytool -store -l or keytool -i -l, the tool displays the default general help command.

In interactive mode, any command called with the -p option displays full details and waits for key input. In non-interactive mode, the option is omitted.

Example

To read commands from an “inputfile” and give the output in “outputfile”, use the following command:

keytool <inputfile> <outputfile>

The file name should be mentioned with the path. If the tool cannot open the “inputfile” or cannot create the output file, it will turn to interactive mode and display the general help command. The input file can contain multiple commands but each command should be separated by a new line character.