[Twisted-Python] Getting SSL context of protocol session
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
On Wed, 2005-04-13 at 12:37 +1000, Steve Smith wrote:
Hi,
How do I retrieve the SSL context for a given protocol session object?
For the public record I haven't been able to find a straightforward way to do this, as the connection discards the SSL context it creates after passing it to OpenSSL. However the alternative is to use a TLS negotiation within the protocol (aka 'STARTTLS') which gives you more control over the handshaking phase. I've placed some notes and example code here: http://wiki.vislab.usyd.edu.au/moin.cgi/SSLCertNotes Cheers, Steve
participants (1)
-
Steve Smith