Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

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", 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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.