Skip to content
Trapdoor·Lab

OPAQUE — a password the server never sees

1Toy

The password stays in the browser

In an ordinary login the browser sends the password over TLS. The server runs Argon2id on it and compares the result with its database, as on the Passwords & salt station. TLS protects the password in transit, but the server sees it at every login and can store it by mistake. In March 2019 Facebook admitted that the passwords of hundreds of millions of Facebook Lite users and tens of millions of other users had been stored in a readable format in its internal systems.

OPAQUE from RFC 9807 (July 2025) is an augmented password-authenticated key exchange (augmented PAKE, aPAKE). Augmented, or asymmetric, because the two sides know different things: the client knows the password, while the server holds a record from which it cannot read the password. The password never leaves the browser, neither at registration nor at login, and after a successful login both sides share a session key. The server becomes convinced that the client knows the password without learning it — that is why OPAQUE sits next to zero-knowledge proofs on the map. Formally, though, it is a key exchange, not a zero-knowledge proof like the one on the ZKP: the cave station.

The core of the protocol is an oblivious pseudorandom function (oblivious PRF, OPRF) from RFC 9497. Its output depends on the password and on the server’s secret key, and without that key it looks like random bytes. “Oblivious”, because the two sides compute it together: the server adds the key without seeing the password, and the client gets the output without learning the key.

First the browser turns the password into a point on the P-256 curve: P = HashToGroup(password), following RFC 9380. Then comes blinding: the browser multiplies the point by a random number r and sends only M = r · P. For any password M is a random point on the curve, so the server learns nothing from it, not even with unlimited computing power (RFC 9497 §7.1). Multiplying a point by a number is shown on the Elliptic curves station.

The server multiplies M by this account’s OPRF key k and sends back Z = k · M. It derives k from one secret, oprf_seed, and the account identifier (credential_identifier in the RFC, credentialId in the toy), so every account has a different one (§5.2.2). The browser multiplies Z by the inverse r⁻¹ modulo the curve order (the Modulo p station) and gets N = k · P, because r cancels out. The OPRF output is the SHA-256 hash (Hash functions) of the password and N (RFC 9497 §3.3.1). So the same password on the same account always gives the same output, whatever r was.

The browser stretches the OPRF output with Argon2id — in the RFC a key stretching function (KSF). HKDF-Extract combines both outputs, before and after stretching, into randomized_password (§5.2.3, the HKDF station). The Argon2id salt here is 16 zero bytes (section 7), because the OPRF key already is the secret salt (§10.11). The client runs Argon2id, not the server: the server does not pay for it at login, but the parameters have to suit the weakest client devices (§10.8).

From randomized_password the browser first derives masking_key, which the server uses only to defend against client enumeration, i.e. checking whether a given account exists (§5.1). Then it creates the envelope: it draws the envelope’s nonce and from it and randomized_password derives auth_key, export_key and the client’s key pair (§4.1.2). The envelope is only that nonce and auth_tag: an HMAC under auth_key over the nonce, the server’s public key and the identities of both sides. The client’s private key is stored nowhere, because the right password (with the server’s help) and the nonce derive it anew. export_key stays with the client: the server does not know it, and an application can use it to encrypt its own data (§10.4).

The server receives the registration record, 129 bytes: the client’s public key (33 B), masking_key (32 B) and the envelope (64 B) (§5.1). It holds neither the password nor a hash of the password alone. The server also keeps two secrets shared by all accounts: oprf_seed and its own private key. Registration needs a confidential channel such as TLS, because masking_key travels in the record (§10.10).

The toy talks to this site’s real server, but it is a protocol demonstration, not a login. No session, cookie or Trapdoor Lab account comes out of it, and the site itself has no password login. Register an account and walk through the six registration steps. Then log in with the right password, and then with a wrong one.

Toy implementation — not for productionOPAQUE-3DH of RFC 9807 (P-256) on toy curve arithmetic (BigInt, not constant-time) — unsafe outside learning. Real OPAQUE: a library that passes the RFC 9807 vectors, such as opaque-ke.

OPAQUE with this site’s server

You create an account on this site’s demo server and log in to it with the OPAQUE protocol. The password never leaves the browser — not at registration, not at login. This is not a login to the site: no session, cookie or Trapdoor Lab account comes out of it.

16 / 128 B

The password must be 1 to 128 B of UTF-8.

