Encryption

Tier encrypts at two independent layers. The transport protects each node-to-node connection. Sealed messages protect application data end to end, so a communicator that relays a message forwards only ciphertext.

Transport

  • QUIC over UDP (ngtcp2) with TLS 1.3 only (OpenSSL 3.5). Older TLS versions are not offered.
  • Key exchange groups, in order of preference: X25519MLKEM768 (hybrid post-quantum), then X25519 as a compatibility fallback.
  • Each node presents a self-signed Ed25519 certificate carrying its identity key. The peer's ID is the SHA-256 of the key it presents; there is no external PKI (see Node identity).
  • The ALPN token is tier/0/<network>. A node accepts a connection only if the peer offers its exact protocol and network token, so nodes of different networks or protocol versions do not connect.

Sealed messages

An application message is sealed by the sending node to the recipient node's long-term encryption keys (derived from its seed, see Seed and derived keys) and signed with the sender's Ed25519 identity key. The recipient gets confidentiality (only it can decrypt) and sender authenticity (it knows who sent the message and that nothing was changed). Messages between users add a user envelope inside the sealed plaintext (see User messages).

The recipient's encryption keys come from its signed enc_keys announcement on a direct connection, or from its signed presence record when resolved through a communicator.

Suites

The sender chooses a suite per message and tags it in the envelope:

SuiteShared secretThen
classicalX25519: a fresh ephemeral key per message, agreed with the recipient's X25519 key.HKDF-SHA256, then ChaCha20-Poly1305
hybrid (default)Both: the X25519 secret followed by the ML-KEM-768 secret.
pqML-KEM-768: encapsulation to the recipient's ML-KEM key, a 1088-byte ciphertext.

hybrid stays confidential if either X25519 or ML-KEM is later broken. classical interoperates with peers without post-quantum support; pq is for a fully post-quantum posture. In the messenger the default can be set globally and per contact; tierctl send and send-user take it as an argument.

Construction

  1. Build the key material ikm from the suite's shared secret or secrets.
  2. Derive a 12-byte nonce: HKDF-SHA256(ikm, salt = empty, info = "nonce").
  3. Build the header: "tier-msg-hdr-v1", the network name, the suite, the sender ID, the recipient ID, the ephemeral X25519 public key (if any), the ML-KEM ciphertext (if any), and the nonce.
  4. Derive the 32-byte key: HKDF-SHA256(ikm, salt = empty, info = header). The key is therefore bound to every header field.
  5. Encrypt with ChaCha20-Poly1305, using the header as associated data.
  6. Sign "tier-msg-sig-v1" || header || ciphertext length || ciphertext with the sender's Ed25519 identity key.

Each message gets a fresh ephemeral X25519 key or ML-KEM encapsulation, so its key is unique and the nonce cannot repeat under the same key. A sealed message carries at most 60000 bytes of plaintext, so the whole envelope fits one transport frame for every suite.

Opening

The recipient accepts a message only if all of these hold:

  • the claimed sender ID is the SHA-256 of the identity key that the connection authenticated;
  • the signature verifies under that key;
  • the message is addressed to this node and to this network;
  • decryption succeeds.

Malformed or unauthenticated input is dropped.

What others can see

  • On the wire: QUIC/TLS traffic between nodes: addresses, ports, timing, and sizes.
  • A relaying communicator: the sender and recipient IDs from the sealed header, the suite, sizes, and timing; never the plaintext. Communicators also see presence and enrollment metadata: which IDs are online and from which addresses.
  • The recipient: the plaintext and the authenticated sender.

Sealed messages are encrypted to the recipient's long-term keys, without a ratchet. Each hop is protected by TLS 1.3 with ephemeral key exchange, but whoever stores sealed ciphertext, for example a relaying communicator, could decrypt it if the recipient's seed is later compromised. Protect seeds accordingly.

Local data

Encryption covers data in transit. Data at rest is not encrypted by Tier: identity seeds are files with mode 0600, the messenger history is an unencrypted SQLite database, and the collector store is plain files. Use operating-system account security or disk encryption.