Expand description
§coqui-peer-tls
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.1is a pre-release: the API may change in any release before 1.0.
§Features
- Certificate ids: a certificate’s id is
coqui-peer’sPeerId, the SHA-256 of the certificate, writtensha256:<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 bareSubjectPublicKeyInfo(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:
intermediateby default (TLS 1.2 and 1.3), withmodern(TLS 1.3 only) andlegacypresets; settings that differ from the default are reported as data, never refused. A policy can carry an access control list, applied by address at theClientHelloand 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
dialandacceptover anyRead + Write, async ones over tokio; the sans-IOcoqui-peermethod 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’sserverCertificateHashes. - 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| Feature | Adds | Needed for | Default |
|---|---|---|---|
generate | rcgen, time | Identity::generate, Identity::builder, open_or_create | off |
fields | x509-parser | CertificateFields: a certificate’s names, SANs (UPN included), serial and validity, as a map to pick identities from | off |
ca | fields, globset | Trust::Ca, Trust::PinnedOrCa, CaPolicy | off |
tokio | tokio, tokio-rustls, coqui-peer/tokio | module asynch: async dial, accept, pairing and rotation | off |
pin | coqui-peer/pin | PIN pairing | off |
serde | serde, coqui-builder/serde, coqui-peer/serde | Policy read through any serde format, the settings types filled from one into a coqui_builder::Partial, and PeerId as text | off |
acl | coqui-net-acl | an access control list inside a Policy | off |
platform-roots | rustls-platform-verifier | Roots::platform: servers verified by the operating system | off |
aws-lc | rustls’s aws-lc-rs provider (AWS-LC, built from C) | crypto = "aws-lc": ML-KEM key exchange, ML-DSA, the cnsa-2.0 profile | off |
fips | aws-lc and rustls’s fips (AWS-LC’s FIPS module) | the fips-140-3-validated profile; global, see Development | off |
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
| Module | Purpose |
|---|---|
coqui_peer_tls | Identity, 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::prelude | The setter traits of the settings types (TlsSettingsSetters, PolicySetters, PairConfigSetters), for a builder in another crate that holds them. |
coqui_peer_tls::asynch | Async dial, accept, pairing and rotation over tokio (tokio). |
coqui_peer_tls::pair | coqui-peer’s pairing exchange, re-exported. |
coqui_peer_tls::acl | coqui-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.
| Field | modern | intermediate (default) | legacy |
|---|---|---|---|
tls_versions | 1.3 | 1.2, 1.3 | 1.2, 1.3 |
cipher_suites, kx_groups | all the provider has | same | same |
pin_digests | sha256, sha384, sha512 | same | plus sha1 |
check_validity | true | true | true |
allow_chain_when_pinned | false | false | false |
allow_resumption | false | false | false |
require_ems | true | true | false |
waiting (per_source / total / rerecord) | 16 / 1000 / 60 s | same | same |
acl | none | none | none |
certificate | x509 | x509 | x509 |
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_validityandallow_chain_when_pinnedhave nothing to decide). - Only pinned trust and
AnyWithKeyProofapply: a trust that needs a chain or a name (roots, a CA) is aPeerError::Policy. A store records a stranger that proved its key asPUBLIC KEYmaterial 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.0takes an ECDSA P-384 key,cnsa-2.0an 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 withoffers_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:
| Profile | What it is |
|---|---|
mozilla | Mozilla’s server-side TLS guideline 6.0, intermediate. The default. |
fips-140-3-compliant | FIPS 140-3 approved algorithm selection; not a validated module. |
fips-140-2-compliant | The 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-validated | AWS-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.0 | CNSSP 15 / RFC 9151 as far as rustls goes: AES-256-GCM, P-384, SHA-384. |
cnsa-2.0 | CNSA 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 get | Write |
|---|---|
| a server that requires a pinned or CA-trusted client | ServerBuilder::new().identity(&identity).client_auth(ClientAuth::Required(trust)) |
| a server that asks for no client certificate | ServerBuilder::new().identity(&identity).client_auth(ClientAuth::None) |
| a server whose clients a verifier of your own decides | ServerBuilder::new().identity(&identity).client_auth(ClientAuth::Verifier(verifier)) |
| a client | ClientBuilder::new().server(trust), with .identity(&me) to present a certificate |
| a client verified by a verifier of your own | ClientBuilder::new().server(ServerAuth::Verifier(verifier)) |
| a server configuration per connection (quinn) | ServerBuilder::new()...configs() |
| a server’s client verifier for one connection | PeerClientVerifier::builder(&trust).policy(p).addresses(source, local).build() |
| a client’s server verifier | PeerServerVerifier::new(&trust, &policy) |
| a stream that cannot name its addresses | accept(config, Addressed::new(io, source).local(local)) |
| a pairing configuration | PairConfig::default(), then assign alpn, timeout or policy |
| a generated identity with a validity window | Identity::builder().valid_for(..).generate(), or .not_before(..).not_after(..) |
| a generated identity with another key | Identity::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 Goaws-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 anyAsyncRead + AsyncWritestream. - 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):
acceptand the pairing functions read them throughPeerAddr, 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
Policyit was built under, so a host can surface the settings that differ from the default policy’s withnon_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.
- Certificate
Fields - The identifying fields of a certificate (feature
fields). - Client
Builder - Builds a
Builtfrom its settings, filled in layers, and the inputs it takes.buildlists everything still missing at once. - Client
Parts - What a
ClientBuildercollects: theTlsSettings, how the server is verified and the identity to present, if any. Start withClientBuilder::new. - Clock
- The wall clock a
TrustStoreor a pairing desk reads for expiry and retirement times. - Connection
Config - 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.
- Identity
Builder - Generates a self-signed ECDSA P-256 identity without writing it:
Identity::builder, the validity, thengenerate. - Invitation
- A one-time pairing secret: whoever presents it may pair, until it expires or its uses run out.
- Invitation
Options - How
TrustStore::invitemakes 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.
- Pair
Config - The TLS side of pairing: the device’s own
Policyand the ALPN that marks a pairing connection. Nothing here sets a TLS version or suite; the policy does. - Pair
Dial - A joiner’s pairing connection, past the point where it has something to show (or done).
- Peer
Client Verifier - Verifies the certificate a client presents to a listening server.
- Peer
Client Verifier Builder - Builds a
PeerClientVerifier:PeerClientVerifier::builder, the policy and the addresses, thenbuild. - PeerId
- Who a peer is: the hash of its public key or certificate, the whole of what one peer is told of another.
- Peer
Identity - A verified peer: the certificate the other side proved it holds the key of.
- Peer
Server Verifier - 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.
- Rotation
Options - How an accepted peer’s key is replaced by its successor.
- Server
Builder - Builds a
Builtfrom its settings, filled in layers, and the inputs it takes.buildlists everything still missing at once. - Server
Configs - 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.
- Server
Parts - What a
ServerBuildercollects: theTlsSettingsand the two inputs, the identity to present and how client certificates are treated. Start withServerBuilder::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 thePolicy, in the form a file, a form or a peer fills. - Trust
Store - Persistent trust: peers an operator accepted, peers that were turned away and wait to be accepted (pairing), open invitations, and announced successor keys.
- Waiting
Entry - A peer waiting for acceptance.
- Waiting
Limits - Bounds on the waiting queue.
Enums§
- Certificate
Type - What a peer authenticates with: an X.509 certificate, or a raw public key (RFC 7250).
- Cipher
Profile - A named set of algorithms a
Policyallows: cipher suites, key-exchange groups and signature schemes, each profile exactly what its name claims. - Client
Auth - How a server treats the client’s certificate.
- Crypto
- The crypto provider a policy’s configurations run on.
- Digest
- The algorithm a
PeerIdis made with: the<alg>of its<alg>:<hash>text. - KeyAlgorithm
- The key algorithm of a generated identity, chosen with
IdentityBuilder::key_algorithm. - Peer
Error - Sanitized failures while loading, storing or using a peer identity. No message holds key
material; only
CaFilenames 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.
- Responder
Trust - How a joiner checks the responder’s certificate on the pairing connection.
- Rotation
Event - A change of a peer’s key, for the caller to report as it chooses.
- San
- A subject alternative name.
- Server
Auth - 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
dialandTlsHandshake::clientsend, and the subjectAltName of generated identities. Pinned trust is by fingerprint, so the name carries no meaning there;Rootscheck the name, so dial a server they verify withdial_named.
Traits§
- Peer
Addr - A stream that can name the remote address it is connected to.
- Read
Timeout - A blocking transport whose reads can be bounded in time, as the
_untilloops need to end at their deadline. - Trust
Store Ext - Certificate-shaped access to a
TrustStore. - Write
Timeout - A blocking transport whose writes can be bounded in time, as the
_untilloops need when the peer stops reading.
Functions§
- accept
- Accepts a peer over
io, completing the handshake before returning. - announce
- Announces
successoras the next identity of this side, over a connection the current identity authenticated: one framedRotationmessage. What follows on the connection is the caller’s protocol. - announce_
as announcefor a connection whose peers authenticate askind: withRawPublicKeythe 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 labelCERTIFICATE. - crypto_
provider - rustls’s ring provider with its defaults. The configurations built here take the provider a
Policyselects (Policy::crypto_provider); nothing in this crate installs a process-wide default. - default_
server_ name SERVER_NAMEas 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 dialsendingnameas the server name: the host the client dialled, for a server verified byRoots, 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
ClientHellooffers 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
streamasidentityand runs the responder’s side to its end: redeeming an invitation fromstore, taking PINs and decisions fromdesk(this call blocks while the operator decides), and accepting the joiner’s certificate instore. The address ofstreamis the source the desk throttles by. - pair_
client_ config - The client configuration of a pairing connection for
pairing: an invitation pins the inviter; otherwiseresponderdecides. - pair_
dial - Dials a pairing connection over
streamasidentityand runspairinguntil there is something toshow, or to its end;PairDial::finishcompletes 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: methodtls, PEM labelPUBLIC KEY. Its id is the SHA-256 of theSubjectPublicKeyInfo. - random
- A
Randomdrawing from the TLS provider’s secure random source, for aPairingDeskand invitations. - receive_
announcement - Reads an
announcement fromsender(the verified peer of this connection) and records it instoreas the pending successor ofsender’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
workwith the connection’s addresses in scope:sourceis where the verifiers record waiting entries and what a policy’s access control list decides by, andlocalthe address the connection arrived at, which the list needs for rules that name a destination or a port.