Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.

Metadata

Release files for nettls-py 0.12.0rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for nettls-py 0.12.0rc1
File Interpreter ABI Platform Actions
nettls_py-0.12.0rc1-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.12.0rc1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Release files / nettls_py-0.12.0rc1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL nettls_py-0.12.0rc1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 2.3 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
9056701ea3be5e218beb2ab5796ce8e2501b96720805fedcb8760053a860e3f8
BLAKE2b-256 checksum
How to use checksums
b81677d47f94ed785e25b27e309f088663954aef24f84da46b47a7375d4ffea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for nettls-py 0.12.0rc1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page