The account lives only in the demo server’s memory: it is gone after 24 h or when the server restarts. After that the server answers with a fake record, and a login looks exactly like a wrong password.

Type a password and register an account. Registration is two requests to the server; then you walk through it step by step.

Login is three messages (section 6). KE1 (98 B) carries a new blinding of the password, a client nonce and the client’s ephemeral key, i.e. a key pair for this login only. KE2 (259 B) carries Z, the server’s nonce and ephemeral key, and server_mac. It also carries a masking nonce (masking_nonce) and a masked response: the server’s public key and the envelope XOR a stream from masking_key and the masking nonce (§6.3.2.2). The browser unblinds Z, runs Argon2id, removes the mask and checks auth_tag. A wrong password gives another masking_key, so removing the mask leaves random bytes and auth_tag does not match.

The opened envelope yields the client’s private key, and 3DH starts: three Diffie–Hellman exchanges as on the ECDH station (§6.4). The client’s ephemeral key meets the server’s ephemeral and long-term keys, and the client’s long-term key meets the server’s ephemeral key. On the server side only the owner of the server’s private key can compute the second exchange, and on the client side only whoever opened the envelope can compute the third. The first gives forward secrecy: the session key does not leak when the long-term keys leak later. From the three results HKDF derives the session key and the MAC keys: the client checks server_mac, and KE3 is client_mac, with which the server checks the client.

The toy runs the P256-SHA256 suite with Argon2id, one of the three recommended in section 7. The others are ristretto255 with Argon2id and P-256 with scrypt; we chose P-256 because the arithmetic of the Elliptic curves station is on it. The same code reproduces byte for byte the RFC 9807 test vectors of Appendix C (C.1.5, C.1.6 and the fake record C.2.3), RFC 9497 A.3.1 and RFC 9380 J.1.1.

The toy differs from a real deployment first in its arithmetic and its Argon2id parameters. The curve arithmetic in the browser and on the server runs on big integers (BigInt, BigInteger) and is not constant-time, although the RFC says it should be (§9.1). Argon2id has the OWASP parameters of the Passwords & salt station: m = 19 MiB, t = 2, p = 1 (memory, number of passes, degree of parallelism). The RFC recommends m = 221 KiB (2 GiB), t = 1, p = 4. On the laptop we tested the station on, the recommended Argon2id took about 12 s in pure JavaScript, and about 0.2 s with the OWASP parameters. The toy runs it at every registration, every login and every guess of the attack.

The demo server differs too. An account lives in its memory for at most 24 hours and is gone after a restart — a login then looks exactly like a wrong password. In answer to KE3 the server sends back the first 8 bytes of its session key’s SHA-256, so the toy can compare both sides’ keys. In RFC 9807 nothing comes back after KE3: the server checks client_mac and keeps the session key to itself (§6.2.4).

2Break it

Breaking into the server

On the Passwords & salt station a table computed before the leak cracked an unsalted database by lookup alone. A salt spoils such a table, but only if the attacker does not know it in advance. Older aPAKE protocols such as SRP send the salt to anyone who gives a username (RFC 2945 §3), so a table for a chosen account can be computed before the breach. Jarecki, Krawczyk and Xu showed that earlier aPAKEs allow such a pre-computation attack, and designed OPAQUE to resist it (EUROCRYPT 2018). On the map it is the attack “Tables precomputed before a breach”.

In OPAQUE the OPRF key plays the role of the salt, and the server gives it to no one (§10.11). Before a breach the attacker can compute only what needs no server secret: the passwords themselves, their SHA-256 and Argon2id of each password. The toy below computes these 60 values for 20 words and looks for them at every position of three stolen records. It finds none, because every byte of a record depends on the OPRF key or on a random nonce. That is why this attack has the status “resistant” on the map.

A full breach is another matter. Whoever steals the records together with oprf_seed checks passwords offline. For every word they compute an OPRF under the account’s key (without blinding, since they hold the key), run Argon2id and check the envelope’s auth_tag. The RFC says plainly that a compromised server can always guess this way — the price of any single-server aPAKE (§10.11). Avoiding it takes splitting the OPRF key across several servers (a threshold OPRF, TOPPSS), which RFC 9807 leaves out of scope (§10.1).

So cost is what protects. Every guess is a full Argon2id run, and every account is a separate attack, because another account identifier gives another OPRF key. In the toy the accounts alicja and celina have the same password, yet each costs its own 12 guesses.

