In BB84 protocol, when Alice and Bob make key distribution, what is the private thing? They select randomly bases and then make a measurement according to these bases. Used bases are private? I mean that does Eve know which basis was used at each position? If Eve dont know these bases, then How can Alice and Bod share using bases securely? In here, what is public and private?
2 Answers
If we assume that Alice is the one sending the photons, and Bob is the one receiving them, then Bob selects random bases to take the measurements, and then announces them (both to Alice and any potential attacker) after he has taken those measurements. An attacker cannot use that announcement to decide how to take measurements himself, as he doesn't hear it until after the photons have passed.
Now, if the attacker could replace Bob's announcement about the measurements with his own, he could break the system - this would be a simple MITM attack, where Alice communicates to the attacker, and the attacker communicates with Bob. However, authenticating this communication isn't difficult; it can be done using a universal hash, initially (for the first exchange) a key that was installed in both systems, and for later exchanges, bits that were exchanged during the previous exchange.
One intuitive way of viewing where the secret comes from is with EPR-based quantum key distribution (QKD). In this variant, Alice prepares $n$ EPR pairs, i.e. states of the form $$|\Psi^+\rangle= \frac 1{\sqrt{2}}(|00\rangle+|11\rangle).$$ This state has the particularity that if Alice and Bob each share a part of this pair, they will always get the same (random) outcome if they measure in the same basis. This is easily seen as rewritting $|\Psi^+\rangle$ in the diagonal basis: $$|\Psi^+\rangle= \frac 1{\sqrt{2}}(|++\rangle+|--\rangle).$$ If Eve has not tempered with the state Alice sent to Bob (the second half of each of the $n$ EPR pairs), then they can generate a secret key by measuring their part of each pair in a random basis ($+$ or $\times$) and they have a shared, truly random secret key for every pair for which they have used the same basis.
In the original BB84 protocol, Alice generates the randomness classically by choosing at random a state from the set $\{|0\rangle, |1\rangle, |+\rangle, |-\rangle\}$ to send to Bob, but this has been shown to be equivalent to EPR-based QKD.