SSL HELP
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, June 20, 2002 06:42 PM

I am writing code that connects to a C++ server through the use of SSLSocket and Socket classes. The C++ server requires SSL for initial authentication, beyond that it switches to using regular clear text messages between the client and the server. Scenerial (1) SSLSocketFactory sslSF = {was somehow obtained}; SSLSocket sslSock = (SSLSocket)sslSF.createSocket(host, port); someInputStream = sslSock.getInputStream(); someOutputStream = sslSock.getOutputStream(); The problem with this approach is that I am unable to turn off SSL. In a nutshell, I am not able to get the input and output streams of the Socket class. Since SSLSocket extends Socket, this would m   More>>


I am writing code that connects to a C++ server through the use of SSLSocket and Socket classes. The C++ server requires SSL for initial authentication, beyond that it
switches to using regular clear text messages between the client and the server.



Scenerial (1)


			
SSLSocketFactory sslSF = {was somehow obtained};
SSLSocket sslSock = (SSLSocket)sslSF.createSocket(host, port);
someInputStream = sslSock.getInputStream();
someOutputStream = sslSock.getOutputStream();


The problem with this approach is that I am unable to turn off SSL. In a nutshell, I am not able to get the input and output streams of the Socket class. Since SSLSocket extends Socket, this would make sense that I can't do this. So, the question is how can I disable SSL.



Scenerial (2)


			
socket = SocketFactory.getDefault().createSocket(host, port);
SSLSocketFactory sslSF = {was somehow obtained};
SSLSocket sslSock = (SSLSocket)sslSF.createSocket(socket,host, port,false);
someInputStream = sslSock.getInputStream();
someOutputStream = sslSock.getOutputStream();


The problem with this approach is that, I receive handshake errors. Provided is the exception,


			
javax.net.ssl.SSLHandshakeException: FATAL Alert:HANDSHAKE_FAILURE - The handshake handler was unable to negotiate an acceptable set of security parameters.
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknown Source)
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessage(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown Source)
at com.certicom.tls.record.ReadHandler.interpretContent(UnknownSource)
at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(UnknownSource)
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(UnknownSource)
at com.certicom.tls.record.WriteHandler.write(Unknown Source)


This exception is thrown as soon as I write to someOutputStream. ie someOutputStream.write(stuff, stuff, stuff);



So, here are my questions,



(1) Why is it that I get the exception in Scenerial (2) and not Scenerial (1) ?



(2) How can I turn on debugging to debug Scenerial (2) ? I tried setting javax.net.debug=all system property and this did not produce any output at all.



Any help on this topic would be greatly appreciated......

   <<Less
About | Sitemap | Contact