Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2023-11-07 00:19:58 +0300
committerPhilipp Hörist <philipp@hoerist.com>2023-11-07 00:19:58 +0300
commit24d5889a333503e02bf4a0614ea9d823c25bc129 (patch)
tree9fa6b5ade1dc97205828c545aa79bdbc314cdca3 /nbxmpp/connection.py
parentb679ed792d9b3df7bc68521953104fffa08e7d06 (diff)
new: Websocket: Implement channel binding
Diffstat (limited to 'nbxmpp/connection.py')
-rw-r--r--nbxmpp/connection.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/nbxmpp/connection.py b/nbxmpp/connection.py
index e4f1d82..5a72c22 100644
--- a/nbxmpp/connection.py
+++ b/nbxmpp/connection.py
@@ -59,6 +59,7 @@ class Connection(Observable):
self._state = None
self._state = TCPState.DISCONNECTED
+ self._tls_con: Optional[Gio.TlsConnection] = None
self._peer_certificate = None
self._peer_certificate_errors = None
@@ -71,14 +72,24 @@ class Connection(Observable):
return None
@property
- def ciphersuite(self) -> Optional[int]:
+ def ciphersuite(self) -> Optional[str]:
return None
def get_channel_binding_data(
self,
type_: Gio.TlsChannelBindingType # pylint: disable=unused-argument
) -> Optional[bytes]:
- return None
+ assert self._tls_con is not None
+
+ try:
+ success, data = self._tls_con.get_channel_binding_data(type_)
+ except Exception as error:
+ self._log.warning('Unable to get channel binding data: %s', error)
+ return None
+
+ if not success:
+ return None
+ return data
@property
def local_address(self):
@@ -160,3 +171,4 @@ class Connection(Observable):
self._peer_certificate = None
self._client_cert = None
self._address = None
+ self._tls_con = None