SSL Sockets in Windows

Gerhard Häring gh_pythonlist at gmx.de
Fri Dec 28 09:27:23 EST 2001


Le 28/12/01 à 07:18, Syver Enstad écrivit:
> 
> Hi Al, I'm not exactly an expert on SSL :-). I know it's what goes on
> behind the scenes when my browser uses an https url and communication
> is encrypted and whatnot. 
> 
> Do you have (or can you refer me to) a quick
> example to check that SSL is indeed working on Python?

You can check pretty easily if your Python is compiled with SSL support:
    
    'ssl' in dir(socket)

If so, you should be able to fetch a HTML page with the urllib module:

    print urllib.urlopen("https://www.sf.net/").read()

If you have a packet sniffer running while fetching the page, you should
see only garbage instead of cleartext HTTP/HTML.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))




More information about the Python-list mailing list