AnsweredAssumed Answered

Using httplib.HTTPSConnection with keystore pass phrase

Question asked by peterlen on Jun 10, 2015

Hello,

 

We are using ArcGIS 10.0 with Python 2.6.5.  This is not a ArcGIS-related Python question, but just a Python question.  Hopefully that is okay and someone will still know this.  In our application, once the user has selected an AOI and we do a spatial search on our file geo-database, we get some URLs for files that we want to download.  We used to use urllib.urlretrieve but now the target site has been SSL-enabled and requires a certificate.  Our requests are coming from the server and we have a signed server cert along with the private key file.  The key file has an associated PEM pass phrase and I am trying to figure out how to include the pass phrase in the connection.

 

As a note, I can bypass the pass phrase thing by creating a new private key PEM file with no pass phrase and then using....

 

httplib.HTTPSConnection(host, key_file="privatekey.pem", cert_file="public.pem")

 

and all works fine.  If, however, the key file contains a PEM pass phrase, I am prompted for it on the command line.  I am trying to find a way to include the pass phrase in the connection (or elsewhere).  I have read about the newer SSLContext objects, specifically the load_cert_chain method that allows for a password parameter, but that is not available in Python 2.6.5.

 

Does anyone know if what I am looking for is possible using our version of Python?

 

Thanks - Peter

Outcomes