Python and SSL enabled

matey monica.medina at ngc.com
Tue Oct 31 22:00:51 CET 2006


Problem:  I want to be able to access an HTTPS website read/write
commands
to this website.

>From reading this group it appears I need M2Crypto and OpenSSL

Current version of Python 2.3.4

I downloaded:
M2Crypto 0.16
OpenSSL 0.9.7k
SWIG 1.3.29

Compiled OpenSSL libraries are located in /home/mmedina/lib/libcrypto.a
and libssl.a
I compiled M2Crytpo

cengsu01:/home/mmedina/crypt/m2kcrypto/m2crypto-0.16/build/lib.solaris-2.9-sun4u-2.3/M2Crypto
>ls -alt
total 1624
drwxr-xr-x   4 mmedina  asip         512 Oct 31 09:45 ./
-rwxr-xr-x   1 mmedina  asip      690332 Oct 31 09:45 __m2crypto.so*
drwxr-xr-x   3 mmedina  asip         512 Oct 30 08:38 ../
drwxr-xr-x   2 mmedina  asip         512 Oct 30 08:38 PGP/
drwxr-xr-x   2 mmedina  asip         512 Oct 30 08:38 SSL/
-rw-r--r--   1 mmedina  asip        8655 Jul  5 13:35 EC.py
-rw-r--r--   1 mmedina  asip         771 Jun 12 10:36 __init__.py
-rw-r--r--   1 mmedina  asip       14018 May 22 14:06 DSA.py
-rw-r--r--   1 mmedina  asip        1588 May 10 14:31 util.py
-rw-r--r--   1 mmedina  asip        7189 Apr 27  2006 SMIME.py
-rw-r--r--   1 mmedina  asip        2118 Apr 27  2006 m2urllib.py
-rw-r--r--   1 mmedina  asip       10784 Apr 26  2006 EVP.py
-rw-r--r--   1 mmedina  asip       11238 Apr 26  2006 RSA.py
-rw-r--r--   1 mmedina  asip       25817 Apr 11  2006 X509.py
-rw-r--r--   1 mmedina  asip         207 Mar 31  2006 callback.py
-rw-r--r--   1 mmedina  asip         379 Mar 29  2006 Rand.py
-rw-r--r--   1 mmedina  asip        7302 Mar 25  2006 BIO.py
-rw-r--r--   1 mmedina  asip        3306 Mar 20  2006 ASN1.py
-rw-r--r--   1 mmedina  asip        3085 Mar 20  2006 AuthCookie.py
-rw-r--r--   1 mmedina  asip        1330 Mar 20  2006 BN.py
-rw-r--r--   1 mmedina  asip        2374 Mar 20  2006 DH.py
-rw-r--r--   1 mmedina  asip         936 Mar 20  2006 Err.py
-rw-r--r--   1 mmedina  asip         692 Mar 20  2006 RC4.py
-rw-r--r--   1 mmedina  asip        2896 Mar 20  2006 ftpslib.py
-rw-r--r--   1 mmedina  asip        2210 Mar 20  2006 httpslib.py
-rw-r--r--   1 mmedina  asip         785 Mar 20  2006 m2.py
-rw-r--r--   1 mmedina  asip        1804 Mar 20  2006 m2xmlrpclib.py
-rw-r--r--   1 mmedina  asip         347 Mar 20  2006 threading.py
cengsu01:/home/mmedina/crypt/m2kcrypto/m2crypto-0.16/build/lib.solaris-2.9-sun4u-2.3/M2Crypto
>

However, when I use the following command: python setup.py install
I get the following error:

creating /usr/local/lib/python2.3/site-packages/M2Crypto
error: could not create
'/usr/local/lib/python2.3/site-packages/M2Crypto': Permission denied

Since I don't have root privleges can I install the M2Crypto somewhere
else?

Also, am I on the right track if I want to be able to access an Https
page?

thanks in advance,

Monica


Heikki Toivonen wrote:
> matey wrote:
> > I am have version 2.3.4.  I want to write a python script to access a
> > secure HTTPS.
> >
> > I tried the following:
> >
> > import urllib
> > urllib.urlopen("https://somesecuresite.com")
> > s = f.read()
> > f.close()
>
> I hope you know the Python stdlib SSL does not provide certificate
> checking etc. security features you almost certainly want in a
> production application. There are several 3rd party Python crypto
> libraries that provide more secure SSL out of the box, for example M2Crypto.
> 
> -- 
>   Heikki Toivonen




More information about the Python-list mailing list