Reusing session identifiers is currently not readily available, as indicated here , I have not heard of any simple solution for this, but it should just need to maintain its context after the initial handshake and reuse of it.
PyOpenSSL reveals these mechanisms, but at a lower level than most people would like. I put my money in the following sequence of events:
- Think about how to get started with session loading, just do a proof of concept. A useful tool for this is the openssl binary (the one commonly used to create SSL keys). This has a built-in client that you can use as follows:
openssl s_client -connect HOST: 443
You can print all kinds of good diagnostic materials (for example, your SSL session identifier) so that you can verify it outside of your immediate problem.
After that, httplib SSL support is pretty simple, HTTPSConnection is a very thin wrapper around HTTPConnection (there are only two methods that extend the class.>
httplib.py - class HTTPSConnection
def connect(self): "Connect to a host on a given (SSL) port." sock = socket.create_connection((self.host, self.port), self.timeout, self.source_address) if self._tunnel_host: self.sock = sock self._tunnel() self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
source share