Python requests receive TLSV1_ALERT_INTERNAL_ERROR

I am trying to connect to a website with requestsone that requires the use of a client certificate.

import requests
r = requests.get(url, cert='path to cert')
print(r.status_code)

This works for a single site that uses the same client certificate. This server uses TLS_RSA_WITH_AES_128_CBC_SHA, TLS 1.0. However, my target site uses TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS 1.1. So basically the difference is TLS 1 works, but TLS 1.1 doesn't. Everything works fine in the browser, so it should be connected with Python SSL.

I am using requestsversion 2.7.0 and I also installed requests[security]. pip freeze:

cffi==0.9.2
cryptography==0.8.1
ndg-httpsclient==0.3.3
pyasn1==0.1.7
pycparser==2.10
pyOpenSSL==0.15.1
requests==2.7.0
six==1.9.0

, , requests.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:600). Windows 7 Python 3.4.3. , , Windows, PyPi . , - ssl , requests.

Google . this StackOverflow, , ( ) .

, - , . , .

EDIT: . SSL : ": (2) : (80)". TCP- .

Content Type: Handshake (22)
Version: TLS 1.0 (0x0301)
Length: 512

Handshake Type: Client Hello (1)
Length: 508
Version: TLS 1.2 (0x0301)

.. , , TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA. ACKs .

+4
2

SSLError, ECDH+AESGCM requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS, .

requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = 'DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+HIGH:RSA+3DES:!aNULL:!eNULL:!MD5'

.

+1

SSLError, :

request.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = 'RSA + AESGCM: RSA + AES: RSA + HIGH: RSA + 3DES:! aNULL:! eNULL:! MD5'

-1

Source: https://habr.com/ru/post/1609993/


All Articles