The toy measures the cost of a guess on your device. On our test laptop the same code in Node.js took about 0.25 s per guess, almost all of it Argon2id. At that rate a million words on one account take about 3 days, and on a million accounts almost 8,000 years. An attacker will be faster with native code on many cores, but every parallel Argon2id run needs its own 19 MiB.

This site’s real server has no endpoint that would give away records or keys, so the toy breaks into a server simulated in your browser. Compute the table and search the records with it, then attack each account with the dictionary in turn.

Toy implementation — not for productionOPAQUE-3DH of RFC 9807 (P-256) on toy curve arithmetic (BigInt, not constant-time) — unsafe outside learning. Real OPAQUE: a library that passes the RFC 9807 vectors, such as opaque-ke.

Breaking into an OPAQUE server

You are on the attacker’s side. The server is simulated in your browser: three accounts registered with real OPAQUE and Argon2id. This site’s real server has no endpoint that would give away records or keys.
When you attack

Dictionary: 20 common passwords (this site’s list). Every word is a full Argon2id run (m = 19,456 KiB) — real attackers have lists of millions of passwords from earlier leaks.

Before you break in, you can compute everything that needs no server secret: the words themselves, their SHA-256 and Argon2id of each word with this station’s parameters. Then you search the stolen records for them.

Registering three accounts on the simulated server (the client runs Argon2id for each)…

This site’s server shows another defence instead: against client enumeration. To an unknown identifier it answers with a fake record — a random public key, a random masking_key and an envelope of zeros — created once for all unknown accounts (§6.3.2.2). KE2 has the same 259 B, the mask hides the envelope’s zeros, and the envelope fails exactly as with a wrong password. Try it with the missing-account switch in the toy above. Registration is different: the server has to answer differently for a taken identifier, so the RFC advises rate-limiting it (§10.9).

OPAQUE does not stop online guessing: anyone can send KE1 with the next password and see whether the envelope opens. The client already knows after KE2, so the RFC advises treating a missing KE3 as a failed login (§9.2). This site’s server accepts 30 requests a minute from one IP address (IPv6: one /64 network); a real system also counts attempts per account.

Nor does OPAQUE protect the password from the page you type it into. The password is blinded by JavaScript sent by the same server, so a compromised server or a swapped script sends the password elsewhere before anything is blinded. RFC 9807 lists cases in which TLS itself fails: attacks on the certificate infrastructure (PKI), certificate mishandling and an intermediary that terminates TLS before the server. OPAQUE protects the password from the database, the logs and such an intermediary. In the browser, though, you still trust the page’s code, which comes over TLS too. How a site can protect its own scripts is shown on the CSP & headers station.

The map’s second attack is quantum. Blinding protects the password unconditionally, but the key k only computationally: deriving k from M and Z is a discrete logarithm on P-256. This curve has about 128 bits of security (NIST SP 800-57, part 1, table 2 — as on the ECDH station). RFC 9497 bases the pseudorandomness of the output on a related assumption about the hardness of the Diffie–Hellman problem (§7.2.1). The discrete logarithm on the curve — in the OPRF and in 3DH — falls to Shor’s algorithm on a large enough quantum computer.

From a recorded M (from KE1) and Z (from KE2) such an attacker thus derives the OPRF key k. Then they guess the password offline against the masked response in KE2 — as after a breach, but only for recorded logins (Appendix B). The RFC adds that over a TLS channel obtaining such a KE2 takes a targeted active attack. That assumption holds as long as TLS itself resists a quantum computer, for example through a hybrid with ML-KEM.

The attacker recovers the session key of a recorded login only once they also learn the client’s public key. The third DH exchange needs it (§6.4.4), and it is not in KE1, KE2 or KE3 — it sits in the record and follows from the password. A post-quantum key exchange in place of 3DH would protect the session key, but not the password, as long as the OPRF stays on the curve (Appendix B). That is why this attack has the status “quantum-threatened” on the map.

3In the real world

