curl-and-python

RE: Convert client-certificate curl.exe command to pycurl

From: Binney, Peter <Peter.Binney_at_commerzbank.com>
Date: Wed, 20 May 2015 16:38:20 +0200

So, you are saying that pycurl, as shipped with the 7.19.5.1 Windows distribution (eg: pycurl-7.19.5.win32-py2.7.msi or pycurl-7.19.5.win32-py3.4.msi) does not support any of the curl library setopt mechanisms for specifying a client certificate?

After much trial and error I am pretty much convinced that all curl.setopt(curl.SSLCERT…) and curl.setopt(curl.SSLKEY…) calls are ignored, and the installation just uses the default (or first) client certificate in the Internet Explorer certificate store.

It is a real shame that the pycurl does not support client certs on Windows.


From: curl-and-python [mailto:curl-and-python-bounces_at_cool.haxx.se] On Behalf Of Dima Tisnek
Sent: Wednesday, May 13, 2015 3:31 PM
To: curl with python
Subject: RE: Convert client-certificate curl.exe command to pycurl


There's a good chance winssl prefers different format for certs.
On May 13, 2015 4:13 PM, "Binney, Peter" <Peter.Binney_at_commerzbank.com<mailto:Peter.Binney_at_commerzbank.com>> wrote:
I just download curl, I don't compile it. curl -V says:

curl 7.34.0 (i386-pc-win32) libcurl/7.34.0 OpenSSL/1.0.0k zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate Largefile NTLM SSL SSPI libz

-----Original Message-----
From: curl-and-python [mailto:curl-and-python-bounces_at_cool.haxx.se<mailto:curl-and-python-bounces_at_cool.haxx.se>] On Behalf Of Dima Tisnek
Sent: Wednesday, May 13, 2015 3:00 PM
To: curl with python
Subject: Re: Convert client-certificate curl.exe command to pycurl

Different library versions are a cause to investigate further.
Is your command-line curl also compiled against WinSSL?

On 13 May 2015 at 15:55, Binney, Peter <Peter.Binney_at_commerzbank.com<mailto:Peter.Binney_at_commerzbank.com>> wrote:
> Windows XP.
> Command line curl is using libcurl.dll 7.34 the pycurl (python 2) uses
> 7.37
>
> -----Original Message-----
> From: curl-and-python [mailto:curl-and-python-bounces_at_cool.haxx.se<mailto:curl-and-python-bounces_at_cool.haxx.se>] On
> Behalf Of Dima Tisnek
> Sent: Wednesday, May 13, 2015 2:51 PM
> To: curl with python
> Subject: Re: Convert client-certificate curl.exe command to pycurl
>
> Also please report your OS and what libraries are actually loaded.
>
> On linux you'd do
> ldd `which curl`
> ldd path-to/site-packages/pycurl.so
>
>
>
> On 13 May 2015 at 15:48, Dima Tisnek <dimaqq_at_gmail.com<mailto:dimaqq_at_gmail.com>> wrote:
>> Peter, please enable debug (verbose output) and I think you will be
>> able to track what went wrong.
>>
>> On 13 May 2015 at 15:31, Binney, Peter <Peter.Binney_at_commerzbank.com<mailto:Peter.Binney_at_commerzbank.com>> wrote:
>>> I am using a command-line call to fetch pages from a client-certificated site using a passworded .pem certificate. eg:
>>>
>>> curl -s --cert ./ResMon.pem:Password --cacert ./rootAndCA.pem
>>> --location --cookie-jar ./cookies.tmp https://wiki.ib.internal
>>>
>>> When I try to do this with pycurl the site is not presented with the client certificate and so returns a "you must login" page.
>>> I have tried numerous variations of the under-documented setopt options. My current version is:
>>>
>>> import pycurl
>>> import cStringIO
>>>
>>> fPointer = cStringIO.StringIO()
>>> curl = pycurl.Curl()
>>> curl.setopt(curl.URL, "https://wiki.ib.internal")
>>> curl.setopt(pycurl.WRITEFUNCTION, fPointer.write)
>>> curl.setopt(curl.CAINFO, CERTS + "./rootAndCA.pem")
>>> curl.setopt(curl.SSLCERT, CERTS + "./ResMon.pem")
>>> curl.setopt(curl.SSLCERTPASSWD, " Password ")
>>> curl.setopt(pycurl.FOLLOWLOCATION, 1) ## cf: --location
>>> curl.setopt(pycurl.COOKIEFILE, '') ## cf: --cookie-jar
>>> curl.perform()
>>>
>>> print("Response code: " + str(curl.getinfo(pycurl.RESPONSE_CODE)))
>>> print(fPointer.getvalue())
>>>
>>> Basically, the SSLCERTxxx information is not being used.
>>> What am I missing please?
>>>
>>> Thanks,
>>> Peter
>>>
>>> _______________________________________________
>>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2015-05-20