Create Java keystore
In this section, you use Java keytool commands to generate a new key pair on the , create a Certificate Signing Request (CSR), issue a certificate through an internal or external CA, and import the signed certificate and accompanying CA certificate into a Java keystore.
These tasks enable you to use the signed certificate to sign a JAR file by using jarsigner in the next section.
Because the keytool application is part of the JDK 8 installation, you don't need extra configuration to run the commands in this section.
Run the following command to generate the key pair and certificate:
The -alias field sets a name to identify the key pair and certificate being generated. It can be any name (such as JarsignerDemo).
When you run the preceding command, the keytool application prompts you for information about the server certificate you want to generate, as shown in the following sample:
Execute the following command:
Enter the keystore password.
Use either a third party or internal CA to sign the CSR.
Run the following command to import the certificate:
Run the following command to import the signed certificate: