Ssl – Installing Tomcat SSL certificate fails

ssltomcat

I want to setup a website that uses SSL. I use tomcat 8 and I already successfully setup the https with a self signed certificate, which of course, makes trouble when accessing the website with a common browser. However it works well but not really applicable for a public website.

So, therefore I bought a SSL certificate from an official vendor. I downloaded the following files:

RapidSSL.crt  
RapidSSL.csr  
RapidSSL-Intermediate.cer

I searched the internet for how to properly install this but didn't find anything that worked.

My latest attempt was to do the following:

keytool -import -trustcacerts -alias rapidSSL -file RapidSSL.crt -keystore rapidSSL.jks

Then I modified the conf/server.xml by altering the existing entry:

<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
            keyAlias="rapidSSL"
            keystoreFile="/opt/SSL-Certificates/rapidSSL.jks"
            keypass="XYZ-Pass"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS" 
           compression="on"
           compressionMinSize="2048"
           noCompressionUserAgents="gozilla, traviata"
           compressableMimeType="text/html,text/xml,text/x-json" />

When starting my server I get the following exception:

16-Feb-2018 10:32:29.147 SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-nio-443"]
 java.io.IOException: Keystore was tampered with, or password was incorrect
    at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:780)
    at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:56)
    at sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:225)
    at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:70)
    at java.security.KeyStore.load(KeyStore.java:1445)
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFactory.java:451)
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocketFactory.java:355)
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:608)
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:548)
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:360)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:742)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:458)
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:120)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:960)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:568)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:576)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:599)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)
Caused by: java.security.UnrecoverableKeyException: Password verification failed
    at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:778)
    ... 26 more

So, I really have no idea what I am doing wrong here. Any help would be appreciated. Thanks 🙂

EDIT
Thanks for the answers, the keypass is definitely correct.

Best Answer

check the key pass. If it is correct then try renaming rapidSSL.jks and re-run keytool to see if it fixes it.