Package pyxmpp :: Module streamtls :: Class StreamTLSMixIn

[hide private]

# Class StreamTLSMixIn

source code

Known Subclasses:
  - stream.Stream

Mix-in class providing TLS support for an XMPP stream.

Instance Methods | [hide private]

__init__(self, tls_settings=None) Initialize TLS support of a Stream object | source code

_handle_tls_features(self) Process incoming StartTLS related element of <stream:features/>. | source code

`libxml2.xmlNode`

_make_stream_tls_features(self, features) Update the <features/> with StartTLS feature. | source code

_make_tls_connection(self) Initiate TLS connection. | source code

_process(self) Same as `Stream.process` but assume `self.lock` is acquired. | source code

`bool`

_process_node_tls(self, xmlnode) Process incoming stream element. | source code

_process_tls_node(self, xmlnode) Process stream element in the TLS namespace. | source code

_read(self) Read data pending on the stream socket and pass it to the parser. | source code

_read_tls(self) Read data pending on the stream socket and pass it to the parser. | source code

_request_tls(self) Request a TLS-encrypted connection. | source code

_reset_tls(self) Reset StreamTLSMixIn object state making it ready to handle new connections. | source code

_write_raw(self, data) Same as `Stream.write_raw` but assume `self.lock` is acquired. | source code

get_tls_connection(self) Get the TLS connection object for the stream. | source code

tls_is_certificate_valid(self, cert) Default certificate verification callback for TLS connections. | source code

Instance Variables | [hide private]

| tls : TLS connection object.

Method Details | [hide private]

### __init__(self, tls_settings=None)
(Constructor)

source code

Initialize TLS support of a Stream object

Parameters:
  - `tls_settings` (: TLSSettings) - : settings for StartTLS.

### _handle_tls_features(self)

source code

Process incoming StartTLS related element of <stream:features/>.

[initiating entity only]

The received features node is available in `self.features`.

### _make_stream_tls_features(self, features)

source code

Update the <features/> with StartTLS feature.

[receving entity only]

Parameters:
  - `features` (: `libxml2.xmlNode`) - : the <features/> element of the stream.
Returns: `libxml2.xmlNode`
  updated <features/> element node.

### _make_tls_connection(self)

source code

Initiate TLS connection.

[initiating entity only]

### _process_node_tls(self, xmlnode)

source code

Process incoming stream element. Pass it to _process_tls_node if it is in TLS namespace.

Returns: `bool`
  `True` when the node was recognized as TLS element.
Raises:
  - `StreamEncryptionRequired` - if encryption is required by current configuration, it is not active and the element is not in the TLS namespace nor in the stream namespace.

### _process_tls_node(self, xmlnode)

source code

Process stream element in the TLS namespace.

Parameters:
  - `xmlnode` - : the XML node received

### _request_tls(self)

source code

Request a TLS-encrypted connection.

[initiating entity only]

### get_tls_connection(self)

source code

Get the TLS connection object for the stream.

Returns:
  self.tls

### tls_is_certificate_valid(self, cert)

source code

Default certificate verification callback for TLS connections.

Parameters:
  - `cert` - : certificate information, as returned by `ssl.SSLSocket.getpeercert`
Returns:
  computed verification result.