qkd_key_rate.protocols.quantum.bbm92 module

Classes to perform key error rate estimate for the BBM92 QKD protocol.

Quantum Key Distribution (QKD) protocols rely on an entangled photon source that produces entangled photon pairs, which are distributed over two parties. Both parties randomly choose one of two predefined measurement bases. As the photons are entangled, non-random results will only be obtained for specific combinations of basis choices. Detection events are sifted, where only the detection events corresponding to events where both parties measured in an appropriate basis should be kept. Part of the resulting sifted key is made public which can be used to estimate the key error rate.

The BBM92 QKD protocol can be seen as a generalization of the famous BB84 protocol. The protocols differ from each other by using entangled photon pairs that are sent to two parties. Due to the entanglement, the measurements give both parties information of each others outcome and allows them to create the key. The exact relation between the measurement results depends on how the entanglement is created. We have an tunable source that lets you modify the expected number of entangled photon pairs. If one party was located at the source and directly measures its quantum state, we effectively have the BB84 protocol again.

We consider two cases

  • Asymptotic Key rate:

    The number of pulses is asymptotic and we only have to optimize the intensity of the source. As we have no decoy-states, we do not have to optimize probabilities for a measurement basis. For the gain and error-rate computation we include the link effects for both parties.

  • Finite Key rate:

    The number of pulses is finite and chosen by the user. We optimize both the intensity of the source and the probability of measuring in the X and Z basis. We take finite-key effects into account by computing bounds on the expected number of states in a basis and we use security parameters (set as default, but changeable by the user) to tune the confidence of these bounds.

Typical usage example:

from tno.quantum.communication.qkd_key_rate.protocols.quantum.bbm92 import (
    BBM92AsymptoticKeyRateEstimate,
)
from tno.quantum.communication.qkd_key_rate.test.conftest import standard_detector

detector_Alice = standard_detector.customise(
    dark_count_rate=1e-8,
    polarization_drift=0,
    error_detector=0.1,
    efficiency_party=1,
)
detector_Bob = standard_detector.customise(
    dark_count_rate=1e-8,
    polarization_drift=0,
    error_detector=0.1,
    efficiency_party=1,
)

asymptotic_key_rate = BBM92AsymptoticKeyRateEstimate(
    detector=detector_Bob, detector_Alice=detector_Alice
)

mu, rate = asymptotic_key_rate.optimize_rate(attenuation=0.2)
class qkd_key_rate.protocols.quantum.bbm92.BBM92AsymptoticKeyRateEstimate(detector, detector_alice=None, **kwargs)[source]

Bases: AsymptoticKeyRateEstimate

BBM92 Asymptotic Key Rate

__init__(detector, detector_alice=None, **kwargs)[source]

Class for asymptotic key-rate estimation

Parameters:
  • detector (Detector) – The detector used at Bob’s side

  • detector_alice (Optional[Detector]) – The detector used at Alice’s side. default same detector as Bob.

compute_rate(mu, attenuation)[source]

Compute the key-rate for a specific intensity and attenuation.

Note, the source can be placed anywhere between the two parties. If the source is placed at one party, we effectively have the BB84 protocol. The optimal gain is achieved with the source placed in middle between the two parties.

Parameters:
  • mu (ArrayLike) – Intensity

  • attenuation (float) – Attenuation

Return type:

float

Returns:

Key-rate

Raises:

ValueError – When mu is given with invalid dimensions

optimize_rate(*, attenuation, x_0=None, bounds=None)[source]

Function to optimize the key-rate

Parameters:
  • attenuation (float) – Loss in dB for the channel

  • x_0 (Optional[ArrayLike]) – Initial search value, default value [0.5] is chosen.

  • bounds (Optional[List[ArrayLike]]) – Bounds on search range, default [(0.001, 0.5)]

Return type:

Tuple[ndarray[Any, dtype[float64]], float]

Returns:

Optimized intensity and key-rate

Raises:
  • ValueError – When x_0 or bounds are given with invalid dimensions.

  • ValueError – when the found key-rate is negative.

class qkd_key_rate.protocols.quantum.bbm92.BBM92FiniteKeyRateEstimate(detector, number_of_pulses=1000000000000.0, detector_alice=None, **kwargs)[source]

Bases: FiniteKeyRateEstimate

BBM92 Finite key-rate.

__init__(detector, number_of_pulses=1000000000000.0, detector_alice=None, **kwargs)[source]

Class for finite key-rate estimation

Parameters:
  • detector (Detector) – The detector used at Bob’s side

  • number_of_pulses (float) – Number of pulses sent in total

  • detector_alice (Optional[Detector]) – The detector used at Alice’s side. default same detector as Bob.

compute_last_positive_distance(x)[source]

Computes the last positive distance.

The optimization routine sometimes considers a parameter setting outside of the valid region. This function is used to push the parameters back to the valid regime.

Return type:

float

compute_rate(mu, attenuation, probability_basis_X, probability_basis_Z, n_X=None)[source]

Compute the key-rate for a specific set of variables

