SSL Server Socket Support in Python?
Jp Calderone
exarkun at divmod.com
Fri Apr 22 09:14:14 EDT 2005
On Fri, 22 Apr 2005 14:59:59 +0200, André Søreng <andreis at stud.cs.uit.no> wrote:
>
>I'm trying to create a SSL-enabled server in Python, and in the doc for
>the socket module:
>
>ssl(sock[, keyfile, certfile])
> Initiate a SSL connection over the socket sock. keyfile is the name of
>a PEM formatted
> file that contains your private key. certfile is a PEM formatted
>certificate chain file.
> On success, a new SSLObject is returned.
>
>So:
>
>listen_socket = socket.socket()
>listen_socket.bind((addr, port))
>listen_socket.listen(10)
>s, addr = listen_socket.accept()
>ssl_s = socket.ssl(s, "key.pem", "cert.pem")
>>socket.sslerror: (1, 'error:140770FC:SSL
>>routines:SSL23_GET_SERVER_HELLO:unknown protocol')
>
>Am I missing something?
Python's SSL support is client-side only. For SSL servers, take a look at one of the third-party SSL libraries (M2Crypto, PyOpenSSL, TLSLite), or for an easier time, Twisted.
Jp
More information about the Python-list
mailing list