How do I create a certificate and keystore?

The following command, will create a self-signed RSA certificate with 2048 bits and store it inside a keystore file:

keytool -genkey -keyalg RSA -alias dshportal -keystore selfsigned.jks -validity <days> -keysize 2048

Enter the password to access the certificate in the keystore and then fill in the rest of the requested data.

To verify that the keystore contains a valid certificate, run the following command:

keytool -list -v -keystore selfsigned.jks

The tool should prompt for the password to access the certificate and show the information entered in the previous steps.

Last updated

Was this helpful?