[Twisted-Python] How to intercept SSL exceptions ?

Claudio Leonel cls at xpnet.com.br
Mon Dec 15 13:08:05 EST 2003


Hi all,


When my twisted SSL client connects to the wrong server or
its CA certificate is not the correct one, SSL exceptions
occurs in the following lines, inside Twisted:

   File 
"/usr/local/lib/python2.3/site-packages/twisted/internet/tcp.py", line 
259, in writeSomeData
     return self.socket.send(data)
SSL.Error: [('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate 
verify failed')]

and

   File 
"/usr/local/lib/python2.3/site-packages/twisted/internet/tcp.py", line 
234, in doRead
     data = self.socket.recv(self.bufferSize)
SSL.Error: [('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate 
verify failed')]


How can I intercept these exceptions in my application so they do not
interfere with the client output ?


Regards,
Claudio Leonel







More information about the Twisted-Python mailing list