SSL over java.net.URL (using Java Web Server 1.1)

John Wenn (jwenn@cp10.es.xerox.com)
Wed, 18 Mar 1998 07:48:34 PST

Message-Id: <350FECD2.D751B38D@cp10.es.xerox.com>
Date: Wed, 18 Mar 1998 07:48:34 PST
From: John Wenn <jwenn@cp10.es.xerox.com>
To: java-security@web1.javasoft.com, jwenn@cp10.es.xerox.com
Subject: SSL over java.net.URL (using Java Web Server 1.1)

I'm writing an SSL client connecting to the Java Web Server 1.1. Since
the advance documentation on the javax.net.ssl API
(http://java.sun.com/jdc/ - "what's new" section) says that doing SSL is
done automatically using https with the URL class, I'm trying that
first.

However, when I do a URL.openConnection(), on the client side I get an
java.io.IOException: Error writing to server

>From the server error log, it says:

[Wed Mar 18 07:38:25 PST 1998] IOException when reading header
[Wed Mar 18 07:38:26 PST 1998] IOException when reading header
[Wed Mar 18 07:38:26 PST 1998] javax.net.ssl.SSLException: no cipher
suites in common
javax.net.ssl.SSLException: no cipher suites in common
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1071)
at
sun.security.ssl.ServerHandshaker.chooseCipherSuite(ServerHandshaker.java:756)
at
sun.security.ssl.ServerHandshaker.clientHello(ServerHandshaker.java:493)
at
sun.security.ssl.ServerHandshaker.processMessage(ServerHandshaker.java:278)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:256)
at sun.security.ssl.SSLSocketImpl.clearPipeline(SSLSocketImpl.java:625)
at sun.security.ssl.SSLSocketImpl.read(SSLSocketImpl.java:531)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:86)
at sun.servlet.http.HttpInputStream.fill(HttpInputStream.java:346)
at sun.servlet.http.HttpInputStream.readLine(HttpInputStream.java:239)
at sun.servlet.http.HttpRequestLine.readLine(HttpRequestLine.java:175)
at sun.servlet.http.HttpRequestLine.parse(HttpRequestLine.java:148)
at sun.servlet.http.HttpRequest.next(HttpRequest.java:310)
at
com.sun.server.webserver.HttpServiceRequest.next(HttpServiceRequest.java:182)
at
com.sun.server.webserver.HttpServiceHandler.handleRequest(HttpServiceHandler.java:268)
at
com.sun.server.webserver.HttpServiceHandler.handleRequest(HttpServiceHandler.java:212)
at com.sun.server.HandlerThread.run(HandlerThread.java:154)
[Wed Mar 18 07:38:26 PST 1998] javax.net.ssl.SSLException: no cipher
suites in common
javax.net.ssl.SSLException: no cipher suites in common
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1071)
at
sun.security.ssl.ServerHandshaker.chooseCipherSuite(ServerHandshaker.java:756)
at
sun.security.ssl.ServerHandshaker.clientHello(ServerHandshaker.java:493)
at
sun.security.ssl.ServerHandshaker.processMessage(ServerHandshaker.java:278)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:256)
at sun.security.ssl.SSLSocketImpl.clearPipeline(SSLSocketImpl.java:625)
at sun.security.ssl.SSLSocketImpl.read(SSLSocketImpl.java:531)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:86)
at sun.servlet.http.HttpInputStream.fill(HttpInputStream.java:346)
at sun.servlet.http.HttpInputStream.readLine(HttpInputStream.java:239)
at sun.servlet.http.HttpRequestLine.readLine(HttpRequestLine.java:175)
at sun.servlet.http.HttpRequestLine.parse(HttpRequestLine.java:148)
at sun.servlet.http.HttpRequest.next(HttpRequest.java:310)
at
com.sun.server.webserver.HttpServiceRequest.next(HttpServiceRequest.java:182)
at
com.sun.server.webserver.HttpServiceHandler.handleRequest(HttpServiceHandler.java:268)
at
com.sun.server.webserver.HttpServiceHandler.handleRequest(HttpServiceHandler.java:212)
at com.sun.server.HandlerThread.run(HandlerThread.java:154)

Using the admin tool, I've enabled all the cipher suites. Looking at
SSLSocketFactory defaultCipherSuites [2 of them] (and
supportedCipherSuites [5 of them]), there should be a match.

Using URL("http://foo.bar:8080/").openConnection() works but
URL("https://foo.bar:7070/").openConnection() doesn't work.

Using the standard browser I can connect both to the http & https URLs.

So any magic formula for getting SSL of java.net.URL to work?

/John

jwenn@cp10.es.xerox.com