Issue 2687: SSL example script fails mysteriously on MacOS (original) (raw)

On my MacOS 10.4.11 machine, the example SSL server and client in the documentation don't work, and they fail with a mysterious error 0. The attached tarball contains my slightly-modified version of the scripts and the test key/cert I'm using.

When I run the server, and then the client, the output of the server is:

amk@amk:~/source/p/python$ ./python.exe server.py Waiting for connection... Connection received from ('127.0.0.1', 61915) Traceback (most recent call last): File "server.py", line 16, in certfile='cert.pem') File "/Users/amk/source/p/python/Lib/ssl.py", line 466, in wrap_socket ssl_version=ssl_version, ca_certs=ca_certs) File "/Users/amk/source/p/python/Lib/ssl.py", line 103, in init cert_reqs, ssl_version, ca_certs) ssl.SSLError: [Errno 8] _ssl.c:429: EOF occurred in violation of protocol

And the client is: amk@amk:/source/p/python$ ./python.exe client.py Traceback (most recent call last): File "client.py", line 10, in ssl_sock.connect(('', 9000)) File "/Users/amk/source/p/python/Lib/ssl.py", line 204, in connect self.ca_certs) ssl.SSLError: [Errno 0] _ssl.c:327: error:00000000:lib(0):func(0):reason(0) amk@amk:/source/p/python$

The error 0 is very puzzling.

Perhaps I generated the key and cert incorrectly, and parsing them is failing in this strange way?