[issue9711] ssl.SSLSocket's keyfile argument seems to be ignored if specified without certfile

Antoine Pitrou report at bugs.python.org
Mon Aug 30 17:22:56 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

Not really, but in previous versions it would fail as soon as you try to connect:

>>> s = ssl.wrap_socket(socket.socket(), keyfile="XXX")
>>> s.connect(("svn.python.org", 443))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/antoine/cpython/27/Lib/ssl.py", line 295, in connect
    self.ca_certs, self.ciphers)
ssl.SSLError: _ssl.c:289: Both the key & certificate files must be specified

It's better to catch the problem up-front, though. As for whether SSLError or ValueError should be preferred, I think ValueError is cleaner (it's really a bad use of the API).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9711>
_______________________________________


More information about the Python-bugs-list mailing list