python3-dtls
Python Datagram Transport Layer Security
What it is and what it does
PyDTLS brings DTLS (RFC 6347) to Python by patching the standard library's ssl module to handle UDP datagram sockets the same way it handles TCP streams. It provides encryption, server and user authentication, and message authentication for UDP-based communication. The package is pure Python and interfaces with OpenSSL through ctypes, making it portable across operating systems.
The library implements DTLS connection semantics on top of connectionless UDP by managing handshakes, cookie exchanges (to prevent denial-of-service attacks), and demultiplexing of datagrams to the correct peer connection. You can use either the familiar ssl module interface (after calling do_patch) or the lower-level SSLConnection class directly. Version 1.3.0 adds support for DTLS 1.2, forward secrecy via elliptic curve cryptography, and finer-grained configuration.
Use it for:
- Securing real-time communication protocols (VoIP, video streaming, gaming) where UDP latency is critical and TLS over TCP is too slow.
- Protecting IoT device communication where bandwidth and latency constraints make UDP preferable to TCP.
- Building DTLS-compliant servers that must authenticate clients and prevent spoofing attacks via the DTLS cookie exchange.
- Migrating existing UDP applications to encrypted communication without rewriting socket code—use do_patch to extend ssl module.
- Testing DTLS implementations or building DTLS-aware network tools in pure Python.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds DTLS (Datagram Transport Layer Security) support to Python by extending the standard library's ssl module to work with UDP sockets, providing encryption and authentication for datagram-based communication.
Yes, if you need DTLS for UDP communication and can accept dormant maintenance. The package is stable (Production/Stable classifier), has no known vulnerabilities, and low install friction. However, do not use it if you require active security updates or compatibility with Python versions beyond 3.6—the last release was 2020-11-06 and the repository shows no recent activity.
Install
python3-dtls on PyPI
pip
pip install python3-dtlsuv
uv add python3-dtlspoetry
poetry add python3-dtlsInstalling python3-dtls
Before you install
Low friction: pure Python wheel with no runtime dependencies. However, maintenance is dormant—last release was 2020-11-06 and last commit 2023-10-04, so security patches and compatibility updates are unlikely.
License in practice
Apache-2.0 (permissive): you may use, modify, and distribute this package freely in commercial and private projects, provided you include a copy of the license and state material changes.
Quickstart
pip install python3-dtls
import ssl
from socket import socket, AF_INET, SOCK_DGRAM
from dtls import do_patch
do_patch()
sock = ssl.wrap_socket(socket(AF_INET, SOCK_DGRAM))
sock.connect(('example.com', 1234))
sock.send(b'message')
Requires OpenSSL 1.1.1 or higher installed on the system; on Windows, source distributions include OpenSSL DLLs for 32-bit and 64-bit architectures.
Verify before relying
- Whether the package works reliably with Python versions beyond 3.6 (classifier lists only 3.6, but requires_python is unspecified).
- Current compatibility with modern OpenSSL versions and whether security patches from OpenSSL are automatically inherited.
- Whether dormant maintenance affects real-world reliability for production UDP/DTLS workloads.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 2,107 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 213,783/month — #9,428 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python3_dtls-1.3.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
backports.sslProvides the Python 3.4 ssl module API on older…
permissive · top 15,000 on PyPI
asyncio-dgramProvides simple async/await wrappers for UDP…
permissive · top 15,000 on PyPI
oscryptooscrypto provides TLS sockets, key generation,…
permissive · top 1,000 on PyPI
M2CryptoM2Crypto wraps OpenSSL via SWIG to provide…
permissive · top 15,000 on PyPI
noiseprotocolImplements the Noise Protocol Framework for…
permissive · top 15,000 on PyPI
ndg-httpsclientProvides enhanced HTTPS support for Python's…
permissive · top 5,000 on PyPI
tlslite-ngPure Python implementation of SSL/TLS protocols…
copyleft · top 15,000 on PyPI
ldap3ldap3 is a pure Python LDAP V3 client library…
copyleft · top 5,000 on PyPI
pproxypproxy is an asynchronous proxy server that…
permissive · top 15,000 on PyPI