3

I've been trying with no success to get my pyOpenSSL client to use TLS/SSL session resume when making several connections sucessively (it's sending http requests) to a Tomcat application server. I'm pretty sure everything is fine on the server end since I have several other clients making similar connections and they are all able to do session resume.

For the first connection I create the ssl context. Then I just reuse the context for subsequent connections

# 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()
user533020
  • 137
  • 1
  • 3
  • 9

2 Answers2

3

This article shows how to do it in openssl, maybe it applies to pyOpenSSL. Also, the article is almost ten years old now, so there may be a simpler way by now.

President James K. Polk
  • 40,516
  • 21
  • 95
  • 125
0

pyOpenSSl currently doesn't support session resumption

  • Can you provide a reference for your statement? And which version number do you refer to? Maybe this feature will be added in future... – honk Dec 16 '14 at 19:01