Belajar
← All lessons

How harvest now, decrypt later works

Record it now, read it later

You
Server
Tap's archiveX25519

you.js

// today, on your laptopconst mine = await crypto.subtle.generateKey(  { name: "X25519" }, false, ["deriveBits"]);const secret = await crypto.subtle.deriveBits(  { name: "X25519", public: serverKey },  mine.privateKey, 256);const key = await hkdf(secret);socket.send(mine.publicKey, await encrypt(key, message));

tap.js

const archive = [];// no key needed to keep a copywire.on("packet", (bytes) => archive.push(bytes)); // years later, on the attacker's machineconst [yourKey, serverKey, ciphertext] = archive;const privateKey = breakX25519(yourKey);const secret = x25519(privateKey, serverKey);const key = await hkdf(secret);read(await decrypt(key, ciphertext));

Is it already too late? three numbers decide

The data must stay secret for0
Your move to post-quantum takes0
The break arrives in0
Years from today
MigrationMust stay secretExposedBreak

Nobody knows when the break arrives. Try a few guesses and see how little room there is

risk.js

// Mosca's inequality, as code// the last message the old key exchange carriesconst lastSent = migrationYears;const expires = lastSent + secretYears;if (expires > breakYears) {  warn("exposed for " + (expires - breakYears) + " years");} else {  relax();  // the secret expires first}

Topics

Next: How hybrid key exchange works

Open lesson