[Twisted-Python] Detect SSL transport and get remote peer certificate in tcp.Server
adi at roiban.ro
Wed Jun 13 06:39:42 EDT 2012
I work at an experimental FTPS implementation for twisted.protocol.ftp
I use the following code for checking that the transport has TLS
started and to get the client certificate for certificate based
'''Return `True` if current command connection is using SSL.'''
return isinstance(self.transport.socket, SSL.Connection)
'''Return the peer certificate if remote peer is on a SSL connection
and has sent us a certificate.
Return `None` otherwise.
if not hasattr(self.transport, 'socket'):
if not self.is_ftps_command_active:
The code works with Twisted 10, but after the Twisted TLS refactoring
in Twisted 12, the transport no longer uses a SSL.Connection.
Is there a way to get the remote peer certificate of a TLS transport
in Twisted 12?
Is there a way to check whether or not the transport has SSL enabled or not?
More information about the Twisted-Python