Anfragen.Session mit Kundenzertifikaten und besitzen CAPython

Python-Programme
Guest
 Anfragen.Session mit Kundenzertifikaten und besitzen CA

Post by Guest »

Hier ist mein Code < /p>

Code: Select all

os.environ['REQUESTS_CA_BUNDLE'] = os.path.join('/path/to/','ca-own.crt')
s = requests.Session()
s.cert = ('some.crt', 'some.key')

s.get('https://some.site.com')
< /code>
Letzte Anweisung kehrt zurück: < /p>
requests.exceptions.SSLError: HTTPSConnectionPool(host='some.site.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))

mit curl:

Code: Select all

curl --cacert ca-own.crt --key some.key --cert some.crt https://some.site.com

Gibt den normalen HTML -Code zurück.
P.S.

Code: Select all

s.verify = 'some.crt'
< /code>
oder < /p>
cat some.crt ca-own.crt > res.crt

Code: Select all

s.verify = 'res.crt'
p.p.s.[/b]

Code: Select all

cat some.crt some.key > res.pem

Code: Select all

s.cert = "res.pem"
< /code>
requests.exceptions.SSLError: HTTPSConnectionPool(host='some.site.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))

Code: Select all

cat ca-own.crt some.crt some.key > res.pem

Code: Select all

s.cert =  "res.pem"
< /code>
requests.exceptions.SSLError: HTTPSConnectionPool(host='some.site.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(116, '[X509: KEY_VALUES_MISMATCH] key values mismatch (_ssl.c:4067)')))

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post