3

我一直在尝试让我的 pyOpenSSL 客户端在连续建立多个连接(它正在发送 http 请求)到 Tomcat 应用程序服务器时使用 TLS/SSL 会话恢复,但没有成功。我很确定服务器端的一切都很好,因为我有几个其他客户端进行了类似的连接,并且他们都能够进行会话恢复。

对于第一个连接,我创建了 ssl 上下文。然后我只是将上下文重用于后续连接

# Just do this for the first and then reuse the context for subsequent connections.
ssl_context = SSL.Context(SSL.SSLv23_METHOD)
ssl_context.set_options(SSL.OP_NO_SSLv2)


# Do this for every connection
sock = socket.create_connection((self.host, self.port), self.timeout)
sslconn = SSL.Connection(ssl_context, sock)
sslconn.set_connect_state()
sslconn.do_handshake()
4

2 回答 2

3

本文展示了如何在 openssl 中执行此操作,也许它适用于 pyOpenSSL。另外,这篇文章现在已经快十年了,所以现在可能有一个更简单的方法。

于 2011-01-20T01:45:59.760 回答
0

pyOpenSSl 目前不支持会话恢复

于 2014-12-16T18:36:11.627 回答