Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UDP packet encryption

Tags:

python

ssl

udp

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?

like image 533
Dale Reidy Avatar asked Mar 16 '26 05:03

Dale Reidy


2 Answers

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.

like image 198
ephemient Avatar answered Mar 18 '26 18:03

ephemient


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

like image 45
jbochi Avatar answered Mar 18 '26 19:03

jbochi