users@grizzly.java.net

Problem with SSL over NIO socket

From: Matthieu Fillon <mfillon_at_gmail.com>
Date: Tue, 21 Oct 2008 15:27:57 +0200

Hello Grizzly people!

I'm trying to use SSL with a Grizzly socket server and I'm having problems.
The application was working fine with simple TCP Socket connection.
To activate SSL, I simply used a SSLSelectorHandler instead of TCPSH and
added an SSLReadFilter to the protocol chain at the first position, which I
configured using an SSLConfig.

I get an error during the handshake :

com.sun.grizzly.util.SSLUtils doHandshake
FIN: closeInbound
javax.net.ssl.SSLException: Inbound closed before receiving peer's
close_notify: possible truncation attack?
        at
com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:166)
        at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1356)
        at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1324)
        at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.closeInbound(SSLEngineImpl.java:1263)
        at com.sun.grizzly.util.SSLUtils.doHandshake(SSLUtils.java:413)
        at com.sun.grizzly.util.SSLUtils.doHandshake(SSLUtils.java:377)
        at
com.sun.grizzly.filter.SSLReadFilter.doHandshake(SSLReadFilter.java:276)
        at
com.sun.grizzly.filter.SSLReadFilter.execute(SSLReadFilter.java:154)
        at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
        at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
        at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:169)
21 oct. 2008 15:20:13 com.sun.grizzly.filter.SSLReadFilter log
FIN: doHandshake
java.io.EOFException: Connection closed
        at com.sun.grizzly.util.SSLUtils.doHandshake(SSLUtils.java:420)
        at com.sun.grizzly.util.SSLUtils.doHandshake(SSLUtils.java:377)
        at
com.sun.grizzly.filter.SSLReadFilter.doHandshake(SSLReadFilter.java:276)
        at
com.sun.grizzly.filter.SSLReadFilter.execute(SSLReadFilter.java:154)
        at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
        at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
        at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:169)

The connecting client is a Flash application.
Could you tell me what I did wrong?

Thanks,
Matthieu