Skip to content

From raw key to secret key

At the end of BB84, Alice and Bob each hold a string of sifted bits. In the idealised story the strings are identical and Eve knows nothing. In practice neither is true:

  • Real fibres and detectors produce errors, so the two strings differ in a few percent of positions.
  • Alice and Bob cannot tell honest noise from eavesdropping, so they must assume Eve caused every error, and by the last lesson that means she may hold some information about the key.

This lesson covers the classical processing that repairs both problems. No qubits are involved. Everything happens in conversation over the public channel, with Eve listening to every word.

It assumes you know BB84 and what entropy measures.

Stage What goes in What comes out
Sifting Every round Rounds where the bases matched
Parameter estimation Sifted key An estimate of the error rate, minus the sampled bits
Information reconciliation Two slightly different strings Two identical strings
Privacy amplification An identical, partly leaked string A shorter string that Eve knows nothing about

Each stage costs bits. The question is how many are left at the end.

Alice and Bob pick a random sample of their sifted bits, announce the values, and count the disagreements. The fraction is the quantum bit error rate, usually written QBER or just ee. The sampled bits are now public, so they are thrown away.

The error rate does two jobs. It tells them how much correcting they have to do, and it bounds how much Eve can know. A small ee means the states arrived almost undisturbed, and undisturbed states gave Eve almost nothing.

Next they make the strings identical. Bob cannot ask “what is your bit 7?”, since that would give bit 7 to Eve. Instead Alice announces parities: the sum modulo 2 of a block of bits. A parity reveals one bit of information about the block, however long the block is.

If Bob’s parity for a block differs from Alice’s, the block contains an error, and they can find it by halving. In the simulator there is exactly one error in Bob’s 16 bits.

SimulatorFind the error by parity

Locating one error among 16 bits took five announced parities. The price is that Eve heard all five. Each one is a bit of information about the key that she did not have before, and it will have to be paid for in the next stage.

Check

Alice’s and Bob’s parities for a block agree. What can Bob conclude?

That gap is why real reconciliation takes several passes. A widely used early protocol, Cascade, splits the key into blocks, fixes one error in each block whose parity disagrees, then shuffles the key and repeats with larger blocks. An error fixed in a later pass exposes a second error hiding in an earlier block, and the corrections cascade backwards. Many current systems use error-correcting codes of the kind used in telecommunications instead, which need less back-and-forth.

How many bits must be revealed? Shannon’s theory gives a floor. If each bit is wrong with probability ee, correcting nn bits requires revealing at least

n h(e)bits, whereh(e)=−elog⁡2e−(1−e)log⁡2(1−e)n\,h(e) \quad\text{bits, where}\quad h(e) = -e\log_2 e - (1-e)\log_2(1-e)

is the binary entropy. Some values:

Error rate ee 1% 3% 5% 11%
h(e)h(e) 0.081 0.194 0.286 0.500

At an error rate of 5%, more than a quarter of the key’s worth of information is given away just to fix the errors. Practical methods reveal somewhat more than this minimum.

Alice and Bob now share an identical string, and Eve knows part of it: whatever she got from the qubits, plus every parity announced during reconciliation. They do not know which part she knows. They only have a bound on how much.

The remedy is to compress. Here is the idea in its smallest form. Alice and Bob share two bits, and Eve knows one of them. They replace the two bits by their sum modulo 2. Eve knows one term of the sum and has no idea about the other, so she knows nothing at all about the result. Two half-secret bits have become one fully secret bit.

In general they compute many parities of the whole string, each over a randomly chosen subset of positions, and keep only those parities. The choice of subsets is made after Eve has finished her attack and is announced publicly. This is a hash function picked at random from a suitable family.

SimulatorSqueeze Eve out

Things to try:

  1. With Eve knowing 6 bits, set the final key length to 4 and press Try 1,000 hashes. Almost every hash removes her completely.
  2. Raise the length to 10, exactly the number of bits she is missing. Now most hashes fail.
  3. Raise it to 12. Every hash fails, and no cleverness can prevent it.

Eve was missing 10 bits of the string. A final key of up to 10 bits can in principle be completely unknown to her, and a longer one cannot. A randomly chosen hash achieves this with high probability as long as the key is made a little shorter than the limit, and each bit given up as a safety margin roughly halves the chance of failure. The general result, the leftover hash lemma, says the same about any kind of partial knowledge Eve might have, not only knowledge of particular bits.

Notice what Alice and Bob did not need: any idea of which bits Eve knew.

Now add up the bill for BB84, per sifted bit, in the limit of a very long key.

  • Reconciliation reveals at least h(e)h(e).
  • The security proofs for BB84 show that an eavesdropper who causes an error rate ee can hold at most h(e)h(e) bits of information about each sifted bit from the quantum transmission.

Privacy amplification must remove both, leaving a secret key rate of

r=1−2 h(e).r = 1 - 2\,h(e).
SimulatorWhat is left of the key

The rate reaches zero where h(e)=12h(e) = \tfrac12, at an error rate of about 11%. Above that, this procedure produces no key at all, and Alice and Bob must abort. The intercept-and-resend attack causes 25% errors, so it is not merely detected. It leaves nothing to steal.

Check

Alice and Bob measure an error rate of 15% in a BB84 run processed as described here. What should they do?

Two qualifications. The 11% figure belongs to this particular recipe, in which the classical messages for reconciliation flow one way. Protocols in which Alice and Bob talk back and forth are known to tolerate somewhat higher error rates. And a real run is finite: the error rate is only an estimate from a sample, and the uncertainty in that estimate has to be covered by removing still more bits.

Alice sends one million qubits, and suppose for simplicity that all of them arrive.

  1. Sifting keeps about half: 500,000 bits.
  2. They sacrifice 50,000 to estimate the error rate, and find 3%. That leaves 450,000.
  3. Reconciliation reveals at least 450,000×h(0.03)≈87,500450{,}000 \times h(0.03) \approx 87{,}500 bits.
  4. Privacy amplification removes those and another 87,500 for what Eve may have learned from the qubits.

About 275,000 secret bits remain, a little over a quarter of what was sent. In a real system most photons are lost on the way, and the numbers are far smaller.

Authentication, and what QKD really provides

Section titled “Authentication, and what QKD really provides”

One assumption has been hiding in every step: when Bob hears “Alice” on the public channel, it really is Alice. If Eve can impersonate each of them to the other, she simply runs BB84 separately with both and reads everything.

So every classical message must be authenticated. There are authentication schemes whose security does not depend on any computational assumption, but they need Alice and Bob to share a short secret key beforehand, and they use some of it up each time.

This is why QKD is strictly a key-growing protocol. It starts from a small shared secret and produces a much larger one, part of which is set aside to authenticate the next run. It does not let two strangers who have never shared anything establish a key from nothing.

The guarantee at the end is unusually strong. It does not depend on Eve’s computing power, now or in the future: a key that was secret when it was made stays secret. This is called information-theoretic security.

But it is a statement about the protocol as written, run on devices that behave as the proof assumes. A source that sometimes emits two photons, a detector that responds differently to different timing, or a modulator that leaks its setting all break the assumptions, and attacks on real systems have exploited exactly such gaps. Closing them is engineering, and it is ongoing work.

The next lesson describes a different way of doing key distribution, in which the security test makes far fewer assumptions about the devices.

RecallAnswer from memory, then check
LessonFinish this lesson