Skip to main content

Module cert

Module cert 

Source
Expand description

TLS trust for dialing a macula-station: pubkey-pin verification, ported from native/macula_quic/src/cert.rs (macula-io/macula).

A station presents a self-signed X.509 cert wrapping its macula identity’s Ed25519 public key. A client that already knows which station it’s dialing (from DHT records, pre-shared relay identities, or — for a mobile client — configuration) verifies by comparing the cert’s SubjectPublicKeyInfo to that known pubkey directly. No CA chain, no DNS-anchored trust: the pubkey is the identity.

Unlike the Erlang SDK’s own native/macula_quic, this crate never needs to generate a cert — macula uses with_no_client_auth() throughout, so a dialing client presents no TLS certificate of its own at all. Identity/authentication happens entirely at the application layer (the CONNECT/HELLO frame’s Ed25519 signature — see plans/PLAN_WIRE_PROTOCOL.md §2, §5), not via mutual TLS. This module is verification-only.

Structs§

PubkeyPinVerifier
Custom rustls ServerCertVerifier that pins on the leaf cert’s SubjectPublicKeyInfo Ed25519 pubkey rather than walking a CA chain — the pragmatic equivalent of TLS raw-public-key (RFC 7250) without changing the wire protocol. No expiry check, no SAN check, no CA chain: matches the reference verifier exactly, including its intentional narrowness.
SkipServerVerification
Skips all server certificate verification. Development/diagnostic use only — establishes transport connectivity with no identity guarantee whatsoever. Never use this to dial a station you intend to trust; use PubkeyPinVerifier once the station’s identity is known, matching the reference’s own verify => none mode.

Functions§

ed25519_pubkey_from_cert
Extract the 32-byte Ed25519 public key from a DER-encoded X.509 certificate’s SubjectPublicKeyInfo. Errors if the SPKI algorithm isn’t Ed25519 (OID 1.3.101.112) or the key isn’t 32 bytes.