[Python] cant establish connection TLSv1_1 or lower with python 3.11

Discussão em 'Python' iniciado por Stack, Fevereiro 23, 2025.

  1. Stack

    Stack Membro Participativo

    im researching a software that apparently accept TLSv1, but cant get pass the TLS handshake

    My setup is a windows VM connected to my host (windows too), with this particular program acting as client, and me acting like a server with python 3.11. The setup for TLS is this:

    import ssl
    import socket
    import time
    import binascii

    context=ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
    context.options |=(ssl.OP_NO_TLSv1_2|ssl.OP_NO_TLSv1_3)
    context.maximu_version = ssl.TLSVersion.TLSv1_1

    context.verify_mode=ssl.CERT_NONE
    #context.load_verify_locations("cert.pem")
    context.load_cert_chain(certfile="cert.pem" ,keyfile="key.pem")

    context.set_ciphers('ECDHE-RSA-AES128-SHA@SECLEVEL=0')

    serv=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    serv=context.wrap_socket(serv)
    serv.bind((ip,8080))
    serv.listen(5)


    the certificate was created with the following command:

    openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 600 -nodes


    (dont think it matters, but i should mention the program accept self signed certificates)

    i also have wireshark intercepting traffic and i get 2 different behaviors:

    tcp connection is established, and python sends a alert: close notify (15030300020250) and tcp connection is closed tcp connection is establised, i get the clientHello version 1 from client (version= 0x0301), but python reset the tcp connection

    so my question is, how can i get this working? any solutions? if i can establish a TLS v1.1 connection or lower im good

    last thing i tried was this:

    https://gist.github.com/vkosuri/5fd5d6b79d46700eb754aa0d18edbe62

    but still cant get a TLS connection.

    just want to get get a TLS 1.1 connection or lower working

    Continue reading...

Compartilhe esta Página