From 4cb8a8d3895d440893447e758209a56c0cde41b3 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 7 Mar 2012 15:03:35 -0800 Subject: Modify the cert event to provide the PEM encoded cert in all cases. --- sleekxmpp/xmlstream/xmlstream.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 03217378..81ba2305 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -468,7 +468,8 @@ class XMLStream(object): self.socket.connect(self.address) if self.use_ssl and self.ssl_support: - cert = self.socket.getpeercert() + cert = self.socket.getpeercert(binary_form=True) + cert = ssl.DER_cert_to_PEM_cert(cert) log.debug('CERT: %s', cert) self.event('ssl_cert', cert, direct=True) @@ -702,7 +703,8 @@ class XMLStream(object): self.socket = ssl_socket self.socket.do_handshake() - cert = self.socket.getpeercert() + cert = self.socket.getpeercert(binary_form=True) + cert = ssl.DER_cert_to_PEM_cert(cert) log.debug('CERT: %s', cert) self.event('ssl_cert', cert, direct=True) -- cgit v1.2.3