Java Tool Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 5.10

JDK 1.5 'keytool' - keystore File Management Commands

This section describes all commands supported in JDK 1.5 'keytool' tool to manage certificates stored in 'keystore' files.

"keytool" is command line tool introduced in JDK 1.2 to manage keys and certificates using "keystore". "keytool" replaces the same functions offered by "javakey" in JDK 1.1. "keytool" offers a number functions through the following major command options:

  • "-certreq": Generates a Certificate Signing Request (CSR).
  • "-delete": Deletes the entry of the specified alias name.
  • "-export": Exports the certificate of the specified key entry or certificate entry out of the keystore to a certificate file.
  • "-genkey": Generates a key pair and stores it as a key entry in the keystore.
  • "-help": Lists the basic commands and their options.
  • "-identitydb": Reads the JDK 1.1.x-style identity database from the file idb_file, and adds its entries to the keystore. If no file is given, the identity database is read from stdin. If a keystore does not exist, it is created.
  • "-import": Imports the certificate from a certificate file as a certificate entry into the keystore.
  • "-keyclone": Creates a new key entry by copying an existing key entry.
  • "-keypasswd": Changes the password under which the private/secret key identified by alias is protected, from old_keypass to new_keypass, which must be at least 6 characters long.
  • "-list": Lists all entries in the keystore.
  • "-printcert": Prints summary information of a certificate from a certificate file.
  • "-selfcert": Replaces the certificate in a key entry with a new self-signed certificate.
  • "-storepasswd": Changes the password used to protect the integrity of the keystore contents. The new password is new_storepass, which must be at least 6 characters long..

The above list of "keytool" commands are supported by JDK 1.5. See next section for "keytool" commands supported in JDK 1.6.

Sections in This Chapter

Certificates and Certificate Chains

'keystore' - Public Key Certificate Storage File

JDK 1.5 'keytool' - keystore File Management Commands

JDK 1.6 'keytool' - keystore File Management Commands

Generating Key Pairs and Self-Signed Certificates

Exporting and Import Certificates

Cloning Certificates with New Identities

Dr. Herong Yang, updated in 2008
JDK 1.5 'keytool' - keystore File Management Commands