Threat model: keys and wrapping
3.1 A malicious or compromised server
Section titled “3.1 A malicious or compromised server”Capability: full access to the database: ciphertext, wrapped keys, salts, commitments and public keys.
What it gains:
- Ciphertext, useless without the AEK.
- Each wrapped AEK and its salt, useless without the passphrase and the Secret Key.
- Public keys, which are not sensitive by design.
- Never the plaintext AEK, the Secret Key or the passphrase.
The defence: PBKDF2 at 600,000 HMAC-SHA-256 iterations makes offline passphrase guessing expensive. With a 128-bit Secret Key, which never reaches the server, the server can’t brute-force the wrapping key even with unlimited compute.
Residual risk: a weak passphrase without a Secret Key is only as strong as the passphrase. Callers should enforce a minimum strength or mandate the Secret Key. What a server can do in a join, rather than offline, is §4.
3.2 Offline brute force against a stolen wrapped key
Section titled “3.2 Offline brute force against a stolen wrapped key”Capability: a dictionary or brute-force attack on a { wrappedKey, salt } pair taken from the server or a backup.
The defence:
- PBKDF2 at 600,000 iterations costs about 200–500 ms per guess on modern hardware.
- A 128-bit random Secret Key raises the key space to 2¹²⁸ × the passphrase space, out of reach even for specialised hardware.
- Each wrap has its own random salt, so precomputed (rainbow table) attacks don’t apply.
3.3 Tampering with ciphertext
Section titled “3.3 Tampering with ciphertext”Capability: flip bits in a stored or transmitted ciphertext.
The defence: AES-256-GCM is authenticated. Any change to the ciphertext, the IV or the AAD makes unseal(),
unsealMessage() and unsealEnvelope() throw, and the tampered bytes never reach the caller. There is no
decrypt-and-ignore-the-tag path. §6.1 says what the AAD adds for records and blobs.
3.4 A network attacker
Section titled “3.4 A network attacker”Capability: watch or change HTTP traffic.
With TLS the attacker sees ciphertext and wrapped keys only. Without TLS they can serve a malicious JavaScript bundle and defeat everything. Conseal doesn’t manage transport: callers must serve their app over HTTPS.
3.5 The library leaking keys
Section titled “3.5 The library leaking keys”Concern: that Conseal sends key material somewhere.
The defence: Conseal is open source and auditable. Its core makes no network requests. Sync makes only the
requests the app’s transport sends, to the app’s own backend, and carries no key the server could open. Key material
goes only to SubtleCrypto, which enforces extractable: false on stored keys, so no JavaScript, Conseal’s included,
can read their bytes out of IndexedDB.
3.6 Algorithms
Section titled “3.6 Algorithms”| Primitive | Algorithm | Parameters | Why |
|---|---|---|---|
| Symmetric encryption | AES-GCM | 256-bit key, 12-byte IV, 128-bit tag | NIST standard; authenticated; hardware-accelerated in all modern CPUs and browsers |
| Key derivation | PBKDF2-HMAC-SHA256 | 600,000 iterations, 16-byte random salt | RFC 8018; NIST SP 800-132 recommends ≥ 210,000 for SHA-256; broad browser support |
| Key wrapping | AES-GCM | 256-bit wrapping key from PBKDF2, 12-byte random IV before the wrapped key, 128-bit tag | Authenticated on every engine, so a wrong passphrase or Secret Key throws. Not AES-KW: WebKit doesn’t enforce its integrity check, so a wrong credential could return garbage instead of throwing |
| Key agreement | ECDH | NIST P-256 | Widely available in SubtleCrypto; adequate for this model; no dependencies |
| Signatures | ECDSA | NIST P-256, SHA-256 | As ECDH; P-256 is WebCrypto’s baseline curve |
| Hashing | SHA-256 | — | Universal; PBKDF2’s PRF and the standalone digest |
| Mnemonic encoding | BIP-39 | 24 words (256-bit entropy + 8-bit checksum) | A human-writeable offline backup; well specified; implemented by @scure/bip39 |
| Mnemonic to AEK | HKDF-SHA-256 | Empty salt, info conseal-mnemonic-aek-v1 |
The entropy is already uniform; the label keeps this key apart from any other use of the same entropy |
| Verification code | SHA-256 | First 80 bits, as 16 Crockford base32 characters: XXXX-XXXX-XXXX-XXXX |
A server relaying a join needs a key whose code matches: 2⁸⁰ tries is out of reach live and as a precomputed table, where 32 bits falls to one GPU in under a minute. The alphabet has no I, L, O or U, so no two characters look alike |
| Passphrase check | PBKDF2-HMAC-SHA256 | 200,000 iterations, random salt | Lets the joining device confirm the passphrase, sealed so the server can’t guess against it (§4.2) |
| Records and blobs | AES-GCM | A fresh 256-bit DEK per write and per blob, AAD conseal-sync:v1:<collectionId>:<recordId>, and :<blobId> for a blob |
Binds each ciphertext to its place (§6.1) |
| Sealed backup | AES-GCM | A random key wrapped like the AEK, one AES-GCM chunk per 1 MiB, each with an AAD naming the backup, the chunk’s place and whether it’s the last | Streams both ways, and a changed, dropped, moved or truncated chunk fails (§9) |
| Randomness | crypto.getRandomValues |
— | A CSPRNG from the browser or OS; no user-space RNG |