tags:

views:

436

answers:

3

This appears to be reasonably trivial if using the ssl module for TCP communication, but how would encrypted communication be done via UDP?

Can the ssl module still be used? if so, what steps would need to be performed for the client and server to be in a position where data can be sent to-and-fro as normal?

+4  A: 

DTLS is a TLS (aka SSL) derivative designed for use over datagram transports, like UDP.

OpenSSL supports DTLS starting in 0.9.8, using DTLSv1_METHOD instead of SSLv23_METHOD or TLSv1_METHOD or similar.

ephemient
It doesn't look promising, I'm have a poke around the pyOpenSSL documentation at the moment and DTLSv1_METHOD isn't listed alongside the SSLv23 and TLSv1 methods.
gridzbi
Argh, you're right. The ChangeLog implied that DTLS constants were added, but I checked out the sources now and DTLSv1_METHOD isn't there. It looks like it could be easy to add, though. [edit] https://bugs.launchpad.net/pyopenssl/+bug/454737
ephemient
A: 

If you want to send encrypted data using UDP, I would advise against it for one reason. UDP is a connectionless protocol, meaning that you have no guarantuee or way of knowing that your packets are being received at the other end. I don't know about you, but I find that a bit of a security concern. Since you're dealing with encryption, I guess security is a concern.

Tony
Not relevant to the question, and that is not a security concern. Even TCP doesn't guarantee delivery, it just tries really hard.
GregS
A: 

You could use pyCrypto or ezPyCrypto to manually encrypt/decrypt the packets.

jbochi
How? Do this individually per packet? Huge overhead (especially given datagram's size limitations) with public and keys included in every packet. Work at a higher level and split up the results into multiple packets? Nope, UDP is unreliable and dropping/reordering will screw up your decryption stream.
ephemient