Unable to get X509 root certificate from client in Tomcat

I am trying to set up a test environment for our application that uses X.509 client authentication via HTTPS in Tomcat 6.0. The servlet code expects to receive a certificate chain as an array of X509Certificate objects using the javax.servlet.request.X509Certificate servlet request. However, this array contains only one element (client certificate), in which I expect it to have two (client certificate and the root CA certificate that signed it).

Here is what I have done so far:

  • Create a self-signed CA certificate using openssl.
  • Import the CA certificate as a trusted root certificate into the new Java keystore.
  • Configure the Tomcat HTTPS connector to require client authentication using the keystore created in step 2 as a trust:
    • clientAuth="true"
    • truststoreFile="<path_to_truststore>"
  • Create a new client certificate using openssl and sign it with a CA certificate.
  • Launch Tomcat.
  • Install the client certificate in Chrome and go to the home page of my server. Having selected the code in debugging, I see that the array returned as the javax.servlet.request.X509Certificate attribute has only a client certificate.

I know that Tomcat collects the CA root certificate from the trust store because when I remove it from the trust store I get an SSL connection error. It just doesn't do it in a servlet request, as the documentation says. Am I missing any additional configuration here? Perhaps Tomcat (or Java or JSSE) expects some additional X509 V3 extensions or something else?

Any help is appreciated!

EDIT

It seems like my setup is legal, and it falls into the category of unusual but expected behavior due to a simplified test environment. In an enterprise scenario, it is unlikely that the root certification authority will directly sign client certificates for individual users. Obviously, when this code was written and tested, there was at least one intermediate CA in the trust chain.

+4
source share
2 answers

What you see is what is expected: Chrome does not send CA.

During TSL Handshake during client authentication, the server sends a list of eligible CAs as part of its CertificateRequest ( RFC ) message, the browser then presents a certificate signed by one of these certificate authorities.

ADD

btw, a great way to debug client side SSL connections - use fantastic openssl tools

openssl s_client -connect ssl.server.com:443

or only for SSLV3 servers

openssl s_client -connect ssl.server.com:443 -ssl3

This will print (among other things) a list of eligible CAs.

To debug the server side, add this to the JVM command line -Djavax.net.debug=ssl

+3
source

The storage identifier must contain a certificate signed by the CA; not a self-signed certificate. CA root must be in a trusted store.

Also, what is the purpose of step 4?

0
source

Source: https://habr.com/ru/post/1403009/


All Articles