I’m encountering an SSL handshake failure when upgrading my Python application from versions 3.8 and 3.9 to 3.11 and 3.12. The server side uses TLS 1.2. Here are the errors I’m seeing:
What OS are you using? It could be a configuration of the TLS that is the issue.
If you are ona linux or BSD system then you can test with the openssl command.
Issue fixed after setting cipher context to supported server protocol
did following
ctx = ssl.create_default_context() # This code configures an SSL context with a specific set of secure ciphers, ensuring strong encryption for secure communications. It excludes weaker ciphers to enhance security.
ctx.set_ciphers(‘@SECLEVEL=2:ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES:DHE+AES:AESGCM:!aNULL:!eNULL:!aDSS:!SHA1:!AESCCM:!PSK’)