tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ismael Blesa Part" <ibl...@tissat.es>
Subject Exception when connecting trough SSL (JSSE) to Tomcat 3.2B3
Date Thu, 14 Sep 2000 07:47:32 GMT

When trying to connect to our own secure server (tomcat) using this
code we get a SSLException saying that the cert chain is untrusted.
The certificate in the server has been generated following the
indications
from the howto(info on the server.xml)

We can't see the cipherSuite nor the certificate chain. The exception
must
be thrown in connection time.

Is there any configuration stuff we haven't consider ??
Is there a problem in the client code ??

        try{

System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");

            Security.addProvider(new
com.sun.net.ssl.internal.ssl.Provider());
            URL urls = new URL("https://our.own.server");
            URLConnection con = urls.openConnection();
            con.setAllowUserInteraction(true);
            HttpsURLConnection cons = (HttpsURLConnection) con;
            if (cons == null)    System.out.println("Null
Connection!!!");
            System.out.println("Cypher Suite:" + cons.getCipherSuite());

            cons.connect();
            X509Certificate[] serverCerts =
cons.getServerCertificateChain();
            System.out.println("Certificates:" + serverCerts.length);
            for (int i = 0; i < serverCerts.length; i++) {
                System.out.println(serverCerts[i].toString());
            }

            System.out.println("Headers:" + con.getHeaderFieldKey(0));
            BufferedReader reader = new BufferedReader(new
InputStreamReader(con.getInputStream()));
            String line = reader.readLine();
            while (line != null) {
                System.out.println(line);
                line = reader.readLine();
            }
        } catch (SSLException e) {
            System.out.println("SSL Exception : " + e.toString());
        } catch (Exception e){
            e.printStackTrace();
        }

Mime
View raw message