title: Opening a SSL socket connection in Python
body: <p>I'm trying to establish a secure socket connection in Python, and i'm having a hard time with the SSL bit of it.  I've found some code examples of how to establish a connection with SSL, but they all involve key files.  The server i'm trying to connect with doesn't need to receive any keys or certificates.  My question is how do I essentially wrap a python socket connection with SSL. I know for a fact that the cipher i'm suppose to use is <code>ADH-AES256-SHA</code>, and the protocol is <code>TLSv1</code>.  This is what i've been trying:</p>
  
  <pre><code>import socket
  import ssl
  
  # SET VARIABLES
  packet, reply = "&lt;packet&gt;SOME_DATA&lt;/packet&gt;", ""
  HOST, PORT = 'XX.XX.XX.XX', 4434
  
  # CREATE SOCKET
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  sock.settimeout(10)
  
  # WRAP SOCKET ???
  ssl.wrap_socket(sock, ssl_version="TLSv1", ciphers="ADH-AES256-SHA")
  
  # CONNECT AND PRINT REPLY
  sock.connect((HOST, PORT))
  sock.send(packet)
  print sock.recv(1280)
  
  # CLOSE SOCKET CONNECTION
  sock.close()
  </code></pre>
  
  <p>When I run this code, I don't get any errors, but I get a blank response.  When trying to debug this code in the command line, by typing in <code>python</code> in the terminal and pasting in code line by line, I get what i'm assuming is a status code when running <code>sock.send(packet)</code>.  The integer response I get is <code>26</code>.  If anyone knows what this means, or can help in anyway it would be greatly appreciated.  Thanks in advance!</p>