Search code examples
pythonsslcertificateurllib2mutual-authentication

Using client certificates with urllib2


I need to create a secure channel between my server and a remote web service. I'll be using HTTPS with a client certificate. I'll also need to validate the certificate presented by the remote service.

  1. How can I use my own client certificate with urllib2?

  2. What will I need to do in my code to ensure that the remote certificate is correct?


Solution

  • Here's a bug in the official Python bugtracker that looks relevant, and has a proposed patch.