- Generate a server key pair and self-signed certificate.
- Generate and export a CSR.
- Import a CA root certificate.
- Import the server certificate signed by the CA.
Because the JDK 8 installation includes keytool, you can run the commands without additional configuration.
Generate a key pair and certificate
Perform the following steps to generate a server key pair and self-signed certificate:1
Execute the following command:
-alias sets a name to identify the key pair and certificate to be generated. It can be any name (for example, JarSignerDemo).
Shell
2
When prompted, enter the following information for the server certificate you want to generate and enter a new KeyStore password, which all subsequent keytool and jarsigner commands use:
None
Generate and export a CSR
Perform the following steps to generate and export a CSR:1
To generate and export a CSR, run the following command:
Shell
2
Enter the KeyStore password.
3
Send the CSR to a third-party or internal CA to get it signed.
The CA returns the server certificate and CA certificate for you to import.
Import a CA root certificate
Perform the following steps to import a CA root certificate:1
To import the CA root certificate, run the following command:
Shell
2
Enter the KeyStore password.
3
When prompted to trust the certificate, enter
yes as shown in the following example:Shell
Import the server certificate
Perform the following steps to import the server certificate signed by CA:1
To import the signed server certificate, run the following command:
Shell
2
Enter the KeyStore password.
If the command was successful, you should see an output similar to the following example:
Shell

