I have recently migrated an application which is protected by client certificates from tomcat 7 to tomcat 9. The tomcat is supposed to validate the client certificates based on the self-signed certificate located in the truststore.
The working tomcat 7 configuration used the following connector (taken from server.xml):
<Connector port="8443" ... clientAuth="true" truststoreFile="/usr/share/tomcat/truststore.jks" truststorePass="..." /> I have migrated this according to the official documentation to the following configuration in tomcat 9:
<Connector port="8443" ...> <SSLHostConfig protocols="TLSv1.2" certificateVerification="required" truststoreFile="/usr/share/tomcat9/truststore.jks" truststorePassword="..." truststoreType="PKCS12"> </SSLHostConfig> ... </Connector> When starting up tomcat 9, I get the following error:
java.lang.IllegalArgumentException: the trustAnchors parameter must be non-empty Googling this error yields a bunch of results and this usually does seem to point towards an empty/ non-accessible truststore. My truststore is not empty and is located in the same directory also used for the keystore, which can be used without problems. And because the same truststore works with tomcat 7, I am running out of ideas on how to make progress on this issue. Anyone got any ideas? Thank you.
In case it matters, the truststore looks like this:
> keytool -list -keystore truststore.jks Keystore type: PKCS12 Keystore provider: SUN Your keystore contains 1 entry mycert, Sep 15, 2021, PrivateKeyEntry, Certificate fingerprint (SHA-256): ...
trustedCertEntryin your keystore. Using the same file as truststore in Tomcat 7.0 should fail too.TrustManagerFactory.initmethod is called in Tomcat 8.5+ (cf. source code). To restore the previous behavior one might settruststoreAlgorithm="SunPKIX"(or any other alias forPKIX).