Trying to setup SSL in Tomcat 9 using JDK10 in Windows 10. When I follow an online tutorial to create a Java keystore using the default password of 'changeit' everything works fine and Tomcat starts with no errors. But if I create a keystore using a different keystore password other than 'changeit', tomcat throws this error:
Caused by: java.lang.IllegalArgumentException: keystore password was incorrect This is the command to create a keystore:
keytool -genkey -alias tomcat -keyalg RSA -keystore c:\certificates\tomcatkeystore This is the SSL connector that works.
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true"> <SSLHostConfig> <Certificate certificateKeystoreFile="C:/certificates/tomcatkeystore" type="RSA" clientAuth="false" sslProtocol="TLS" keystorePass="changeit" /> </SSLHostConfig> </Connector> SSL connector that does not work.
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true"> <SSLHostConfig> <Certificate certificateKeystoreFile="C:/certificates/tomcatkeystore" type="RSA" clientAuth="false" sslProtocol="TLS" keystorePass="testing" /> </SSLHostConfig> </Connector> Why if I follow the exactly the same steps as above but changing to a different keystore password and specifying this in the server.xml generate the above Tomcat error?
NOTE: one thing I noticed in both cases is that the keytool command never prompts me for the 'key password' like many online examples show. Is there a different keytool command I need when using other than the default 'changeit' password?
Thanks.
keytool -list -keystore $filewith that password work? (2) until recently Java defaulted to JKS format which uses separate 'keystore' and 'key' passwords, but Java9 and 10 default to PKCS12 format which (as implemented) does not, so now you are not prompted for the 'key' password unless you specify-storetype JKSor JCEKS, or BKS using BC provider, and then you'll get a warning that you should upgrade to PKCS12(!)