tinytls
tinytls is a pure python TLS1.3 protocol wrapper.
As a result of learning TLS1.3, I wrote this as a sample implementation of TLS1.3 client.
Builtin ssl module (CPython3.7+, OpenSSL1.1.1+) can use as TLS1.3 client, so there is no advantage to use it especially in Python 3.
Restriction
Available TLS1.3 only, not TLS1.2 or under.
Support TLS_CHACHA20_POLY1305_SHA256 cipher suite only.
Support secp256r1 (P-256), secp384r1 (P-384), and X25519 key exchanges.
It does not verify TLS certificate.
Not support 0-RTT
Client certificate authentication is not available.
Supported Python
Python3.11+
MicroPython
Example
CPython
import socket
import tinytls
hostname = "enabled.tls13.com"
sock = socket.create_connection((hostname, 443))
with tinytls.wrap_socket(sock) as ssock:
ssock.send("GET / HTTP/1.1\r\nHost:{}\r\n\r\n".format(hostname).encode())
print(ssock.recv(4096).decode())
MicroPython
import usocket
import tinytls
hostname = "enabled.tls13.com"
sock = usocket.socket()
sock.connect(usocket.getaddrinfo(hostname, 443)[0][-1])
with tinytls.wrap_socket(sock) as ssock:
ssock.send("GET / HTTP/1.1\r\nHost:{}\r\n\r\n".format(hostname).encode())
print(ssock.recv(4096).decode())
Reference
Check the server
If you cannot connect to the server with tinytls, use a command like the following to check if the server can be connected
openssl s_client -tls1_3 -ciphersuites 'TLS_CHACHA20_POLY1305_SHA256' \
-curves 'prime256v1:secp384r1:X25519' \
-state -debug -connect enabled.tls13.com:443
Metadata
Release files for tinytls 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tinytls-0.1.3.tar.gz | 17.9 kB | Without provenance | Details for tinytls-0.1.3.tar.gz |
Release files / tinytls-0.1.3.tar.gz
| Download URL | tinytls-0.1.3.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a6989f9b8323f14b6f1779d1330c09f7ce785127ce3100f260fb6b7b044601f
|
|
BLAKE2b-256 checksum How to use checksums |
e1a62ec5bebebfac6aebf306cc17c17542fe18a06d9f6368fecc1ec0a41b064a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for tinytls 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.