Changes between Version 4 and Version 5 of TransportLayerSecurity

07/26/2016 01:47:52 AM (4 years ago)



  • TransportLayerSecurity

    v4 v5  
    1 For its integrated TLS support, Twisted uses PyOpenSSL, and provides reactor APIs such as connectSSL and listenSSL, as well the startTLS transport API.
    3 While this is sufficient for most applications, it is generally acknowledged by the Twisted team that this is a sub-optimal way to provide integration.  A better API would provide layering, whereby the transport would be a TCP transport, which would deliver data to a TLS protocol, which would decrypt that data and deliver the decrypted data to an application protocol.  Conversely, the TLS protocol would also serve as the application's transport, encrypting the data before sending it to the TLS transport.
    5 This type of API would have numerous benefits:
    7  * SSL encryption could be done on multiplexing protocols, over non-socket connections, such as:
    8    * peer-to-peer protocols like [ Q2Q]
    9    * serial ports
    10    * standard IO and subprocesses
    11  * Throttling policies could be directed at the input and output directly to sockets, measuring the cost of encryption and padding as well as the application data
    13 The reason for this limitation is that PyOpenSSL does not expose the BIO APIs which would allow us to feed it data from an unknown source; although PyOpenSSL exposes an asynchronous API, it only allows us to write to the socket BIO, which requires Twisted to wrap its socket-like API in a different type of transport.
    15 There are other competing TLS libraries which might let us do this.
    17 [ TLS Lite] is a TLS layer which integrates with Twisted via a layered protocol.  It can use mutiple backends, including OpenSSL and PyCrypto, for fast cryptographic operations.
    19 [ M2Crypto] is a more complete Python wrapper for OpenSSL.  It also has a layered protocol for integrating with twisted.
    21 The primary reason Twisted uses PyOpenSSL is that it came first; it was available before either of the other replacements, and while there are currently some reasons keeping us from switching, even once another alternative has emerged as clearly superior, we'll need to develop a transition plan.