[Twisted-web] Authenticating with a certificate

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Mar 30 13:33:43 EDT 2010

On 29 Mar, 05:29 pm, doug.gorley at gmail.com wrote:
>G'day Twisted list,
>I'm brand new to Twisted, and I'm trying to wrap my head
>around writing a client that authenticates with a certificate.
>I have a PFX file, and a small Perl script that I can use
>to download content, but I don't seem to be able to replicate
>this on other machines.  I'd like to replace the whole mess
>with a more robust Python solution.
>My communication with the server needs to look like this:

Hi Doug,

Twisted's SSL support is based on pyOpenSSL.  Most of the complex SSL 
features are actually implemented by pyOpenSSL, and Twisted exposes them 
by requiring certain pyOpenSSL objects to be provided to it.

You can find the pyOpenSSL documentation here:


And you can find documentation about the Twisted SSL integration APIs 


One thing I know is that you'll need to convert your PFX file into a 
PEM.  Another thing is that twisted.web.client.getPage accepts a 
"contextFactory" argument which you'll probably want to specify, in 
order to define the particulars of the SSL handshake for your case.


More information about the Twisted-web mailing list