skillfed

python3-dtls

Python Datagram Transport Layer Security

python3-dtls v1.3.0 213.8K downloads/30d#9,428 on PyPI9
Permissive license Apache-2.0 DORMANT released

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-dtls

uv

uv add python3-dtls

poetry

poetry add python3-dtls

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.6Topic :: Security :: CryptographyTopic :: Software Development :: Libraries :: Python Modules

Tags

dtls udp encryptiondatagram transport layer security pythonsecure udp socketsdtls rfc 6347ssl for udpencrypted datagram communication
udp-securitydtlscryptography

More Python Modules packages