Home Man
Search
Today's Posts
Register

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

Python- Client and server certificate validation

Tags
certificate, client authentication, programming, python

Login to Reply

 
Thread Tools Search this Thread
# 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 to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Client/Server Socket Application - Preventing Client from quitting on server crash varun.nagpaal Programming 2 08-27-2009 10:57 PM
mod_ssl redirect to site if client does not have valid certificate Esaia UNIX for Advanced & Expert Users 6 07-22-2008 05:00 AM


All times are GMT -4. The time now is 01:05 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password