title: Python Simple SSL Socket Server
body: <p>Just trying to set up a simple SSL server. I have never had anything SSL work for me in the past. I have a loose understanding of how SSL certificates and signing.</p>
  
  <p>The code is simple</p>
  
  <pre><code>import socket, ssl
  
  context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
  context.load_cert_chain(certfile="mycertfile") ###############
  
  bindsocket = socket.socket()
  bindsocket.bind(('', 2099))
  bindsocket.listen(5)
  
  while True:
      newsocket, fromaddr = bindsocket.accept()
      sslsoc = context.wrap_socket(newsocket, server_side=True)
      request = sslsoc.read()
      print(request)
  </code></pre>
  
  <p>The line in there with the ###s after it is the one that isnt working. I don't know what I have to do with openssl to generate a PEM file that will work here.</p>
  
  <p>Can anyone enlighten me as to how to make this simple socket work.</p>
  
  <p>By the way, this is NOT used for HTTP.</p>