Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

Python- Client and server certificate validation

Programming


Tags
certificate, client authentication, python

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 4 Weeks Ago   -   Original Discussion by chandana.hs
chandana.hs's Unix or Linux Image
chandana.hs chandana.hs is offline
Registered User
 
Join Date: Oct 2014
Last Activity: 22 April 2018, 11:35 PM EDT
Posts: 12
Thanks: 8
Thanked 0 Times in 0 Posts
Python- Client and server certificate validation

Hello Team,

I have to verify the Client server certificate validation in HTTPS request(SSL hand shake before the actual HTTPS post request), And tried various ways and failed to verify it successfully.

here are the trials and errors,


Code:
resp = requests.post(url, req, verify=True, timeout=5, proxies=proxies, headers=headers)
'requests.exceptions.SSLError: HTTPSConnectionPool(host='XX.XX.XX.XX', port=8400): Max retries exceeded with url: /v1.1/registration (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),))



Code:
resp = requests.post(url,req, verify=client_ca, timeout=5, proxies=proxies, headers=headers)   

requests.exceptions.SSLError: HTTPSConnectionPool(host='XX.XX.XX.XX', port=8400): Max retries exceeded with url: /v1.1/registration (Caused by SSLError(SSLEOFError(8, u'EOF occurred in violation of protocol (_ssl.c:579)'),))



Code:
resp = requests.post(url,req, verify=True, cert=(client_cert,client_key), timeout=5, proxies=proxies, headers=headers)

requests.exceptions.SSLError: HTTPSConnectionPool(host='XX.XX.XX.XX', port=8400): Max retries exceeded with url: /v1.1/registration (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),))

Here url points to HTTPS url to which post request will be sent.
req is the json input data to HTTPS post request.
client_cert is the pem file having client certificate, with out key.
client_key is the client private key PEM file. proxies and headers are set accordingly.

i want a better working solution to verify the client certificate during HTTPS calls in python scripting.
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to install new certificate in HPUX client store? techmattr UNIX for Beginners Questions & Answers 0 04-26-2017 11:53 PM
Does vsftpd support user access with client certificate with priv/pub key + vsftpd certificate? gogogo UNIX for Advanced & Expert Users 4 02-22-2016 07:51 AM
Sign Soap Message from client certificate from UNIX IshuGupta UNIX for Dummies Questions & Answers 0 06-12-2014 05:37 PM
Calling a webservice and pass a client certificate IshuGupta UNIX for Dummies Questions & Answers 1 06-09-2014 02:45 PM



All times are GMT -4. The time now is 12:23 PM.