encryption (passwords)

Oren Tirosh oren-py-l at hishome.net
Wed Sep 4 13:38:26 CEST 2002


On Wed, Sep 04, 2002 at 11:29:15AM +0200, Gumuz wrote:
> I am using network-sockets to communicate between two(or more) python
> applications. I want to encrypt these messages, or at least a part of it
> e.g. password and such.
> 
> My limited understanding of encryption tells me that I need a 'key' to
> decrypt stuff. So I figure that this key will bey written(hard-coded?)
> somewhere in my Python-script and it needs to be known at both sides in
> order to encrypt and decrypt. Somehow, I can't believe this is true. I can't
> get over the idea that if my application becomes open-source anyone could
> see the key and decrypt my messages.

You can get secret communication without any prior agreement between the
parties. The Diffie-Hellman key exchange protocol lets two parties 
communicating over an insecure channel create a shared secret and a passive 
listener will not be able to find it.

Take a look at http://magaf.org/dh.py

There is a catch, though: this gives you secrecy but not authentication.
If you encrypt the data stream using this shared secret as a key you will
be communicating in perfect secrecy with someone who may or may not be who
you meant to communicate with. It could be someone pretending to be the 
other party (a man-in-the-middle attack)

So secrecy has a technical solution, but it only moves the problem 
elsewhere.  Authentication has *no* simple technical solution because it's
more of a meatspace problem than a cyberspace problem. Any solution
would depdend on lots of tricky assumptions about the users of the system, 
the potential threats and the environment in which it runs.

	Oren






More information about the Python-list mailing list