FileDocCategorySizeDatePackage
X509Snoop.javaAPI DocExample1052Thu Apr 05 01:51:20 BST 2001None

X509Snoop

public class X509Snoop extends HttpServlet

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)

    res.setContentType("text/plain");
    PrintWriter out = res.getWriter();

    X509Certificate[] certs = (X509Certificate[])
      req.getAttribute("javax.servlet.request.X509Certificate");
    if (certs != null) {
      for (int i = 0; i < certs.length; i++) {
        out.println("Client Certificate [" + i + "] = "
                        + certs[i].toString());
      }
    }
    else {
      if ("https".equals(req.getScheme())) {
        out.println("This was an HTTPS request, " +
                    "but no client certificate is available");
      }
      else {
        out.println("This was not an HTTPS request, " +
                    "so no client certificate is available");
      }
    }