Configure Truststore in Tomcat

前端 未结 4 1618
说谎
说谎 2020-12-06 02:04

I have a Java servlet currently running on Tomcat 7 (Windows) and it connects to a SQL Server database. I now need to encrypt this connection and I have a public Key SSL ce

4条回答
  •  悲&欢浪女
    2020-12-06 02:39

    Incase anybody else is having this question, here is what I did:
    1. Navigate to \tomcatDirectory\bin\
    2. Edit the catalina.sh/bat depending on you machine.
    3. Add these properties to the JAVA_OPTS property

    JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStore=$CATALINA_HOME/certificates/truststore.ks -Djavax.net.ssl.trustStorePassword=truststorePassword -server"
    

    This will essentially tell tomcat to use the specified truststore instead of the default cacerts truststore which tomcat loads if it does not find any truststore specified in the system properties.

    Also, I have noticed that it is possible to define the truststore in tomcat's main configuration file server.xml. All you have to do is set these properties in the connector property.

    
    

    Try it out, Hope it helps!

提交回复
热议问题