class documentation

class twisted.protocols.tls.TLSMemoryBIOFactory(WrappingFactory): (source)

View In Hierarchy

TLSMemoryBIOFactory adds TLS to connections.

Class Variable noisy Undocumented
Method __init__ Create a TLSMemoryBIOFactory.
Method logPrefix Annotate the wrapped factory's log prefix with some text indicating TLS is in use.
Instance Variable _creatorInterface the interface which _connectionCreator is expected to implement.
Instance Variable _connectionCreator a callable which creates an OpenSSL Connection object.
Method _applyProtocolNegotiation Applies ALPN/NPN protocol neogitation to the connection, if the factory supports it.
Method _createConnection Create an OpenSSL connection and set it up good.

Inherited from WrappingFactory:

Instance Variable wrappedFactory Undocumented
Instance Variable protocols Undocumented
Method doStart Undocumented
Method doStop Undocumented
Method startedConnecting Undocumented
Method clientConnectionFailed Undocumented
Method clientConnectionLost Undocumented
Method buildProtocol Undocumented
Method registerProtocol Called by protocol to register itself.
Method unregisterProtocol Called by protocols when they go away.
_creatorInterface = (source)
the interface which _connectionCreator is expected to implement.
(type: zope.interface.interfaces.IInterface)
_connectionCreator = (source)
a callable which creates an OpenSSL Connection object.
(type: 1-argument callable taking TLSMemoryBIOProtocol and returning OpenSSL.SSL.Connection.)
noisy = (source)

Undocumented

(type: bool)
def __init__(self, contextFactory, isClient, wrappedFactory): (source)

Create a TLSMemoryBIOFactory.

ParameterscontextFactoryConfiguration parameters used to create an OpenSSL connection. In order of preference, what you should pass here should be:
  1. twisted.internet.ssl.CertificateOptions (if you're writing a server) or the result of twisted.internet.ssl.optionsForClientTLS (if you're writing a client). If you want security you should really use one of these.
  2. If you really want to implement something yourself, supply a provider of IOpenSSLClientConnectionCreator or IOpenSSLServerConnectionCreator.
  3. If you really have to, supply a twisted.internet.ssl.ContextFactory. This will likely be deprecated at some point so please upgrade to the new interfaces.
(type: IOpenSSLClientConnectionCreator or IOpenSSLServerConnectionCreator, or, for compatibility with older code, anything implementing twisted.internet.interfaces.IOpenSSLContextFactory. See https://twistedmatrix.com/trac/ticket/7215 for information on the upcoming deprecation of passing a twisted.internet.ssl.ContextFactory here.)
isClientIs this a factory for TLS client connections; in other words, those that will send a ClientHello greeting? True if so, False otherwise. This flag determines what interface is expected of contextFactory. If True, contextFactory should provide IOpenSSLClientConnectionCreator; otherwise it should provide IOpenSSLServerConnectionCreator. (type: bool)
wrappedFactoryA factory which will create the application-level protocol. (type: twisted.internet.interfaces.IProtocolFactory)
def logPrefix(self): (source)

Annotate the wrapped factory's log prefix with some text indicating TLS is in use.

ReturnsUndocumented (type: str)
def _applyProtocolNegotiation(self, connection): (source)

Applies ALPN/NPN protocol neogitation to the connection, if the factory supports it.

ParametersconnectionThe OpenSSL connection object to have ALPN/NPN added to it. (type: OpenSSL.SSL.Connection)
ReturnsNothing (type: None)
def _createConnection(self, tlsProtocol): (source)

Create an OpenSSL connection and set it up good.

ParameterstlsProtocolThe protocol which is establishing the connection. (type: TLSMemoryBIOProtocol)
Returnsan OpenSSL connection object for tlsProtocol to use (type: OpenSSL.SSL.Connection)
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.