handshake problem? (fwd)

Nell Rehn (nellrehn@midway.uchicago.edu)
Mon, 30 Aug 1999 10:54:07 -0500 (CDT)

Date: Mon, 30 Aug 1999 10:54:07 -0500 (CDT)
From: Nell Rehn <nellrehn@midway.uchicago.edu>
To: java-security@Sun.COM
Subject: handshake problem? (fwd)

Sorry, should have enclosed some code. I realize I'm not dealing with
certificates, but I note on the server side that the server certificate is
not even being sent before the connection is closed.
[and thanks very much for your prompt response on my last question].

import javax.net.*;
import javax.net.ssl.*;
import com.sun.net.ssl.*;
import java.security.*;

public class https_test {
public static void main(String[] argv) {

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

String hostname = argv[0];
int port = Integer.parseInt(argv[1]);


SSLSocketFactory f = (SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket connection = null;
try {
connection = (SSLSocket)f.createSocket(hostname,port);
} catch(java.net.UnknownHostException unknown) {
unknown.printStackTrace();
} catch(java.io.IOException io) {
io.printStackTrace();
}
EndHandshakeListener h = new EndHandshakeListener();
connection.addHandshakeCompletedListener(h);

String[] suites = {"SSL_RSA_WITH_NULL_MD5"};
connection.setEnabledCipherSuites(suites);
connection.setUseClientMode(true);
connection.setNeedClientAuth(false);
String[] enab = connection.getEnabledCipherSuites();
System.out.println("Enabled: " + enab[0]);
String[] pp = connection.getSupportedCipherSuites();
for (int i = 0;i<pp.length;i++) {
System.out.println("Supported suite: " + pp[i]);
}
SSLSession sess = connection.getSession();
System.out.println("Enabled cipher suite: " + sess.getCipherSuite());
System.out.println("Last Accessed time: " +
sess.getLastAccessedTime());

try {
connection.startHandshake();
}catch(java.io.IOException io2) {
io2.printStackTrace();
}
}
}

---------- Forwarded message ----------
Date: Mon, 30 Aug 1999 10:49:37 -0500 (CDT)
From: Nell Rehn <nellrehn@midway.uchicago.edu>
To: java-security@sun.com
Subject: handshake problem?

Any ideas what could be causing the following handshake problem... it
seems better error messages would be in order. Thanks, Helen

/sandbox/jdk1.2/bin/java -classpath
.:./lib/jndi.jar:./lib/providerutil.jar:./lib/ldap.jar:/sandbox/jdk1.2/jre/lib/rt.jar:.:.:/homes/rehn/jsse1.0/lib/jcert.jar:/homes/rehn/jsse1.0/lib/jnet.jar:/homes/rehn/jsse1.0/lib/jsse.jar
https_test pitcairn.mcs.anl.gov 45952

Enabled suite: SSL_RSA_WITH_NULL_MD5

Supported suite: SSL_DH_anon_WITH_DES_CBC_SHA
Supported suite: SSL_DH_anon_WITH_3DES_EDE_CBC_SHA
Supported suite: SSL_DHE_DSS_WITH_DES_CBC_SHA
Supported suite: SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
Supported suite: SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA
Supported suite: SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
Supported suite: SSL_RSA_WITH_RC4_128_MD5
Supported suite: SSL_RSA_WITH_RC4_128_SHA
Supported suite: SSL_RSA_WITH_DES_CBC_SHA
Supported suite: SSL_RSA_WITH_3DES_EDE_CBC_SHA
Supported suite: SSL_DH_anon_WITH_RC4_128_MD5
Supported suite: SSL_RSA_EXPORT_WITH_RC4_40_MD5
Supported suite: SSL_RSA_WITH_NULL_MD5
Supported suite: SSL_RSA_WITH_NULL_SHA
Supported suite: SSL_DH_anon_EXPORT_WITH_RC4_40_MD5

Enabled session cipher suite: SSL_NULL_WITH_NULL_NULL
Last Accessed time: 936028041508

java.io.IOException: connection is closed
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(Compiled Code)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Compiled Code)
at https_test.main(Compiled Code)

-------------------------------------------------------------------------------------
http://www.mcs.anl.gov/~rehn