How to Generate Keystore File for Tomcat
This article guides you through the steps to configure Tomcat to use HTTPS (in this example port 8443) secure communication.
Note
This guide requires the keytool utility that is part of the Java runtime/SDK package.
Important
The .pfx file in use in the following chapters must have a password set!
Generating Keystore
- Copy the pfx file to the server.
- Open command prompt and navigate to the folder where the .pfx located.
Execute the following command to check the certificate in the .pfx:
keytool -list -v -keystore [.pfx name].pfx -storetype PKCS12 | more
For a non-wildcard certificate, execute this command to generate the keystore file by importing the certificate(s) and specifying the aliases:
keytool -importkeystore -srckeystore [.pfx name].pfx -srcstoretype pkcs12 -destkeystore keystore.jks -deststoretype JKS -srcalias [Alias name e.g.: le-webserver...] -destalias [key alias]
For a wildcard certificate, execute this command to generate the keystore file by importing the certificate(s):
keytool -importkeystore -srckeystore [.pfx name].pfx -srcstoretype pkcs12 -destkeystore keystore.jks -deststoretype JKS
Copy the created .jks file to the ...\Tomcat\Conf folder
Open ...\Tomcat\conf\server.xml and modify the following part:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" acceptCount="200" maxThreads="300" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" keystoreFile="[path to]\Tomcat\conf\keystore.jks" keystorePass="[keystore password]" keyPass="[keystore file password]" keyAlias="[Key alias]" SSLProtocol="TLS" />
Start the Tomcat apps. For Contact Expert this is done using CE Server Manager.