How to Create a Self Signed Certificate using Java Keytool
Steps to create a Self Signed Certificate using Java Keytool
Step 2. Run this command (Where indicate the number of days for which the certificate will be valid)
keytool -genkey -keyalg RSA -alias selfsigned -ystore keystore.jks -storepass password -validity 365 -keysize 2048
Step 3. Enter a password for the keystore. Note this password as you require this for configuring the server
Step 4. When prompted for first name and last name, enter the domain name of the server.
For example, myserver or myserver.mycompany.com.
Step 5. Enter the other details, such as Organizational Unit, Organization, City, State, and Country.
Step 6. When prompted with Enter key password for , press Enter to use the same password as the keystore password
Step 7. Run this command to verify the contents of the keystone
keytool -list -v -keystore selfsigned.jks
Step 8. When prompted, enter the keystore password note in Step 3.
The basic information about the generated certificate is displayed. Verify that the Owner and Issuer are the same. Also, you should see the information you provided in Step 4 and 5.