M2Crypto and general HTTPS help needed

McCann, Brian bmccann at andmore.com
Tue Jul 25 10:10:20 EDT 2006


Hi all.  I'm trying to connect to an HTTPS server and fetch a page, and
I can get that working fine by doing the following:

>>> from M2Crypto import Rand, SSL, m2urllib
>>> url = m2urllib.FancyURLopener()
>>> u = url.open('https://127.0.0.1')
>>> data = u.read()
>>> print data
>>> u.close()

However, I'm trying to verify that the certificate on the server has the
right CN on it, to validate that the site really is who it's supposed to
be.  However, for the life of me I can't figure this out.  I've read
through the documentation on M2Crypto (which is cryptic itself), and I
know I'm still really stupid when it comes to Python, but I figured this
would be a more obvious thing to do.

Does anyone know how to do this, or suggest another package to use?

Thanks!
--Brian 
 
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Brian McCann 
K12USA.com, Cool Tools for Schools
1-877-225-0100
bmccann at andmore.com <blocked::mailto:bmccann at andmore.com> 
http://www.k12usa.com <http://www.k12usa.com/> 




More information about the Python-list mailing list