开发者

Validate Certificate using Python

开发者 https://www.devze.com 2023-01-13 22:00 出处:网络
I want to access a web service over HTTPS. I have been given a client certificate (p12 file) in order to access it.

I want to access a web service over HTTPS.

I have been given a client certificate (p12 file) in order to access it. Previously we were using basic authentication.

Using python I am unsure 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",开发者_JAVA百科 xml_data)
print content

Now, I am quite new to SSL, Can I just call add_cert or somethign similar and give it the p12 file. Do I need to convert it to a PEM file?


The answer to my question was IN my question

h.add_certificate(keyfile, certfile, '')

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

openssl pkcs12 -in file.p12 -out key.pem -nodes -nocerts
openssl pkcs12 -in file.p12 -out cert.pem -nodes -nokeys
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号