tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ma, Yongjie" <>
Subject Can not get javax.servlet.request.X509Certificate Attribute in teh servlet request
Date Fri, 18 Oct 2002 22:55:59 GMT

Tomcat 4.1.12, JavaJDK 1.4

I setup my Tomcat + SSL and installed personal certificate for IE browser.  And also set clientAuth="true"
in SSL connector session of the server.xml.

Then started Tomcat. The browser with personal certificate could access the Tomcat example
page via SSL, and the browser without certificate can not access. It works fine at this point.

But in my servlet I tried to using req.getAttribute("javax.servlet.request.X509Certificate")
to get client certificate information, but it always return null. I tried to type cast it
to String, Object or (, But I got type cast exception,
I guess it caused by tried to type cast NULL object. The code looks like:
        X509Certificate certs[] = (X509Certificate[])

And I tried to debug tomcat, in the class org.apache.catalina.valves.certificatesValve, it
did call setAttribute() to set javax.servlet.request.X509Certificate, and x509Certs is not
null. code looks like:

        // Expose these certificates as a request attribute
        if ((x509Certs == null) || (x509Certs.length < 1))
        session.putValue(Globals.CERTIFICATES_ATTR, x509Certs);
        log(" expose: Exposing converted certificates");

Any idea?

Thank you.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message