Keytool Generate Public Private Key Pair

 

To generate a new public/private key pair in a Java keystore Use the -genkeypair option to generate a key and save it to a Java keystore ( newkeystore.jks in this example). The example shown here prompts you to enter values for items that make up. Copy key from one keystore to another For example you can copy the key pair created in section 'Generate a public/private key pair and a self-signed certificate' with the following keytool command: keytool -importkeystore -srckeystore mystore.jck -destkeystore myotherstore.jks -srcstoretype jceks -deststoretype jks -srcstorepass mystorepass -deststorepass.

This section describes how to import an existing private/public key pair into Java keystore. This is useful if you have your own tools for generating a CA signed key pair. The procedure assumes you already have the root and intermediate certificates as well as the private key and its signed certificate.

To import an existing key pair:

  1. Build the certificate chain and convert the private key and certificate files into a PKCS12 file.

  2. Import the PKCS12 file into Java keystore: Leawo video converter key generator.

  3. Finally, to complete the preparation of the Java keystore, perform the procedures for creating the server and client truststore described in the previous section.

Java Keytool is a key and certificate management utility. It allows users to manage their own public/private key pairs and certificates. It also allows users to cache certificates. Java Keytool stores the keys and certificates in what is called a keystore. By default the Java keystore is implemented as a file. It protects private keys with a password. A Keytool keystore contains the private key and any certificates necessary to complete a chain of trust and establish the trustworthiness of the primary certificate.

Each certificate in a Java keystore is associated with a unique alias. When creating a Java keystore you will first create the .jks file that will initially only contain the private key. You will then generate a CSR and have a certificate generated from it. Then you will import the certificate to the keystore including any root certificates. Java Keytool also several other functions that allow you to view the details of a certificate or list the certificates contained in a keystore or export a certificate.

Note: For easier management of your Java Keystores (using a GUI) check out Portecle. If you need to buy a certificate, try to compare SSL with our SSL Wizard.

Below, we have listed the most common Java Keytool keystore commands and their usage:

Java Keytool Commands for Creating and Importing

Windows Generate Private Public Key

These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. Any root or intermediate certificates will need to be imported before importing the primary certificate for your domain.

  • Generate a Java keystore and key pair
  • Generate a certificate signing request (CSR) for an existing Java keystore
  • Import a root or intermediate CA certificate to an existing Java keystore
  • Import a signed primary certificate to an existing Java keystore
  • Generate a keystore and self-signed certificate (see How to Create a Self Signed Certificate using Java Keytoolfor more info)

Java Keytool Commands for Checking

If you need to check the information within a certificate, or Java keystore, use these commands.

Keytool Import Private Key

  • Check a stand-alone certificate
  • Check which certificates are in a Java keystore
  • Check a particular keystore entry using an alias

Keytool Generate Public Private Key Pair Test

Other Java Keytool Commands

  • Delete a certificate from a Java Keytool keystore
  • Change a Java keystore password
  • Export a certificate from a keystore
  • List Trusted CA Certs
  • Import New CA into Trusted Certs

If you need to move a certificate from Java Keytool to Apache or another type of system, check out these instructions for converting a Java Keytool keystore using OpenSSL. For more information, check out the Java Keytool documentation or check out our Tomcat SSL Installation Instructions which use Java Keytool.

Key

Keytool Generate Public Private Key Pair Windows 10

Originally posted on Sun Jul 13, 2008