From 952260b423e628ab9a68ca52d09b6330c7508c62 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sat, 4 Feb 2012 14:16:37 +0100 Subject: [PATCH] Add ssl_cert event (direct). The payload is a dictionary of parsed cert data, as provided by Python's getpeercert() socket method. It unfortunately does not provide much detail beyond basic info. --- sleekxmpp/xmlstream/xmlstream.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 6d27747..3a2cafc 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -442,6 +442,9 @@ class XMLStream(object): else: self.socket = ssl_socket + cert = self.socket.getpeercert() + log.debug('CERT: %s', cert) + self.event('ssl_cert', cert, direct=True) try: if not self.use_proxy: log.debug("Connecting to %s:%s", *self.address) @@ -675,6 +678,11 @@ class XMLStream(object): else: self.socket = ssl_socket self.socket.do_handshake() + + cert = self.socket.getpeercert() + log.debug('CERT: %s', cert) + self.event('ssl_cert', cert, direct=True) + self.set_socket(self.socket) return True else: