From 8e95ae2948228ddc6d1b32eca2e64b847c756a71 Mon Sep 17 00:00:00 2001 From: Tom Nichols Date: Thu, 13 May 2010 13:49:00 -0400 Subject: attempt to add support for self-signed certificate certs --- sleekxmpp/xmlstream/xmlstream.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sleekxmpp') diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 54fac422..cdce1fdf 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -69,6 +69,7 @@ class XMLStream(object): self.filesocket = None self.use_ssl = False self.use_tls = False + self.ca_certs=None self.stream_header = "" self.stream_footer = "" @@ -112,7 +113,7 @@ class XMLStream(object): self.socket.settimeout(None) if self.use_ssl and self.ssl_support: logging.debug("Socket Wrapped for SSL") - self.socket = ssl.wrap_socket(self.socket) + self.socket = ssl.wrap_socket(self.socket,ca_certs=self.ca_certs) try: self.socket.connect(self.address) #self.filesocket = self.socket.makefile('rb', 0) @@ -131,8 +132,13 @@ class XMLStream(object): if self.ssl_support: logging.info("Negotiating TLS") self.realsocket = self.socket - self.socket = ssl.wrap_socket(self.socket, ssl_version=ssl.PROTOCOL_TLSv1, do_handshake_on_connect=False) + self.socket = ssl.wrap_socket(self.socket, + ssl_version=ssl.PROTOCOL_TLSv1, + do_handshake_on_connect=False, + ca_certs=self.ca_certs) + print "doing handshake..." self.socket.do_handshake() + print "got handshake..." if sys.version_info < (3,0): from . filesocket import filesocket self.filesocket = filesocket(self.socket) -- cgit v1.2.3