Results 1 to 3 of 3
  1. #1
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default Read data from custom ca

    Hi everybody.
    I have problems with reading data from custom ca.
    I had made a configuration my tomcat server like this Life...: How to create Custom CA and Certificates for SSL using Open SSL
    and then tried to read data from certificate like this
    Java Code:
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.security.cert.X509Certificate;
    
    public class SSLAction extends HttpServlet {
        protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
            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");
                }
            }
        }
    
        protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
            doGet(req, res);
        }
    }
    When I invoke a URL https://localhost:8080/sslaction the server ask me that I have bad ssl certificate.
    Java Code:
    Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
    Can anyone help me?
    Skype: petrarsentev
    http://TrackStudio.com

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

  3. #3
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default

    )) It is nice. You are good moderate, but can you help me?
    Skype: petrarsentev
    http://TrackStudio.com

Similar Threads

  1. Replies: 1
    Last Post: 11-09-2010, 10:28 AM
  2. accessing custom data model values - how?
    By dave247 in forum New To Java
    Replies: 11
    Last Post: 03-07-2010, 01:20 PM
  3. How to read registry data
    By anilkumar_vist in forum Advanced Java
    Replies: 1
    Last Post: 11-07-2009, 05:22 PM
  4. Replies: 1
    Last Post: 04-06-2009, 06:06 AM
  5. Unable to read data from inputstream
    By renuka_anil in forum Java Servlet
    Replies: 0
    Last Post: 01-29-2009, 04:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •