我正在编写一个应用程序,它将SSLEngine与NIO一起使用,我同时编写客户端和服务器。 客户端能够连接到服务器,他连接后,我希望他能够执行会话恢复/重新协商,但目前没有运气..Java JSSE SSLEngine无法恢复SSL会话
由于使用SSLEngine的代码是相当大的(SSLEngine用法是很复杂),我会写一个简单的伪代码演示情况:
Server:
global sslcontext initialized once
await new client
client.sslEngine = create new server ssl engine using the global sslcontext
client.handleHandshake and wait for it to be done
handle client.
Client:
global sslcontext initialized once
sslEngine = create new client ssl engine using the global sslcontext
performHandshake and wait for it to be done
disconnect (close gracefully the connection)
sslEngine = create new client ssl engine using the global sslcontext
configure engine to not allow session creation
performHandshake and wait for it to be done
**我更愿意再发布的代码,可以帮助(甚至是完整的代码,虽然作为任何部分我说它是巨大的..)
当我执行我的程序第一次连接成功,但第二次导致异常:
javax.net.ssl.SSLHandshakeException: No existing session to resume
我是否错过了一些ssl会话恢复所需的配料?
谢谢你非常非常 - 你刚刚完成 – bennyl
@bennyl的无尽googeling :) 3天,不是记录,并且它不完全明显,但是当你去想它一定是这样...... – EJP
我不要认为它必须是这样的 - 因为SSLEngine与传输层分离,我认为通过使用相同的SSLContext创建2个SSLEngines,它们将共享相同的SSLSession缓存...... – bennyl