Python- Client and server certificate validation


 
Thread Tools Search this Thread
Top Forums Programming Python- Client and server certificate validation
# 1  
Old 04-19-2018
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to install new certificate in HPUX client store?

We have a HPUX server that talks to a web service. We recently updated the web service certificate to a new SHA256 cert that has an updated intermediate cert. The HPUX server is now unable to connect because it cannot validate the cert chain due to it not having the new intermediate CA cert. I... (0 Replies)
Discussion started by: techmattr
0 Replies

2. UNIX for Advanced & Expert Users

Does vsftpd support user access with client certificate with priv/pub key + vsftpd certificate?

:rolleyes:I am trying to setup all certificate based client-server environment in Linux using vsftpd and curl with openssl. I would like to make a user access with vsftpd certificate and user own client certificate (self-signed) with private/public key. I don't see google posts about the my plan... (4 Replies)
Discussion started by: gogogo
4 Replies

3. UNIX for Dummies Questions & Answers

Sign Soap Message from client certificate from UNIX

I have to call a webservice , I need to pass the static request from Unix which should have message signing details in the soap header . I am using cURL command for this. I do not have java , I need to do it through Unix only . Below is the kind of Soap envelop I want to wrap around my request .... (0 Replies)
Discussion started by: IshuGupta
0 Replies

4. UNIX for Dummies Questions & Answers

Calling a webservice and pass a client certificate

Hi, I am trying to call a http soap webservice using curl command , I have tried the below option but I am getting a failure . curl -H "Content-Type: text/xml; charset=utf-8" -H SOAPAction:" -d @Request.xml -X POST... (1 Reply)
Discussion started by: IshuGupta
1 Replies

5. Programming

Client/Server Socket Application - Preventing Client from quitting on server crash

Problem - Linux Client/Server Socket Application: Preventing Client from quitting on server crash Hi, I am writing a Linux socket Server and Client using TCP protocol on Ubuntu 9.04 x64. I am having problem trying to implement a scenario where the client should keep running even when the... (2 Replies)
Discussion started by: varun.nagpaal
2 Replies

6. UNIX for Advanced & Expert Users

mod_ssl redirect to site if client does not have valid certificate

Hello! I have setup a site to which users authenticate against with openssl certificates. Everything works just fine, be I wish to be able to redirect to a error page with instructions instead of displaying the default error page that firefox displays. How to? I got nothing out of google...... (6 Replies)
Discussion started by: Esaia
6 Replies
Login or Register to Ask a Question