Where OPAQUE runs

  • RFC 9807 (IRTF CFRG)The OPAQUE specification of July 2025, an informational document of the CFRG research group — it says of itself that it is not an IETF standard. It describes the core protocol and a 3DH instantiation, recommends three suites (ristretto255 and P-256 with Argon2id, and P-256 with scrypt) and gives test vectors. The security proof comes from the EUROCRYPT 2018 paper by Jarecki, Krawczyk and Xu.Source (RFC 9807 (IRTF CFRG))
  • WhatsApp and Messenger backupsSince 2021 WhatsApp has offered end-to-end encrypted backups. The encrypted backup key sits in a vault of hardware security modules (HSMs) in several data centres, which releases it only after an OPAQUE login — and never learns the password. The vault counts an attempt already at the first login message and after a certain number of failures makes the key permanently inaccessible. According to the whitepaper (version 3, October 2026) Messenger uses the vault too. For backups stored by WhatsApp itself and protected by a password, export_key protects the Encapsulation Key, which encrypts the Backup Root Key. RFC 9807 gives end-to-end encrypted backups as an example use for which export_key was introduced, and points to the first version of this whitepaper, from 2021 (§10.1).Source (WhatsApp and Messenger backups)
  • opaque-keAn OPAQUE implementation in Rust by Meta, based on RFC 9807; its tests reproduce the Appendix C vectors, P-256 included. NCC Group reviewed it in June 2021 on behalf of WhatsApp — version 0.5.0, which still followed a draft of the specification; the fixes went into version 1.2.0. Later releases were not covered by that audit.Source (opaque-ke)
  • @serenity-kit/opaqueA library for the browser and Node.js: opaque-ke compiled to WebAssembly, with a P-256 variant in a separate package. By default it runs Argon2id with m = 216 KiB (64 MiB), t = 3, p = 4, the second option of RFC 9106. With the RFC 9807 parameters (m = 221 − 1 KiB, because the full 221 crashed in the browser) a registration and a login take about 13 s each on a MacBook Pro M1, according to the authors. A code review and penetration test were done by 7ASecurity in OTF’s Red Team Lab programme.Source (@serenity-kit/opaque)
4Take it to your project

A library, a fake record and an attempt limit

Good practice

Use a library that passes the RFC 9807 Appendix C vectors, such as opaque-ke or its JavaScript wrapper @serenity-kit/opaque, and check that it computes in constant time (§9.1). Pick the Argon2id parameters for the weakest client device (§10.8). Changing them needs a new registration, because the server does not know the password and cannot recompute the record itself (section 8) — do it right after a successful login. Check password rules (length, a breach list) in the browser: the RFC advises against the server learning the password just to check it (§10.11).

Answer an unknown identifier with a fake record through the same code path, and rate-limit registration (§10.9). Count every KE1 as a failed attempt until a valid KE3 arrives (§9.2), per account and per IP address. Keep the records in the database, and oprf_seed and the server’s private key in a secrets vault, because a leaked oprf_seed exposes every account (§10.9). The private key can live in an HSM, since the server only needs DH results (§10.12). Register over TLS. Use export_key only after the envelope has opened (Appendix A), and derive application keys from it with HKDF, one label per purpose.

JavaScript
import * as opaque from '@serenity-kit/opaque'; // opaque-ke in WebAssembly

// login/start: an unknown account → registrationRecord null, i.e. the fake record
const registrationRecord = (await records.get(userIdentifier)) ?? null;
await failures.add(userIdentifier, ip); // KE1 is a failure until KE3 takes it back
const { loginResponse, serverLoginState } = opaque.server.startLogin({
  serverSetup: secrets.OPAQUE_SERVER_SETUP, // oprf_seed and the server key, not from the record database
  userIdentifier,
  registrationRecord,
  startLoginRequest,
});
await logins.put(loginId, serverLoginState, { ttlSeconds: 120, singleUse: true });
Anti-pattern

Do not hash the password in the browser to send the hash instead: the hash then becomes the password, and its leak from logs or a database is enough to log in. Do not answer a missing account differently — not in the status, the body or the response time. Do not count attempts only at a wrong KE3: a client with a wrong password learns it from KE2 and never sends KE3. Do not keep oprf_seed in the same database as the records. Do not use the test vectors’ Identity KSF in production: without Argon2id a guess after a breach costs only an OPRF, HKDF and HMAC.

JavaScript
// ✕ "the password never reaches the server" — but its hash does, and that is now the password
const digest = await sha256(password);
await fetch('/login', { method: 'POST', body: JSON.stringify({ user, digest }) });
// ✕ an unknown account looks different from a wrong password
if (!record) return new Response(null, { status: 404 });
// ✕ the counter grows only at a wrong KE3, and a client with a wrong password never sends KE3
if (!ke3Valid) await failures.add(userIdentifier, ip);