Note, the source can be placed anywhere between the two parties. If the source is placed at one party, we effectively have the BB84 protocol. The optimal gain is achieved with the source placed in middle between the two parties.

Parameters:
  • mu (ArrayLike) – Used intensities

  • attenuation (float) – Attenuation of the channel

  • probability_basis_X (ArrayLike) – Probabilities for each intensity in X-basis

  • probability_basis_Z (ArrayLike) – Probabilities for each intensity in Z-basis

  • n_X (Optional[int]) – Number of pulses in the X-basis

Return type:

float

Returns:

key-rate

Raises:

ValueError – When mu is given with invalid dimensions

optimize_rate(*, attenuation, x_0=None, bounds=None)[source]

Function to optimize the key-rate

Parameters:
  • attenuation (float) – Loss in dB for the channel

  • x_0 (Optional[ArrayLike]) – Initial search value

  • bounds (Optional[List[ArrayLike]]) – Bounds on search range

Return type:

Tuple[ndarray[Any, dtype[float64]], float]

Returns:

Optimized x=[intensity, probability_basis_X, probability_basis_Z] and found optimal key-rate

Raises:
  • ValueError – when x_0 or bounds are given with invalid dimensions.

  • ValueError – when the found key-rate is negative.

qkd_key_rate.protocols.quantum.bbm92.compute_gain_and_error_rate(detector_alice, detector_bob, attenuation_alice, attenuation_bob, half_mu)[source]

Computes the total gain and error rate of the channel

Parameters:
  • detector_alice (Detector) – Alice’s detector

  • detector_bob (Detector) – Bob’s detector

  • attenuation_alice (float) – Attenuation of Alice’s channel

  • attenuation_bob (float) – Attenuation of Bob’s channel

  • half_mu (float) – Half of the expected number of photon-pairs

Return type:

Tuple[float, float]

Returns:

  • The overall gain. The probability of a coincident event, given a pump pulse.

  • The overall error-rate.

Errors can result from incorrect states generated, losses over the channel and losses at the detector side.

  • error_background:

    Error rate related to background errors, with error-rate 1/2

  • error_detector:

    Intrinsic detector errors. The probability that a photon hits the erroneous detector, this error indicates the relative error between the detectors at both sides.

The initial states are generated using parametric down conversion (PDC), which gives the probability

\[P(n) = (n+1) \cdot \lambda^n / [(1+\lambda)^{n+2}],\]

to generate an \(n\)-photon-pair. The variable \(\lambda\) corresponds to half the expected photon pair number.

To compute the losses over the channel, we compute the overall transmittance of the channel, which is given by

\[\eta_n = [1 - (1-\eta_A)^n] \cdot [1 - (1-\eta_B)^n],\]

where:

  • \(\eta_n\): The overall transmittance,

  • \(\eta_x\): The channel loss of \(x\).

The probability of a detection event, conditional on an \(n\)-photon-pair being emitted is given by the yield:

\[{Yield}_n = [1 - (1-Y_{0A}) \cdot (1-\eta_{A})^n] \cdot [1 - (1-Y_{0B}) \cdot (1-\eta_{B})^n],\]

where:

  • \(Y_{0x}\): The darkcount rate of \(x\).

The overall contribution of \(n\)-photon-pairs to the number of detected events is given by the product of the yield and probability:

\[Q_n = Y_n \cdot P(n),\]

where:

  • \(Q_n\): The gain of the n-photon-pair.

and the overall gain is then given by the sum of these individual gains. The overall gain corresponds to the probability of a detection event, conditional on a pulse being sent

\[Q_\lambda = \sum_{n=0}^{\infty} Q_n.\]

From this we compute the quantum bit-error rate (QBER):

\[E_\lambda \cdot Q_\lambda = \sum_{n=0}^{\infty} e_n \cdot Y_n \cdot P(n),\]

where

  • \(e_n\): The error-rate for n-photon-pair states.

The functions below compute \(Q_{\lambda}\) and \(E_{\lambda}\) and return them. We optimized the implementation of the functions and by that deviated from standard implementations in literature. Our implementation is equivalent, but gives better precision in high attenuation cases.

Formulas derived from “Quantum key distribution with entangled photon sources” (doi: 10.1103/PhysRevA.76.012307)

qkd_key_rate.protocols.quantum.bbm92.delta(N, delta_bit, e1)[source]

Gives the upper bound delta in the finite case.

Parameters:
  • N (int) – Number of detection events

  • delta_bit (float) – Error in the X-basis

  • e1 (float) – Epsilon-security parameter

Return type:

float

Returns:

Delta

qkd_key_rate.protocols.quantum.bbm92.efficiency_channel(attenuation)[source]

Calculates the efficiency of the channel

Parameters:

attenuation (float) – Loss in dB for the channel

Return type:

float

Returns:

Efficiency channel

qkd_key_rate.protocols.quantum.bbm92.efficiency_system(efficiency, attenuation)[source]

Calculates the efficiency of the system. This includes the efficiency of the communication link.

Parameters:
  • efficiency (float) – Efficiency of source and detection apparatus

  • attenuation (float) – Loss in dB for the channel

Return type:

float

Returns:

Efficiency system