Cannot secure connection using TLS

0

I'm trying to establish a secure socket connection between a Java client applet (built with JDK 1.7.0_75-b13) and a VC++ server application.

As a test vehicle, I used a VC++ client/server sample I found in the MSDN forums, modified it to use SChannel and was able to establish a socket using cipher suite TLS_RSA_WITH_AES_128_CBC_SHA. It works with any of TLS 1.0/1.1/1.2.

When I try opening a socket from the Java applet to the same server application, the connection is rejected with the server reporting the following:

TLS 1.0 AcceptSecurityContext failed: 0x80090327

TLS 1.1 AcceptSecurityContext failed: 0x80090331

TLS 1.2 AcceptSecurityContext failed: 0x80090331

This is the Java code used to create the socket:

debugPrint("Setting up secure connection");
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket("127.0.0.1", socketnumber);
debugPrint("Starting handshake");
sslsocket.setTcpNoDelay(true);
sslsocket.setSoLinger(false, 0);
sslsocket.setKeepAlive(true);
sslsocket.setReuseAddress(true);
sslsocket.setSoTimeout(10000);
sslsocket.setUseClientMode(true);
sslsocket.setWantClientAuth(false);
sslsocket.addHandshakeCompletedListener(new HandshakeCompletedListener() 
{
    @Override
    public void handshakeCompleted(HandshakeCompletedEvent arg0) 
    {
        debugPrint("handshake complete!");
        StealthStatus.setServiceConnected(true);
    }

});
String cipherSuites[] = sslsocket.getEnabledCipherSuites();
for (int inx=0; inx < cipherSuites.length; inx++)
{
    debugPrint("SSL cipher suite supported->" + cipherSuites[inx]);
}
sslsocket.setEnabledCipherSuites(cipherSuites);
sslsocket.startHandshake();
socket = sslsocket;
socketOut = sslsocket.getOutputStream();
socketIn = sslsocket.getInputStream();

Running this, the call to getEnabledCipherSuites returns the list

TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA

TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA

TLS_RSA_WITH_AES_128_CBC_SHA

TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA

TLS_ECDH_RSA_WITH_AES_128_CBC_SHA

TLS_DHE_RSA_WITH_AES_128_CBC_SHA

TLS_DHE_DSS_WITH_AES_128_CBC_SHA

TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA

TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA

SSL_RSA_WITH_3DES_EDE_CBC_SHA

TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA

TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA

SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA

SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA

TLS_ECDHE_ECDSA_WITH_RC4_128_SHA

TLS_ECDHE_RSA_WITH_RC4_128_SHA

SSL_RSA_WITH_RC4_128_SHA

TLS_ECDH_ECDSA_WITH_RC4_128_SHA

TLS_ECDH_RSA_WITH_RC4_128_SHA

SSL_RSA_WITH_RC4_128_MD5

TLS_EMPTY_RENEGOTIATION_INFO_SCSV

which includes the desired TLS_RSA_WITH_AES_128_CBC_SHA and is passed to setEnabledCipherSuites.

What is needed to get the VC++ server to accept a connection from the Java client?

java
sockets
applet
schannel
asked on Stack Overflow Apr 22, 2015 by MikeS_at_UIS • edited Apr 22, 2015 by TigerhawkT3

1 Answer

0

See: http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/ReadDebug.html

In many cases, the log messages generated when using the -Djavax.net.debug=all flag can lead you in the right direction.

answered on Stack Overflow May 11, 2015 by lyaffe

User contributions licensed under CC BY-SA 3.0