SSL Server Socket Support in Python?

André Søreng andreis at stud.cs.uit.no
Fri Apr 22 08:59:59 EDT 2005


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?



More information about the Python-list mailing list