nettls-py
The Python module of nettls: self-signed certificates
with SANs, SHA-256 fingerprint pinning, and certificate rotation with two-signature continuity.
It is the same API as the Rust crate nettls, with the same names, and the same Rust code runs
inside it — the TLS too, which is rustls, not OpenSSL.
pip install nettls-py
It needs Python 3.11 or newer.
import socket
import nettls_py as nettls
params = nettls.SelfSignedParams.new("my service", ["localhost", "127.0.0.1"])
material = nettls.TlsMaterial.load(nettls.CertSource.auto("/tls", params))
fingerprint = material.fingerprint_sha256()
# The server side: the stream takes the accepted socket over.
listener = socket.create_server(("127.0.0.1", 8443))
sock, _ = listener.accept()
with nettls.stream.Stream.accept(sock, material.server_config()) as tls:
tls.write(b"hello\n")
# The client side, pinned to exactly that certificate.
sock = socket.create_connection(("127.0.0.1", 8443), timeout=10)
config = nettls.pinned_client_config(fingerprint)
with nettls.stream.Stream.connect(sock, config, "localhost") as tls:
print(tls.read())
Errors are exceptions, one per kind, all under nettls_py.TlsError. Socket and TLS failures in
nettls_py.stream are OSError, as Python's own ssl gives them.
The private keys live in nettls's locked memory, kept out of core dumps and wiped when dropped.
What Python itself holds — the bytes and str you pass in, and the copies handed out — is
ordinary Python memory, neither locked nor wiped.
- How to use it, with examples
- The API, one for Rust and Python, and what Python cannot guarantee
- Changes
Metadata
Release files for nettls-py 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nettls_py-0.11.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details for nettls_py-0.11.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
Release files / nettls_py-0.11.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | nettls_py-0.11.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2d9605aeeffe35ecc93e9d27ad3ef1f4b3061bb54428fe061e73a1f7972ba91e
|
|
BLAKE2b-256 checksum How to use checksums |
f3e8f5248543815783224a724130b2fc979afebfb0d12a4ca8b393379abf2365
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.16.0
|
Security for nettls-py 0.11.0
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.