[Twisted-Python] Getting SSL context of protocol session
Steve Smith
ssmith at vislab.usyd.edu.au
Tue Apr 12 20:37:34 MDT 2005
Hi,
How do I retrieve the SSL context for a given protocol session object?
For example, with the echo-server:
# --------
class ServerContextFactory:
def getContext(self):
return SSL.Context(SSL.SSLv23_METHOD)
class Echo(Protocol):
def dataReceived(self, data):
# I want to check the identity in the client certificate at
# this point. Therefore I need the current SSL context.
self.transport.write(data)
factory = Factory()
factory.protocol = Echo
reactor.listenSSL(8000, factory, ServerContextFactory())
reactor.run()
# --------
Currently there appears to be no way of linking the context and the
protocol handler for the connection. Is there a way around this?
Cheers,
Steve
More information about the Twisted-Python
mailing list