Package pyxmpp2 :: Module streamtls :: Class StreamTLSHandler
[hide private]

Class StreamTLSHandler


Handler for stream TLS support.
Nested Classes [hide private]

Inherited from interfaces.StreamFeatureHandler: __metaclass__

Instance Methods [hide private]
 
__init__(self, settings=None)
Initialize the TLS handler.
ElementTree.Element
make_stream_tls_features(self, stream, features)
Update the <features/> element with StartTLS feature.
 
handle_stream_features(self, stream, features)
Process incoming StartTLS related element of <stream:features/>.
 
_request_tls(self)
Request a TLS-encrypted connection.
 
_process_tls_failure(self, stream, element)
Handle the <failure /> element.
 
_process_tls_proceed(self, stream, element)
Handle the <proceed /> element.
 
_process_tls_starttls(self, stream, element)
Handle <starttls/> element.
 
_make_tls_connection(self)
Initiate TLS connection.
 
handle_tls_connected_event(self, event)
Verify the peer certificate on the TLSConnectedEvent.

Inherited from interfaces.StreamFeatureHandler: make_stream_features

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
is_certificate_valid(stream, cert)
Default certificate verification callback for TLS connections.
Class Variables [hide private]

Inherited from interfaces.StreamFeatureHandler: __abstractmethods__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, settings=None)
(Constructor)

 
Initialize the TLS handler.
Parameters:
Overrides: object.__init__

make_stream_tls_features(self, stream, features)

 

Update the <features/> element with StartTLS feature.

[receving entity only]

Parameters:
Returns: ElementTree.Element
update <features/> element.

handle_stream_features(self, stream, features)

 

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

[initiating entity only]

Parameters:
  • stream - the stream
  • features - the features element just received
Returns:
Overrides: interfaces.StreamFeatureHandler.handle_stream_features

_request_tls(self)

 

Request a TLS-encrypted connection.

[initiating entity only]

_process_tls_failure(self, stream, element)

 
Handle the <failure /> element.
Decorators:
  • @stream_element_handler(FAILURE_TAG, "initiator")

_process_tls_proceed(self, stream, element)

 
Handle the <proceed /> element.
Decorators:
  • @stream_element_handler(PROCEED_TAG, "initiator")

_process_tls_starttls(self, stream, element)

 
Handle <starttls/> element.
Decorators:
  • @stream_element_handler(STARTTLS_TAG, "receiver")

_make_tls_connection(self)

 

Initiate TLS connection.

[initiating entity only]

handle_tls_connected_event(self, event)

 
Verify the peer certificate on the TLSConnectedEvent.
Decorators:
  • @event_handler(TLSConnectedEvent)

is_certificate_valid(stream, cert)
Static Method

 
Default certificate verification callback for TLS connections.
Parameters:
Returns:
computed verification result.