Crate zeroclaw_tls
Expand description
Shared TLS and mutual TLS (mTLS) construction for ZeroClaw.
This crate sits below both zeroclaw-runtime and zeroclaw-gateway so the
same rustls server-config / client-certificate-verifier / certificate-pinning
logic can be reused without an upward dependency. It is parameterized by the
neutral ServerConfigParams / ClientAuthParams types rather than any
consumer crate’s configuration struct, keeping this crate free of upward
dependencies on zeroclaw-config and friends.
Re-exports§
pub use certgen::CaKeyProtection;pub use certgen::IssuedLeaf;pub use certgen::Pem;pub use certgen::ServerMaterials;pub use certgen::ensure_server_materials;pub use certgen::ensure_server_materials_protected;pub use certgen::generate_client_csr;pub use certgen::issue_client_cert;pub use certgen::load_ca_key_pem;pub use certgen::sign_csr;pub use csr::ClientCsr;pub use csr::ClientKey;pub use csr::CsrSigner;pub use csr::SoftwareP256Signer;
Modules§
- certgen
- Certificate generation for ZeroClaw’s mutual-TLS transport.
- csr
- Platform-abstracted client CSR generation.
Structs§
- Client
Auth Params - Client-certificate verification parameters (transport-neutral).
- Relay
PinVerifier - A rustls SERVER-certificate verifier that PINS the relay’s OUTER leaf cert by its SHA-256 fingerprint instead of chaining to a CA (threat A2: the outer TLS is a metadata boundary, not the RPC boundary; the inner mTLS is the real one).
- Server
Config Params - Server TLS parameters (transport-neutral).
Functions§
- build_
client_ verifier - Build a client certificate verifier from the client-auth parameters.
- build_
mtls_ acceptor - Build a [
TlsAcceptor] for a remote, mutually-authenticated transport plane. - build_
mtls_ server_ config - Build a TLS 1.3-only [
rustls::ServerConfig] that always requires and verifies a client certificate. Seebuild_mtls_acceptor; this is the inner config builder. There is no no-client-auth branch here by design.crl_path, when non-empty, refuses a revoked client certificate (A5). - build_
server_ config - Build a [
rustls::ServerConfig] from the given server parameters. - build_
tls_ acceptor - Build a [
TlsAcceptor] from the given server parameters. - cert_
sha256_ fingerprint - Compute the SHA-256 fingerprint of a DER-encoded certificate.
- client_
cert_ node_ id - Read a relay node-id from an OUTER client certificate’s subject Common Name.
- enrollment_
sas - The enrollment short-auth-string binding a one-time pairing code to the daemon CA fingerprint (no blind TOFU at bootstrap; threats A1/A7).
- load_
certs - Load PEM-encoded certificates from a file.
- load_
private_ key - Load a PEM-encoded private key from a file.
- load_
revoked_ fingerprints - Read a revoked-fingerprint file (one SHA-256 hex per line; blank lines and
#comments ignored) into a normalized set. Missing/unreadable files are errors: a configured revocation boundary must fail closed, not silently become an empty revocation set. - single_
cert_ pem_ sha256_ fingerprint - Compute the SHA-256 fingerprint of a PEM chain that must contain exactly one certificate. Enrollment SAS confirmation binds to one daemon CA, not a broader chain, so callers should fail closed on zero or multiple certs.