To generate a self-signed SSL certificate using the keytool command on Windows, Mac, or Linux:
-
Open a command prompt or terminal.
-
Run this command:
keytool -genkey -keyalg RSA -alias tomcat -keystore selfsigned.jks \ -validity -keysize 2048
Where <days> indicate the number of days for which the certificate will be valid.