[pyOpenSSL] error creating SSL connection
Ajay
abra9823 at mail.usyd.edu.au
Wed Sep 29 10:03:44 CEST 2004
hi!
i am trying to setup a simple SSL connection without any authentication
whatsoever.
the scripts for client and server are below.
running client gives the error
Traceback (most recent call last):
File "ssl_client.py", line 28, in ?
run_client()
File "ssl_client.py", line 20, in run_client
conn.send("ajay rules the world")
OpenSSL.SSL.Error: [('SSL routines', 'SSL3_READ_BYTES', 'sslv3 alert
handshake f
ailure'), ('SSL routines', 'SSL3_WRITE_BYTES', 'ssl handshake failure')]
running server gives
Traceback (most recent call last):
File "ssl_server.py", line 35, in ?
run_server()
File "ssl_server.py", line 29, in run_server
str = sock.recv(1024)
OpenSSL.SSL.Error: [('SSL routines', 'SSL3_GET_CLIENT_HELLO', 'no shared
cipher
)]
and i cant figure out where the error is
thanks
#ssl_server.py
import sys
from OpenSSL.SSL import *
import socket
import signal
SERVICE_PORT=6790
SERVICE_HOST="blade1"
def handleintr(sig, frame):
sys.exit(0)
signal.signal(signal.SIGINT, handleintr)
def run_server():
context = Context(SSLv3_METHOD)
context.set_cipher_list("SSLv3")
context.set_verify(VERIFY_NONE, authenticateClient)
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
addr = (SERVICE_HOST, SERVICE_PORT)
conn = Connection(context, serversocket)
conn.set_accept_state()
conn.bind(addr)
conn.listen(5)
print "listening"
while 1:
print "waiting to receive"
(sock, address) = conn.accept()
str = sock.recv(1024)
print str
def authenticateClient(conn, x509, a, b, c):
return 1
run_server()
#ssl_client.py
import sys
from OpenSSL.SSL import *
import socket
SERVICE_PORT=6790
SERVICE_HOST="blade1"
def run_client():
context = Context(SSLv3_METHOD)
context.set_cipher_list("SSLv3")
context.set_verify(VERIFY_NONE, authenticateServer)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
addr = (SERVICE_HOST, SERVICE_PORT)
conn = Connection(context, sock)
conn.set_connect_state()
conn.connect(addr)
print "connected"
conn.send("ajay rules the world")
conn.close()
def authenticateServer(conn, x509, a, b, c):
print a,b,c
print "called callback"
return 1
run_client()
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the pyopenssl-users
mailing list