简体   繁体   中英

ssl client server with python

i am trying to create an ssl connection between a client and server socket. this is my code: client:

    temp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client = ssl.wrap_socket(temp_socket,ssl_version=ssl.PROTOCOL_TLSv1_2, c 
     =ciphers="AES256-GCM-SHA384")
    #print client.ciphers
    client.connect((server_address, int(port)))

server:

temp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket = ssl.wrap_socket(temp_socket, ssl_version=ssl.PROTOCOL_TLSv1, 
ciphers="ADH-AES256-SHA256")
server_socket.bind(("0.0.0.0", port))
server_socket.listen(1)
(client_socket, client_address) = server_socket.accept()

and i get error: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:661) on the client and [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:590) i think the problem might be the fact i am not giving a key file to sockets but i saw the option doesn't exist with RSA key. any idea what the error might be?

You are not given a certificate and matching keyfile to the server but the cipher you chose uses RSA authentication and thus needs certificate and key. See arguments certfile and keyfile in the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM