Skip to main content

Crate coqui_peer_tls

Crate coqui_peer_tls 

Source
Expand description

§coqui-peer-tls

Version Rust version License: MPL-2.0 Docs CI

Mutual-TLS identity between peers, with no RPC layer. Each side has a self-issued certificate and tells the other only its fingerprint; you get back an authenticated, encrypted byte stream and the verified peer. This is the TLS method of coqui-peer, which holds the peer id, the trust store and the sans-IO handshake trait; this crate adds X.509 and rustls. See the documentation.

Status: alpha. 0.0.0-alpha.1 is a pre-release: the API may change in any release before 1.0.

§Features

  • Certificate ids: a certificate’s id is coqui-peer’s PeerId, the SHA-256 of the certificate, written sha256:<hex>; SHA-384, SHA-512 and SHA-1 pins can be read.
  • Trust you choose: pinned fingerprints, a CA with subject and SAN globs, both, or any certificate whose key the peer proves; a client can verify a server by the web PKI, with a CA bundle or the operating system’s verifier, alone or beside pins.
  • Raw public keys: opt in with Policy::certificate, and peers authenticate with a bare SubjectPublicKeyInfo (RFC 7250), pinned by its SHA-256 id, with no CA and no certificate lifetime in the decision.
  • Pairing: an untrusted peer that proves its key is recorded as waiting in the trust store, and an operator accepts it by fingerprint; or two devices pair by an invitation, a PIN or a device flow on a connection of their own, bound to it by the TLS exporter.
  • Key rotation: a peer announces its successor certificate; store-backed pins promote it once proven and retire the old one after a window you choose.
  • Policy: intermediate by default (TLS 1.2 and 1.3), with modern (TLS 1.3 only) and legacy presets; settings that differ from the default are reported as data, never refused. A policy can carry an access control list, applied by address at the ClientHello and by fingerprint before the trust store.
  • Your own stack: the rustls verifiers as values, configurations around a verifier of your own, per-connection configurations for quinn, and the identity’s chain and key.
  • Streams: blocking dial and accept over any Read + Write, async ones over tokio; the sans-IO coqui-peer method for message transports.
  • Server TLS: the server proves itself by certificate and the client authenticates inside the channel (browsers over wss:// and WebTransport); short-lived identities for WebTransport’s serverCertificateHashes.
  • Nothing installs a process-wide crypto provider, and nothing reads a file or the environment unless you give it a path.

§Installation

cargo add coqui-peer-tls@0.0.0-alpha.1
FeatureAddsNeeded forDefault
generatercgen, timeIdentity::generate, Identity::builder, open_or_createoff
fieldsx509-parserCertificateFields: a certificate’s names, SANs (UPN included), serial and validity, as a map to pick identities fromoff
cafields, globsetTrust::Ca, Trust::PinnedOrCa, CaPolicyoff
tokiotokio, tokio-rustls, coqui-peer/tokiomodule asynch: async dial, accept, pairing and rotationoff
pincoqui-peer/pinPIN pairingoff
serdeserde, coqui-builder/serde, coqui-peer/serdePolicy read through any serde format, the settings types filled from one into a coqui_builder::Partial, and PeerId as textoff
aclcoqui-net-aclan access control list inside a Policyoff
platform-rootsrustls-platform-verifierRoots::platform: servers verified by the operating systemoff
aws-lcrustls’s aws-lc-rs provider (AWS-LC, built from C)crypto = "aws-lc": ML-KEM key exchange, ML-DSA, the cnsa-2.0 profileoff
fipsaws-lc and rustls’s fips (AWS-LC’s FIPS module)the fips-140-3-validated profile; global, see Developmentoff

Rust 1.89 or later. A default build depends on coqui-peer, coqui-builder (the settings types’ description and the builders), rustls (0.23.27 or later, ring provider) and rustls-webpki, which rustls already uses.

§Quick start

Dial a peer you pinned, with an identity read from a file:

use std::sync::Arc;
use coqui_peer_tls::{Alpn, ClientBuilder, Identity, Pins, Trust, dial};

let me = Identity::read("identity.pem".as_ref())?.expect("an identity file");
let trust = Trust::Pinned(Pins::fixed([
    "sha256:630dcd2966c4336691125448bbb25b4ff412a49c732db2c8abc1b8581bd710dd".parse()?,
]));
let config = ClientBuilder::new()
    .server(trust)
    .identity(&me)
    .alpn([Alpn::try_from("my-protocol/1")?])
    .build()? // default policy: TLS 1.2 and 1.3
    .config;
let socket = std::net::TcpStream::connect("192.0.2.7:7000")?;
let (stream, peer) = dial(Arc::new(config), socket)?;
println!("connected to {}", peer.fingerprint);

Dial a server with a CA-issued certificate, verified by the web PKI for its name:

use std::sync::Arc;
use coqui_peer_tls::{Alpn, ClientBuilder, Roots, Trust, dial_named};
use rustls::pki_types::ServerName;

let trust = Trust::Roots(Roots::bundle_file("/etc/ssl/certs/ca-certificates.crt"));
let config = ClientBuilder::new()
    .server(trust)
    .alpn([Alpn::try_from("my-protocol/1")?])
    .build()?
    .config;
let name = ServerName::try_from("example.com")?.to_owned();
let socket = std::net::TcpStream::connect("example.com:443")?;
let (stream, server) = dial_named(Arc::new(config), name, socket)?;

Roots are a different trust model from pins: any server one of the roots issued a certificate for the dialled name is trusted. The chain, the dates and the name are always checked.

§API overview

ModulePurpose
coqui_peer_tlsIdentity, PeerIdentity; Trust, Pins, CaPolicy, Roots and their verifiers; Policy; the configuration builders (ServerBuilder, ClientBuilder, ClientAuth, ServerAuth), Built, and ServerConfigs / ConnectionConfig for a configuration per connection; dial, accept, Addressed and their variants; Tls and TlsHandshake; pairing over TLS; rotation; PeerError, Refusal; re-exports of coqui-peer‘s ids and store and of coqui_builder::NonDefault; Alpn, TlsSettings and the builders’ parts (ServerParts, ClientParts).
coqui_peer_tls::preludeThe setter traits of the settings types (TlsSettingsSetters, PolicySetters, PairConfigSetters), for a builder in another crate that holds them.
coqui_peer_tls::asynchAsync dial, accept, pairing and rotation over tokio (tokio).
coqui_peer_tls::paircoqui-peer’s pairing exchange, re-exported.
coqui_peer_tls::aclcoqui-net-acl, re-exported (acl).

§Profiles and policy

Policy::default() is intermediate and works as it is. Policy::modern(), intermediate() and legacy() are plain values; start from one and assign the public fields to change (Policy is #[non_exhaustive]). non_defaults() lists every setting that differs from the default, as data named by key (waiting.per_source): the places where the policy departs from the defaults (modern reports tls_versions, legacy pin_digests and require_ems), and non_defaults_against(&base) does the same against a base of your own. ServerBuilder::build and ClientBuilder::build return the policy beside the configuration, and Built::non_defaults() lists it. A builder’s own non_defaults() is over TlsSettings, so its keys carry the policy. prefix (policy.tls_versions) and alpn is listed when set. Nothing is printed.

Fieldmodernintermediate (default)legacy
tls_versions1.31.2, 1.31.2, 1.3
cipher_suites, kx_groupsall the provider hassamesame
pin_digestssha256, sha384, sha512sameplus sha1
check_validitytruetruetrue
allow_chain_when_pinnedfalsefalsefalse
allow_resumptionfalsefalsefalse
require_emstruetruefalse
waiting (per_source / total / rerecord)16 / 1000 / 60 ssamesame
aclnonenonenone
certificatex509x509x509

Allowing TLS 1.2 costs nothing between peers that speak 1.3: they negotiate 1.3, and TLS 1.3’s downgrade protection keeps an attacker from forcing 1.2; every 1.2 suite offered is ECDHE with an AEAD cipher, and the extended master secret is required. modern refuses peers that speak only 1.2; choose it to keep client certificates from passive observers (TLS 1.2 sends them unencrypted) when such peers exist. legacy adds SHA-1 pins and TLS 1.2 without the extended master secret; a peer that cannot take a TLS 1.3 ClientHello at all is served by tls_versions = ["1.2"].

§Raw public keys

Policy::certificate is x509 in every preset. Set it to CertificateType::RawPublicKey (text raw_public_key) and the peers of every configuration built under the policy send their SubjectPublicKeyInfo instead of a certificate, negotiated with the server_certificate_type and client_certificate_type extensions of RFC 7250:

use coqui_peer_tls::{CertificateType, Identity, Pins, Policy, Trust};
let mut policy = Policy::modern();
policy.certificate = CertificateType::RawPublicKey;
// A peer is pinned by the id of its key, not of its certificate.
let trust = Trust::Pinned(Pins::fixed([peer.public_key_fingerprint()]));
  • An identity is still a certificate and its key; only the key is sent, so the certificate’s dates and names are not looked at (check_validity and allow_chain_when_pinned have nothing to decide).
  • Only pinned trust and AnyWithKeyProof apply: a trust that needs a chain or a name (roots, a CA) is a PeerError::Policy. A store records a stranger that proved its key as PUBLIC KEY material and accepts it by id as it does a certificate; pairing and rotation (announce_as) follow the policy.
  • rustls verifies raw keys in TLS 1.3 only, so TLS 1.3 is what is offered; a policy without it is a PeerError::Policy.
  • The cipher profiles bound the key through the signature schemes they verify, as for a certificate: cnsa-1.0 takes an ECDSA P-384 key, cnsa-2.0 an ML-DSA-87 one (aws-lc).
  • rustls offers one type per configuration, so an X.509 peer and a raw-key peer refuse each other, the side that finds out with Refusal::CertificateType. A server for both picks its configuration from the hello with offers_raw_public_key.

§Cipher profiles

Apart from the versions, a policy lists the algorithm profiles it allows (cipher_profiles, default ["mozilla"]) and the provider that runs them (crypto, ring or, with the aws-lc feature, aws-lc). What is offered is the union of the allowed profiles in the order of the first listed, narrowed to the versions, the provider and any cipher_suites / kx_groups list; a version left with no suite is dropped. Each profile is named for exactly what it claims:

ProfileWhat it is
mozillaMozilla’s server-side TLS guideline 6.0, intermediate. The default.
fips-140-3-compliantFIPS 140-3 approved algorithm selection; not a validated module.
fips-140-2-compliantThe same without the ML-KEM groups, which only a 140-3 module can have approved; not a validated module. Every FIPS 140-2 certificate is on the CMVP Historical List since September 2026.
fips-140-3-validatedAWS-LC’s FIPS module; validated only as its CMVP certificate and tested operating environments state. Needs the fips feature; a configuration rustls does not report FIPS is refused.
cnsa-1.0CNSSP 15 / RFC 9151 as far as rustls goes: AES-256-GCM, P-384, SHA-384.
cnsa-2.0CNSA 2.0 (ML-KEM-1024, ML-DSA-87, AES-256) in the shape of draft-becker-cnsa2-tls-profile-05; needs crypto = "aws-lc".

The CNSA profiles need a P-384 or ML-DSA-87 identity (or RSA 3072+ of your own): a generated identity is P-256 unless Identity::builder().key_algorithm(KeyAlgorithm::P384) (or MlDsa87, with aws-lc) says otherwise. The crate’s API header lists every algorithm and what each profile does not meet.

Session resumption is off in every preset: rustls does not check the peer’s certificate again on a resumed session, so a peer removed from the trust store could reconnect on a session it held. TLS 1.0, 1.1 and non-AEAD suites cannot be offered; MD5 pins are never accepted.

use coqui_peer_tls::{Alpn, ClientAuth, Digest, Identity, Policy, ServerBuilder, Trust};

let identity = Identity::read("identity.pem".as_ref())?.expect("an identity file");
let mut policy = Policy::default();
policy.pin_digests.push(Digest::Sha1);
policy.waiting.per_source = 4;
let built = ServerBuilder::new()
    .identity(&identity)
    .client_auth(ClientAuth::Required(Trust::AnyWithKeyProof))
    .alpn([Alpn::try_from("my-protocol/1")?])
    .policy(policy)
    .build()?;
for setting in built.non_defaults() {
    eprintln!("{} = {} (default: {})", setting.setting, setting.value, setting.default);
}

§Building configurations

One builder per configuration, the settings named for what they are, then build():

To getWrite
a server that requires a pinned or CA-trusted clientServerBuilder::new().identity(&identity).client_auth(ClientAuth::Required(trust))
a server that asks for no client certificateServerBuilder::new().identity(&identity).client_auth(ClientAuth::None)
a server whose clients a verifier of your own decidesServerBuilder::new().identity(&identity).client_auth(ClientAuth::Verifier(verifier))
a clientClientBuilder::new().server(trust), with .identity(&me) to present a certificate
a client verified by a verifier of your ownClientBuilder::new().server(ServerAuth::Verifier(verifier))
a server configuration per connection (quinn)ServerBuilder::new()...configs()
a server’s client verifier for one connectionPeerClientVerifier::builder(&trust).policy(p).addresses(source, local).build()
a client’s server verifierPeerServerVerifier::new(&trust, &policy)
a stream that cannot name its addressesaccept(config, Addressed::new(io, source).local(local))
a pairing configurationPairConfig::default(), then assign alpn, timeout or policy
a generated identity with a validity windowIdentity::builder().valid_for(..).generate(), or .not_before(..).not_after(..)
a generated identity with another keyIdentity::builder().key_algorithm(KeyAlgorithm::P384).generate(); MlDsa87 with aws-lc

Each configuration builder has .alpn(..) and .policy(..) (the keys of TlsSettings, set by name), and .fill(Partial<TlsSettings>) and .fill_from(&mut source) for a file or the environment; the last write of a key wins, whichever way it was written. build() returns Result<_, BuildError<PeerError>>: Missing names an input not given (the identity, the client authentication, the server verification), Failed holds the PeerError. Builders are not Clone. A builder from another crate that holds TlsSettings takes its setters from coqui_peer_tls::prelude.

§Settings as data

The builders’ settings are one type, TlsSettings { alpn, policy }, and PairConfig is its own plain-data type. TlsSettings, Policy and PairConfig derive coqui_builder::Describe, with defaults that are the real ones, so a file names only what differs from the intermediate preset, and an unknown key is refused. alpn entries are Alpns: text of 1 to 255 bytes (a protocol name that is not UTF-8 cannot be held; Alpn converts from &str and from UTF-8 &[u8]). With serde on coqui-builder, a Partial reads TOML, JSON and the other serde formats into them:

alpn = ["my-protocol/1"]

[policy]
tls_versions = ["1.2", "1.3"]
cipher_profiles = ["mozilla"]   # allowed algorithm profiles
crypto = "ring"                 # or "aws-lc", with the `aws-lc` feature
pin_digests = ["sha256", "sha384", "sha512"]
allow_resumption = false
require_ems = true

[policy.waiting]
per_source = 16
total = 1000
rerecord = "60s"               # a duration: 60, "30s", "250ms", "1.5h"

[policy.acl]                    # optional, with the `acl` feature; see coqui-net-acl
default = "deny"

[[policy.acl.rule]]
action = "permit"
source = "10.9.0.0/16"
destination = "10.6.20.5"
ⓘ
let settings = toml::from_str::<Partial<TlsSettings>>(text)?.build()?;
let built = ServerBuilder::new()
    .identity(&identity)
    .client_auth(ClientAuth::None)
    .fill(Partial::from(settings))
    .build()?;

With serde, Policy also implements Deserialize over the same form (it is never written). A consumer with its own default profile reads a document over it with Policy::deserialize_over, which merges the document into the base key by key, a table such as waiting included, and makes an access list’s fingerprints canonical. Committed examples for every preset are in the repository’s tests/vectors/policy/.

§Access control

A policy’s access control list (feature acl) is applied by every server configuration built under it: by address when the ClientHello arrives, before any certificate is sent, and by the client certificate’s fingerprint before the trust store is consulted, so a denied client is never recorded as waiting. Fingerprint rules may be written in any spelling a PeerId parses. The refusals are Refusal::AddressDenied, PeerDenied and AddressUnknown. For quinn, ServerBuilder::configs gives ServerConfigs, which builds a configuration per connection from its addresses, sharing one session cache, and keeps the refusal its handshake ended with (ConnectionConfig::refusal), since quinn reports only the alert; PeerClientVerifier::builder with addresses is the verifier alone, and Policy::admits_address decides before the handshake. Under optional client authentication a rule naming a fingerprint never admits a client.

§Limits

  • A waiting entry is recorded only after the peer proves it holds the certificate’s key. Each entry stores the address the handshake came from, and the per-source caps (waiting.per_source, waiting.rerecord) apply per IPv4 address or per IPv6 /64.
  • Not provided: a handshake probe, a helper for reading and writing one connection from two threads, and QUIC datagrams.

§Development

ALL=generate,ca,tokio,pin,serde,acl,platform-roots,fields,aws-lc   # every feature but fips
cargo fmt --all --check
cargo clippy --all-targets --features $ALL -- -D warnings
cargo +1.89 clippy --all-targets --features $ALL -- -D warnings
cargo test --features $ALL
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --features $ALL
cargo +nightly-2026-09-21 public-api --features $ALL -sss --color never | diff -u tools/public-api.txt -
cargo test --features fips          # needs CMake and Go

aws-lc builds AWS-LC from C (a C compiler; clang on Windows ARM64). fips builds AWS-LC’s FIPS module (aws-lc-fips-sys: CMake and Go, and on Windows bindgen with libclang, NASM and Ninja) and has global effect: rustls’s fips feature changes defaults for every crate in the build. If bindgen fails with ParseQuote is not implemented for syn::File, cargo paired bindgen 0.73 with prettyplease 0.3; cargo update -p prettyplease --precise 0.2.37 fixes the lockfile. The fips feature adds no item to the API, so the snapshot is taken without it.

§Releasing

This project follows Semantic Versioning and keeps a CHANGELOG.md. Pushing a tag matching v* runs the release workflow: the tests and a strict documentation build gate a GitHub release, marked as a pre-release when the version has a - suffix. The crate is published to crates.io with cargo publish by a maintainer, after coqui-net-acl and coqui-peer.

§License

MPL-2.0; see LICENSE.

Re-exports§

pub use coqui_net_acl as acl;

Modules§

asynch
Async dial and accept over tokio-rustls, for any AsyncRead + AsyncWrite stream.
pair
Pairing: how a joiner and a responder come to accept each other’s keys, over any channel.
prelude
The setter traits of the settings types.

Structs§

Addressed
A stream with the addresses of its connection given, for a stream that cannot name them itself (a pipe, a tunnel, a test double): accept and the pairing functions read them through PeerAddr, so they accept it as they accept a TCP stream.
Alpn
An application protocol name (ALPN) of 1 to 255 bytes, held as text (h2, coqui/1).
Built
A built configuration and the Policy it was built under, so a host can surface the settings that differ from the default policy’s with non_defaults. Nothing is printed by this crate.
CaPolicy
A CA trust policy: certificates signed by the CAs in a PEM file whose subject and subject alternative names match optional globs.
CertificateFields
The identifying fields of a certificate (feature fields).
ClientBuilder
Builds a Built from its settings, filled in layers, and the inputs it takes. build lists everything still missing at once.
ClientParts
What a ClientBuilder collects: the TlsSettings, how the server is verified and the identity to present, if any. Start with ClientBuilder::new.
Clock
The wall clock a TrustStore or a pairing desk reads for expiry and retirement times.
ConnectionConfig
The server configuration of one connection, and the refusal its handshake ended with.
Identity
This side’s certificate and its private key, with the intermediates that issued the certificate when it has any.
IdentityBuilder
Generates a self-signed ECDSA P-256 identity without writing it: Identity::builder, the validity, then generate.
Invitation
A one-time pairing secret: whoever presents it may pair, until it expires or its uses run out.
InvitationOptions
How TrustStore::invite makes an invitation.
KeyMaterial
The public key material a method gives the trust store for one peer, with the name of the method that understands it.
Name
A distinguished name: its text as x509-parser displays it (CN=a, O=b) and its attributes in certificate order, each (short name, value).
NonDefault
A setting whose value differs from its default, as plain data for the caller to show or log.
PairConfig
The TLS side of pairing: the device’s own Policy and the ALPN that marks a pairing connection. Nothing here sets a TLS version or suite; the policy does.
PairDial
A joiner’s pairing connection, past the point where it has something to show (or done).
PeerClientVerifier
Verifies the certificate a client presents to a listening server.
PeerClientVerifierBuilder
Builds a PeerClientVerifier: PeerClientVerifier::builder, the policy and the addresses, then build.
PeerId
Who a peer is: the hash of its public key or certificate, the whole of what one peer is told of another.
PeerIdentity
A verified peer: the certificate the other side proved it holds the key of.
PeerServerVerifier
Verifies the certificate a server presents to a dialing client.
Pins
A set of pinned certificate fingerprints: fixed, or the accepted peers of a TrustStore.
Policy
What a TLS configuration and a trust decision are allowed to do.
Random
A source of cryptographically secure random bytes: invitation secrets, user codes and pairing slots are drawn from it.
Roots
The certificate authorities a client verifies a server against: the chain up to one of them, every certificate’s validity dates and the server name the client dialled.
RotationOptions
How an accepted peer’s key is replaced by its successor.
ServerBuilder
Builds a Built from its settings, filled in layers, and the inputs it takes. build lists everything still missing at once.
ServerConfigs
The server configurations of one listener whose connections reach rustls without this crate’s accept helpers, such as quinn, which runs the verifier on threads of its own and takes a configuration per incoming connection.
ServerParts
What a ServerBuilder collects: the TlsSettings and the two inputs, the identity to present and how client certificates are treated. Start with ServerBuilder::new.
Tls
The TLS method: client and server configurations, each optional, that start handshakes.
TlsHandshake
One TLS handshake, driven by the caller: rustls’s own sans-IO connection.
TlsSettings
What a configuration builder takes whole through fill: the application protocols and the Policy, in the form a file, a form or a peer fills.
TrustStore
Persistent trust: peers an operator accepted, peers that were turned away and wait to be accepted (pairing), open invitations, and announced successor keys.
WaitingEntry
A peer waiting for acceptance.
WaitingLimits
Bounds on the waiting queue.

Enums§

CertificateType
What a peer authenticates with: an X.509 certificate, or a raw public key (RFC 7250).
CipherProfile
A named set of algorithms a Policy allows: cipher suites, key-exchange groups and signature schemes, each profile exactly what its name claims.
ClientAuth
How a server treats the client’s certificate.
Crypto
The crypto provider a policy’s configurations run on.
Digest
The algorithm a PeerId is made with: the <alg> of its <alg>:<hash> text.
KeyAlgorithm
The key algorithm of a generated identity, chosen with IdentityBuilder::key_algorithm.
PeerError
Sanitized failures while loading, storing or using a peer identity. No message holds key material; only CaFile names a path, the file it could not use.
Refusal
Why this side refused a peer: its certificate, or its addresses under a policy’s access control list.
ResponderTrust
How a joiner checks the responder’s certificate on the pairing connection.
RotationEvent
A change of a peer’s key, for the caller to report as it chooses.
San
A subject alternative name.
ServerAuth
How a client verifies the server.
TlsVersion
A TLS protocol version. rustls offers 1.2 and 1.3 only: SSL 3, TLS 1.0 and 1.1 cannot be offered by this crate, and asking for them is an error, never ignored.
Trust
Whom to trust.

Constants§

EXPORTER_LABEL
The label of the TLS exporter (RFC 8446 section 7.5, RFC 5705) that binds a pairing exchange to its connection; 32 bytes with an empty context.
METHOD
The method name under which certificates and raw public keys are kept in a TrustStore.
PAIR_ALPN
The default ALPN of a pairing connection.
SERVER_NAME
The server name dial and TlsHandshake::client send, and the subjectAltName of generated identities. Pinned trust is by fingerprint, so the name carries no meaning there; Roots check the name, so dial a server they verify with dial_named.

Traits§

PeerAddr
A stream that can name the remote address it is connected to.
ReadTimeout
A blocking transport whose reads can be bounded in time, as the _until loops need to end at their deadline.
TrustStoreExt
Certificate-shaped access to a TrustStore.
WriteTimeout
A blocking transport whose writes can be bounded in time, as the _until loops need when the peer stops reading.

Functions§

accept
Accepts a peer over io, completing the handshake before returning.
announce
Announces successor as the next identity of this side, over a connection the current identity authenticated: one framed Rotation message. What follows on the connection is the caller’s protocol.
announce_as
announce for a connection whose peers authenticate as kind: with RawPublicKey the successor is announced by its raw public key, which is what its next handshake presents.
certificate_key
A DER-encoded certificate as the trust store’s key material: method tls, PEM label CERTIFICATE.
crypto_provider
rustls’s ring provider with its defaults. The configurations built here take the provider a Policy selects (Policy::crypto_provider); nothing in this crate installs a process-wide default.
default_server_name
SERVER_NAME as the name rustls takes, for a host that dials with a connector of its own (rustls, tokio-rustls, quinn) and trusts by pins.
dial
Dials a peer over io, completing the handshake before returning.
dial_named
dial sending name as the server name: the host the client dialled, for a server verified by Roots, which check that its certificate is for that name (a DNS name, or an IP address the certificate names). Pinned trust ignores the name.
offers_raw_public_key
Whether a client’s ClientHello offers raw public keys (RFC 7250) in either direction: the server certificate type it will accept, or the client certificate type it will send.
pair_accept
Accepts a pairing connection over stream as identity and runs the responder’s side to its end: redeeming an invitation from store, taking PINs and decisions from desk (this call blocks while the operator decides), and accepting the joiner’s certificate in store. The address of stream is the source the desk throttles by.
pair_client_config
The client configuration of a pairing connection for pairing: an invitation pins the inviter; otherwise responder decides.
pair_dial
Dials a pairing connection over stream as identity and runs pairing until there is something to show, or to its end; PairDial::finish completes it.
pair_server_config
The server configuration of a pairing connection: identity, any client certificate whose key is proven, config’s ALPN and policy. A server on one port serves it to clients that offer the pairing ALPN (asynch::accept_with) and its own configuration to the rest.
public_key_key
A DER-encoded SubjectPublicKeyInfo (a raw public key, RFC 7250) as the trust store’s key material: method tls, PEM label PUBLIC KEY. Its id is the SHA-256 of the SubjectPublicKeyInfo.
random
A Random drawing from the TLS provider’s secure random source, for a PairingDesk and invitations.
receive_announcement
Reads an announcement from sender (the verified peer of this connection) and records it in store as the pending successor of sender’s certificate. Returns the successor’s id. The next handshake that proves it promotes it, unless the store’s rotation options require approval.
with_addresses
Runs work with the connection’s addresses in scope: source is where the verifiers record waiting entries and what a policy’s access control list decides by, and local the address the connection arrived at, which the list needs for rules that name a destination or a port.