Skip to main content

Module crypto

Module crypto 

Source
Expand description

Capsule’s cryptographic data plane.

Every primitive identity (hash, KDF, AEAD, signature scheme, suite id) is the single source of truth declared in the design docs under design/cryptography/ and pinned in code by primitives. Submodules are layered strictly in dependency order:

hash · primitives · rng · kdf · pwkdf        (foundation, no internal deps)
  └─ keys ─ encryption                        (key hierarchy + AEAD)
  └─ keys ─ membership                        (the owner-signed album roster)
  └─ authority ─┐
  └─ provenance ┴─ verify_asset               (the single acknowledgement chokepoint)
                   └─ verify_derivative       (its derivative-manifest arm)

The cryptographic layer is deliberately self-contained and side-effect-free (no network, no global state), so the whole data plane is unit-testable offline against RFC / FIPS known-answer vectors and exhaustive negative cases.

Modules§

authority
The album authorization seam — exactly what verify_asset needs to learn from MLS about an album, behind a trait so the real OpenMLS group state can drop in later.
encryption
Asset and metadata encryption — the only place AES-256-GCM is invoked for user data.
hash
SHA-256 content hashing — the one hash algorithm Capsule uses everywhere (content addressing, integrity verification, provenance chaining).
kdf
HKDF-SHA512 key derivation (SSoT: Cryptography — Primitives § Key Derivation).
keys
Capsule’s key hierarchy (SSoT: Cryptography — Keys).
membership
The album roster attestation — the one membership fact a key-free server can verify.
primitives
The single source of truth, in code, for Capsule’s cryptographic primitive set.
provenance
Signed manifests and append-only provenance chains (SSoT: Cryptography — Provenance).
pwkdf
Password-based key wrapping: Argon2id derives a wrapping key from a passphrase / recovery code, which then seals a secret under AES-256-GCM. Used for the master-key escrow and backup wrap key (SSoT: Cryptography — Primitives § Password-based KDF).
receipts
Custody receipts — the server-signed complement of the client-signed provenance chain (SSoT: Transfer — Durability: Custody Receipts).
revoke
The master-key proof that authorizes a global sign-out (SSoT: Authentication — Explicit Revocation).
rng
OS CSPRNG access. Every key, salt, and nonce is drawn here; Capsule never seeds its own PRNG (SSoT: Cryptography — Primitives § Randomness).
storage_attestation
Signed storage attestations — the durability verdict in a form a client can keep (SSoT: Transfer — Durability: Signed Storage Attestation).
upgrade
The album-upgrade ceremony’s wire vocabulary — the parts both ends need and neither end needs MLS for.
verify_asset
The single asset-acknowledgement chokepoint (SSoT: Keys — Write Authorization).
verify_derivative
The derivative-manifest arm of the acknowledgement chokepoint (SSoT: Cryptography — Provenance § Derivative Provenance).

Enums§

CryptoError
Errors surfaced by the cryptographic layer.