Certificate Verification Using Python

I want to access the web service via HTTPS.

I was given a client certificate (file p12) to access it. We used to use basic authentication.

Using python I'm not sure how to access it.

I want to use httplib2

h = Http()
#h.add_credentials("testuser", "testpass")
#h.add_certificate(keyfile, certfile, '')
resp, content = h.request("https://example.com/webservice", "POST", xml_data)
print content

Now I am completely new to SSL, can I just call add_cert or somethign in the same way and give it a p12 file. Do I need to convert it to a PEM file?

+3
source share
1 answer

The answer to my question was in my question

h.add_certificate(keyfile, certfile, '')

I had a pkcs12 file, I just needed to extract the key and certificate from the p12 file.

openssl pkcs12 -in file.p12 -out key.pem -nodes -nocerts
openssl pkcs12 -in file.p12 -out cert.pem -nodes -nokeys
+2
source

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


All Articles