1 Introduction

Quantum key distribution (QKD) is a method for securely establishing symmetric cryptographic keys between two distant parties (so-called Alice and Bob) [13]. Its security is based on principles of quantum mechanics, such as the no-cloning theorem [4], which guarantee that any attempt by an eavesdropper (Eve) to learn information about the distributed key inevitably introduces detectable errors. Importantly, when combined with the one-time-pad encryption scheme [5], QKD provides information-theoretically secure communications.

The field of QKD has made much progress in recent years, both theoretically and experimentally, leading to the first deployments of metropolitan and intercity QKD networks [69]. Despite these remarkable achievements, there are still certain challenges that need to be overcome for the widespread adoption of this technology. One of these challenges is to close the existing security gap between theory and practice. This is so because QKD security proofs, typically consider assumptions that the actual experimental implementations do not satisfy. Such discrepancies could create security loopholes or so-called side channels, which might be exploited by Eve to compromise the security of the generated key without being detected.

Indeed, practical QKD transmitters usually emit phase-randomized weak coherent pulses (PR-WCPs) generated by laser sources. These pulses might contain more than one photon prepared in the same quantum state. In this scenario, Eve is no longer limited by the no-cloning theorem, because multi-photon signals provide her with perfect copies of the signal photon. As a result, it can be shown that the secret key rate of the BB84 protocol [10] with PR-WCPs scales quadratically with the system’s transmittance due to the photon-number-splitting (PNS) attack [11, 12]. This attack provides Eve with full information about the part of the key generated with the multi-photon pulses, without introducing any error.

To overcome this limitation, the most efficient solution today is undoubtedly the decoy-state method [1315], in which Alice varies at random the intensity of the PR-WCPs that she sends to Bob. This allows them to better estimate the behavior of the quantum channel. Indeed, using the observed measurement statistics associated to different intensity settings, Alice and Bob can tightly estimate the yield and phase error rate of the single-photon pulses, from which the secret key is actually distilled. As a result, the decoy-state method delivers a secret key rate that scales linearly with the channel transmittance [1316], matching the scaling achievable with ideal single-photon sources. This technique has been extensively demonstrated in multiple recent experiments [1723], including satellite links [24, 25] and the use of photonic integrated circuits [2629]. Also, decoy-state QKD setups are currently offered commercially by several companies [3034], which highlights its importance.

Importantly, standard decoy-state security proofs assume perfect phase randomization, i.e., that the phase, θ, of each generated WCP is uniformly random in \([0,2\pi )\). That is, its probability density function (PDF), \(g(\theta )\), should satisfy \(g(\theta )=1/2\pi \). However, none of the two main methods used today to generate PR-WCPs, namely passive and active, fulfill this condition exactly. In the passive scheme a technique known as gain-switching is used to effectively turn the laser on and off between pulses. However, in these configurations [20, 22, 23, 3538], device imperfections can prevent the phases θ from being uniformly distributed. In the active scheme [26, 27, 39, 40], an external phase modulator is used to imprint one of N possible random values to the phase of each pulse, such that only a discrete number of phases is selected. Both scenarios violate a crucial assumption of the decoy-state technique.

The security of QKD with imperfect passive phase randomization has, under certain assumptions, been recently demonstrated in [41]. This analysis however, is not applicable to the numerous existing active setups that rely on an external phase modulator for phase randomization .Footnote 1 The security of the latter approach has been analyzed in [42] (see also [43]), but these works restrict themselves to the case in which the discrete random phases are evenly distributed in \([0,2\pi )\), i.e., they assume that \(g(\theta )\) satisfies

$$ g(\theta ) = \frac{1}{N} \sum _{k=0}^{N-1} \delta (\theta -\theta _{k}), $$
(1)

where \(\delta (x)\) represents the Dirac delta function, and \(\theta _{k}=2 \pi k/N\), with N being the total number of selected phases. Under this assumption, [42] shows that it is possible to approximate the secret key rate achievable in the ideal situation where \(g(\theta )=1/2\pi \), with around \(N=10\) random phases. While this result is remarkable, in practice, inevitable imperfections of the phase modulator and electronic noise might prevent the phases θ from being exactly evenly distributed, thus invalidating the application of the results presented in [42] to a real setup.

The main contributions of this paper are as follows. First, we introduce an analysis that can be applied in the more realistic and practical scenario in which \(g(\theta )\) is an arbitrary PDF, due to imperfections in the active phase randomization process, and we provide asymptotic secret key rates for this general situation, thus filling an important gap in the literature.

Second, we show that this analysis can be applied in the scenario in which the PDF \(g(\theta )\) is not fully characterized. This feature significantly simplifies the applicability of our results to a practical setup, where an accurate characterization of the PDF describing the phase might be challenging.

Third, we make a noteworthy finding regarding the utilization of basis mismatched events which are typically discarded in QKD security analyses, including that in [42]. The use of basis mismatched events is already known to provide a key-rate advantage in the presence of bit-and-basis encoding flaws [44] but here, we show that they can also be advantageous in the presence of imperfections due to a faulty phase randomization process. We believe that this additional result is highly nontrivial as intuitively the decoy state method has no relation with the state preparation flaw in encoding the bit information.

Fourth, when considering the ideal discrete-phase-randomization case described by Eq. (1), our analysis delivers considerably higher secret key rates than those provided by the seminal work in [42], or to put it in other words, it requires to spend fewer random bits for phase selection to achieve an equivalent performance.

As a side remark, we note that our results are also useful for other quantum communication schemes that go beyond QKD and employ laser sources, as they often rely on decoy-states with active phase randomization.

Finally, it is worth mentioning that, although, for simplicity, in our derivations we consider collective attacks, our analysis can be lifted to general attacks by applying the extension of the quantum de Finetti theorem [45] to infinitely-dimensional systems [46]. Because of this, the asymptotic key rates that we derive in this paper are also valid against general attacks.

The paper is organized as follows. In Sect. 2.1, we describe the quantum states emitted by Alice when θ follows an arbitrary PDF, \(g(\theta )\). Then, in Sect. 2.2 we introduce the decoy-state protocol considered, together with its asymptotic secret key rate formula. Next, in Sect. 2.3, we present the parameter estimation technique based on SDP, as well as on the use of basis mismatched events, to calculate the different parameters required to evaluate the secret key rate. Then, in Sect. 3 we simulate the achievable secret key rate for various functions \(g(\theta )\) of practical interest, both for the cases in which this function is fully (or only partially) characterized. Section 4 concludes the paper with a summary. The paper includes as well some Appendixes with additional calculations.

2 Methods

2.1 Phase randomization with an arbitrary \(g(\theta )\)

In this section, we describe the quantum states emitted by Alice when each of them has a phase θ that follows an arbitrary PDF, \(g(\theta )\).

In particular, a WCP of intensity μ and phase θ can be written in terms of the Fock basis as

$$ \bigl|\sqrt{\mu}e^{i \theta}\bigr\rangle =e^{-\frac{\mu}{2}} \sum _{n=0}^{ \infty}\frac{ (\sqrt{\mu}e^{i \theta} )^{n}}{\sqrt{n !}}|n \rangle , $$
(2)

where \(|n\rangle \) represents a Fock state with n photons.

If Alice selects the phase θ of each generated signal independently and at random according to \(g(\theta )\), its state is simply given by

$$ \rho ^{\mu}_{[g(\theta )]}= \int _{0}^{2 \pi} g(\theta ){\hat{P}}\bigl(\bigl| \sqrt{ \mu} e^{i \theta}\bigr\rangle \bigr)\,d\theta , $$
(3)

with \({\hat{P}}(|\phi \rangle )=|\phi \rangle \langle \phi |\).

Any quantum state can always be diagonalised in a certain orthonormal basis. For the states given by Eq. (3), we shall denote the elements of such basis by \(|\psi _{n, \mu , g(\theta )}\rangle \), since, in general, they might depend on both the intensity μ and the function \(g(\theta )\). Here, the subscript n simply identifies the different elements of the basis, which are not necessarily the Fock states. This means, in particular, that we can rewrite the states given by Eq. (3) as follows

$$ \rho ^{\mu}_{[g(\theta )]}=\sum _{n=0}^{\infty} p_{n| \mu , g(\theta )}{ \hat{P}}\bigl(|\psi _{n, \mu , g(\theta )}\rangle \bigr), $$
(4)

where the coefficients \(p_{n| \mu , g(\theta )}\geq{}0\) satisfy \(\sum_{n=0}^{\infty} p_{n| \mu , g(\theta )}=1\). That is, these coefficients can be interpreted as the probability with which, in a certain time instance, Alice emits the state \(|\psi _{n, \mu , g(\theta )}\rangle \), given that she chose the intensity μ and θ follows the PDF \(g(\theta )\).

For instance, in the ideal scenario where \(g(\theta )\) is uniformly random in \([0,2\pi )\), the emitted signals are a Poisson mixture of Fock states given by

$$ \rho ^{\mu}_{[\frac{1}{2\pi}]}= \frac{1}{2\pi} \int _{0}^{2 \pi}{ \hat{P}}\bigl(\bigl|\sqrt{\mu} e^{i \theta}\bigr\rangle \bigr)\,d\theta=e^{-\mu}\sum_{n=0}^{\infty } \frac{\mu ^{n}}{n !} {\hat{P}}\bigl(|n \rangle \bigr), $$
(5)

i.e. \(p_{n| \mu , 1/2\pi}=e^{-\mu}\mu ^{n}/(n!)\) and \(|\psi _{n, \mu , 1/2\pi}\rangle =|n\rangle \).

2.2 Protocol description and key generation rate

For concreteness, we shall assume that Alice and Bob implement a decoy-state BB84 scheme with three different intensity settings \(\{s, \nu , \omega \}\) in each basis, with \(s>\nu >\omega \geq{}0\). Moreover, we consider that they generate secret key only from those events in which both of them select the Z basis and Alice chooses the signal intensity setting s. This is the most typical configuration of the decoy-state BB84 protocol. We remark, however, that the analysis below could be straightforwardly adapted to other protocol configurations, or to other combinations of intensity settings.

In each round of the protocol, Alice probabilistically chooses a bit value \(b\in \{0,1\}\) with probability \(p_{b}=1/2\), a basis \(\alpha \in \{Z,X\}\) with probability \(p_{\alpha}\), an intensity value \(\mu \in \{s, \nu , \omega \}\) with probability \(p_{\mu}\), and a random phase θ according to the PDF given by \(g(\theta )\). Then, she generates a WCP of intensity μ and phase θ, \(|\sqrt{\mu}e^{i \theta}\rangle \), and applies an operation that encodes her bit and basis choices b and α into the pulse. From Eve’s perspective, these states are described by Eq. (4) due to her ignorance about the selected phase θ. On the receiving side, Bob measures each arriving signal using a basis \(\alpha \in \{Z,X\}\), which he selects with probability \(p_{\alpha}\). We shall assume the basis independent detection efficiency condition throughout the paper. That is, the probability that Bob obtains a conclusive measurement outcome does not depend on his basis choice.

Once the quantum communication phase of the protocol ends, Alice and Bob broadcast (via an authenticated classical channel) both the intensity and basis settings selected for each detected signal. The results related to those detected signals in which both of them used the Z basis with intensity setting s constitute the sifted key. For the detected rounds in which Bob chose the X basis, Alice reveals her bit values b and Bob announces his corresponding measurement outcomes. This data is used for parameter estimation, i.e., to determine the relevant quantities needed to evaluate the secret key rate formula. Finally, Alice and Bob apply error correction and privacy amplification to the sifted key to obtain a final secret key, following the standard post-processing procedure in QKD [13]. For a more detailed description of the protocol steps of a decoy-state BB84 scheme, we refer the reader to e.g. [16].

In the ideal scenario where \(g(\theta )=1/2\pi \), Alice’s state preparation process is equivalent to emitting Fock states \(|n\rangle \) with a Poisson distribution of mean equal to the intensity setting μ selected, as shown by Eq. (5). In this situation, both the single-photon and vacuum pulses with the intensity setting s contribute to secret bits [47]. The multi-photon signals are insecure due to the PNS attack. Similarly, when θ follows an arbitrary PDF, \(g(\theta )\), and Alice chooses the intensity setting μ, from Eq. (4) we have that her state preparation process is equivalent to generating pure states \(|\psi _{n, \mu , g(\theta )}\rangle \) with probability \(p_{n| \mu , g(\theta )}\). The closer the function \(g(\theta )\) is to a uniform distribution, the closer the signals (probabilities) \(|\psi _{n, \mu , g(\theta )}\rangle \) (\(p_{n| \mu , g(\theta )}\)) are to the Fock states \(|n\rangle \) (probabilities \(e^{-\mu}\mu ^{n}/n!\)). In this scenario, Alice and Bob can in principle distill secret bits from any \(|\psi _{n, \mu , g(\theta )}\rangle \) with \(\mu =s\), though the main contribution would mainly arise from those with indexes \(n=0,1\), which are the ones closer to vacuum and single-photon pulses. These are the contributions that we consider below. Indeed, for the examples studied in Sect. 3, we have tested numerically that the improvement in key rate that can be obtained when considering \(n>1\) is negligible.

This means that, in this imperfect state preparation scenario, the asymptotic secret key rate formula for the decoy-state BB84 protocol considered can be written as [15, 47, 48]

$$\begin{aligned} R \geq & p_{Z}^{2}p_{s} \Biggl\{ \sum_{n=0}^{\infty} p_{n| s, g(\theta )}Y_{n, s, g(\theta )}^{Z} \bigl[1-h (e_{n, s, g(\theta )} ) \bigr] -f Q_{s, g(\theta )}^{Z} h \bigl(E_{s, g(\theta )}^{Z} \bigr) \Biggr\} \\ \geq & p_{Z}^{2}p_{s} \Biggl\{ \sum _{n=0}^{1} p_{n| s, g(\theta )}^{ \text{L}}Y_{n, s, g(\theta )}^{Z, \text{L}} \bigl[1-h \bigl(e_{n, s, g( \theta )}^{\mathrm{U}} \bigr) \bigr] -f Q_{s, g(\theta )}^{Z} h \bigl(E_{s, g(\theta )}^{Z} \bigr) \Biggr\} , \end{aligned}$$
(6)

where \(Y_{n, s, g(\theta )}^{Z}\) denotes the yield associated to the state \(|\psi _{n, s, g(\theta )}\rangle \) encoded (and measured) in the Z basis, i.e., the probability that Bob observes a detection click in his measurement apparatus conditioned on Alice and Bob selecting the Z basis and Alice preparing the state \(|\psi _{n, s, g(\theta )}\rangle \); the parameter \(e_{n, s, g(\theta )}\) represents the phase error rate of these latter signals; \(h(x)=-x\log _{2}{(x)}-(1-x)\log _{2}{(1-x)}\) is the binary Shannon entropy function; the quantity f is the efficiency of the error correction protocol; \(Q_{s, g(\theta )}^{Z}\) is the overall gain of the signals emitted conditioned on Alice selecting the intensity s and Alice and Bob choosing the Z basis, i.e., the probability that Bob observes a detection click conditioned on Alice sending him such signals; and \(E_{s, g(\theta )}^{Z}\) is the overall quantum bit error rate (QBER) associated to these latter signals. Moreover, in Eq. (6), the superscript L (U) refers to a (an) lower (upper) bound.

The quantities \(Q_{s, g(\theta )}^{Z}\) and \(E_{s, g(\theta )}^{Z}\) are directly observed in the experiment. In principle, the probabilities \(p_{n| s, g(\theta )}\) could also be known, and depend on the state preparation process. However, in practice it might be difficult to find their value analytically. Instead, in the next section we present a simple method to obtain a lower bound, \(p_{n| s, g(\theta )}^{\mathrm{L}}\), on these quantities. There, we also explain how to estimate the parameters \(Y_{n, s, g(\theta )}^{Z, \mathrm{L}}\) and \(e_{n, s, g(\theta )}^{\mathrm{U}}\), with \(n=0,1\), which are needed to evaluate Eq. (6).

2.3 Parameter estimation

The parameter estimation procedure presented here is an adaptation of the one very recently introduced in [41] in the context of phase correlations in a passive randomization setup. For simplicity, below we introduce the main results and refer the reader to Appendixes A and B for the detailed derivations.

2.3.1 Lower bound on the yields \(Y_{n, s, g(\theta )}^{Z}\)

In Appendix A it is shown that a lower bound on the yields \(Y_{n, s, g(\theta )}^{Z}\) can be obtained by solving the following SDP:Footnote 2

$$ \begin{aligned} \min_{J_{Z}} &\ \operatorname{Tr} \bigl[{\hat{P}}\bigl(|\psi _{n, s, g( \theta )}\rangle \bigr)J_{Z} \bigr] \\ \text{subject to} &\ \operatorname{Tr} \bigl[\rho ^{\mu}_{[g(\theta )]} J_{Z} \bigr]=Q_{\mu , g(\theta )}^{Z}, \quad \forall \mu \in \{s, \nu , \omega \} \\ &\ 0\leq J_{Z} \leq \mathbb{I}. \end{aligned} $$
(7)

The states \(|\psi _{n, s, g(\theta )}\rangle \) and \(\rho ^{\mu}_{[g(\theta )]}\) are known in principle but inaccessible and depend on the intensity setting selected by Alice and on the function \(g(\theta )\). Also, as already mentioned, the gains \(Q_{\mu , g(\theta )}^{Z}\) are directly observed experimentally in a realization of the protocol. That is, the only unknown in Eq. (7) is the positive semi-definite operator \(J_{Z}\) over which the minimization takes place. Let \(J_{Z}^{*}\) denote the solution to the SDP given by Eq. (7). Then, we find that

$$ Y_{n, s, g(\theta )}^{Z}\geq \operatorname{Tr} \bigl[{\hat{P}}\bigl(|\psi _{n, s, g(\theta )}\rangle \bigr)J_{Z}^{*} \bigr]:= Y_{n, s, g(\theta )}^{Z, { \mathrm{L}}}. $$
(8)

2.3.2 Upper bound on the phase-error rates \(e_{n, s, g(\theta )}\)

The phase-error rates, \(e_{n, s, g(\theta )}\), are defined by means of a virtual protocol [49]. For this, we shall consider the standard assumption in which the efficiency of Bob’s measurement is independent of his basis choice. Then, for those rounds in which both Alice and Bob select the Z basis and Alice generates the n-th eigenstate \(|\psi _{n, s, g(\theta )}\rangle \), we can equivalently describe her state preparation process as follows. First, she prepares the following bipartite entangled state

$$ \bigl|\Psi ^{Z}_{n, s, g(\theta )}\bigr\rangle = \frac{1}{\sqrt{2}} \bigl(|0_{Z} \rangle _{A} \hat{V}_{0_{Z}}+|1_{Z}\rangle _{A} \hat{V}_{1_{Z}}\bigr)|\psi _{n, s, g(\theta )}\rangle , $$
(9)

where \(\hat{V}_{b_{\alpha}}\), with \(b=0,1\) and \(\alpha \in \{Z,X\}\), denotes the encoding operation corresponding to the α basis and the bit value b. Although our analysis is valid for any \(\{\hat{V}_{b_{\alpha}}\}\), for simplicity, in our simulations, we assume that these operators, are ideal BB84 encoding operators, given by \(\hat{V}_{0_{Z}}|n\rangle =|n\rangle |0\rangle , \hat{V}_{1_{Z}}|n \rangle =|0\rangle |n\rangle \),

$$ \begin{gathered} \hat{V}_{0_{X}}|n\rangle =\sum _{k} \frac{1}{\sqrt{2^{n}}} \sqrt{ \begin{pmatrix} n \\ k \end{pmatrix}}|k \rangle |n-k\rangle , \\ \hat{V}_{1_{X}}|n\rangle =\sum_{k}(-1)^{k} \frac{1}{\sqrt{2^{n}}} \sqrt{\begin{pmatrix} n \\ k \end{pmatrix}}|k\rangle |n-k\rangle . \end{gathered} $$
(10)

We note that these operators are independent of the physical degree of freedom used for the encoding. For example, in a time-bin encoding setup, the first ket would represent the early time bin, and the second ket would represent the late time bin; while in a polarization-encoding setup, the first ket would represent the horizontally-polarized mode, and the second ket would represent the vertically-polarized mode.

Next, she measures her ancilla system A in Eq. (9) in the orthonormal basis \(\{|0_{Z}\rangle , |1_{Z}\rangle \}\) to learn the bit value encoded, and sends the other system to Bob, who measures it in the Z basis.

In this situation, the phase-error rate \(e_{n, s, g(\theta )}\) corresponds to the bit error rate that Alice and Bob would observe if Alice (Bob) instead performed an X basis measurement on the ancilla system A (arriving signal). If Alice performs a X basis measurement on her system A, this is equivalent to emitting the states

$$ \bigl|\lambda ^{\mathrm{virtual}}_{ \Delta , n, s, g(\theta )}\bigr\rangle \propto \bigl|\bar{\lambda}^{\mathrm{virtual}}_{ \Delta , n, s, g(\theta )} \bigr\rangle ={ }_{A} \bigl\langle \Delta _{X} |\Psi ^{Z}_{n, s, g(\theta )} \bigr\rangle =\frac{1}{2} \bigl[\hat{V}_{0_{Z}}+(-1)^{\Delta } \hat{V}_{1_{Z}} \bigr]|\psi _{n, s, g(\theta )}\rangle , $$
(11)

with probability \(p^{\mathrm{virtual}}_{\Delta , n, s, g(\theta )}=\||\bar{\lambda}^{ \mathrm{virtual}}_{\Delta , n, s, g(\theta )}\rangle \|^{2}\), where \(\Delta \in \{0,1\}\) and \(|\Delta _{X}\rangle = [|0_{Z}\rangle +(-1)^{\Delta}|1_{Z} \rangle ] / \sqrt{2}\). Let \(Y_{\Delta , n, s, g(\theta )}^{ (\Delta \oplus 1)_{X}, \mathrm{virtual}}\) denote the probability that Bob obtains the measurement outcome \((\Delta \oplus 1)_{X}\) when he performs an X basis measurement on the arriving signal conditioned on Alice emitting the state \(|\lambda ^{\mathrm{virtual}}_{ \Delta , n, s, g(\theta )}\rangle \). That is, this event corresponds to a phase error. Then, the phase error rate \(e_{n, s, g(\theta )}\) can be written as

$$ e_{n, s, g(\theta )}=\frac{1}{Y_{n, s, g(\theta )}^{Z}}\sum _{\Delta =0}^{1} p^{\mathrm{virtual}}_{\Delta , n, s, g(\theta )}Y_{\Delta , n, s, g( \theta )}^{ (\Delta \oplus 1)_{X}, \mathrm{virtual}}. $$
(12)

In Appendix A, it is shown that an upper bound on the quantity \(p^{\mathrm{virtual}}_{\Delta , n, s, g(\theta )}Y_{\Delta , n, s, g( \theta )}^{ (\Delta \oplus 1)_{X}, \mathrm{virtual}}\) can be obtained by solving the following SDP:

$$ \begin{aligned} \max_{L_{(\Delta \oplus 1)_{X}}} &\ \operatorname{Tr} \bigl[{\hat{P}}\bigl(\bigl| \bar{\lambda}^{\text{virtual}}_{\Delta , n, s, g(\theta )} \bigr\rangle \bigr) L_{( \Delta \oplus 1)_{X}} \bigr] \\ \text{subject to } &\ \operatorname{Tr} \bigl[\hat{V}_{b_{\alpha}} \rho ^{\mu}_{[g(\theta )]} \hat{V}_{b_{\alpha}}^{\dagger} L_{(\Delta \oplus 1)_{X}} \bigr]=Q_{\mu , g(\theta ), b_{\alpha}}^{(\Delta \oplus 1)_{X}}, \\ &\ \forall \mu \in \{s, \nu , \omega \}, \forall b\in \{0,1\}, \forall \alpha \in \{Z,X\} \\ &\ 0 \leq L_{(\Delta \oplus 1)_{X}} \leq \mathbb{I}, \end{aligned} $$
(13)

where \(\rho ^{\mu}_{[g(\theta )]}\) is given by Eq. (4), and \(Q_{\mu , g(\theta ), b_{\alpha}}^{(\Delta \oplus 1)_{X}}\) denotes the probability that Bob observes the result \((\Delta \oplus 1)_{X}\) with his X basis measurement given that Alice chose the intensity setting μ, the basis α, the bit value b, and the phases θ follow the PDF \(g(\theta )\). We note that Eq. (13) includes constraints provided by basis mismatched events [44] in which Alice prepares the signals in the Z basis and Bob measures them in the X basis, which may result in a tighter estimation. This is because, in general, \(|\lambda _{\Delta , n, s, g(\theta )}^{\text{virtual}}\rangle \neq \hat{V}_{\Delta _{X}}|\psi _{n, s, g(\theta )}\rangle \), and \({\hat{P}}(|\lambda ^{\text{virtual}}_{\Delta , n,s, g(\theta )})\) may be better approximated by an operator-form linear combination of both Z-encoded and X-encoded states, rather than just the latter.

Importantly, the states \(|\bar{\lambda}^{\text{virtual}}_{\Delta , n, s, g(\theta )}\rangle \) and \(\rho ^{\mu}_{[g(\theta )]}\), as well as the operators \(\hat{V}_{b_{\alpha}}\), are known and depend on Alice’s state preparation process. The gains \(Q_{\mu , g(\theta ), b_{\alpha}}^{(\Delta \oplus 1)_{X}}\) are directly observed in a realization of the protocol. That is, the only unknown in Eq. (13) is the positive semi-definite operator L over which the maximization takes place.

Let \(L_{(\Delta \oplus 1)_{X}}^{*}\) denote the solution to the SDP given by Eq. (13). Then, we have that

$$ p^{\mathrm{virtual}}_{\Delta , n, s, g(\theta )}Y_{\Delta , n, s, g( \theta )}^{ (\Delta \oplus 1)_{X}, \mathrm{virtual}}\leq \operatorname{Tr} \bigl[{\hat{P}}\bigl(\bigl|\bar{\lambda}^{\text{virtual}}_{ \Delta , n, s, g(\theta )} \bigr\rangle \bigr) L_{(\Delta \oplus 1)_{X}}^{*} \bigr]. $$
(14)

That is,

$$ e_{n, s, g(\theta )}\leq \frac{1}{Y_{n, s, g(\theta )}^{Z, {\mathrm{L}}}}\sum _{\Delta =0}^{1} \operatorname{Tr} \bigl[{\hat{P}} \bigl(\bigl|\bar{\lambda}^{\text{virtual}}_{ \Delta , n, s, g(\theta )}\bigr\rangle \bigr) L_{(\Delta \oplus 1)_{X}}^{*} \bigr]:=e_{n, s, g(\theta )}^{\mathrm{U}}. $$
(15)

2.3.3 Solving Eqs. (7)–(13) numerically

Solving numerically the SDPs presented above is difficult for two main reasons. Firstly, they are infinitely dimensional, because the states \(\rho ^{\mu}_{[g(\theta )]}\) are infinite-dimensional. Secondly, this also renders the calculation of the eigendecomposition of \(\rho ^{\mu}_{[g(\theta )]}\) given by Eq. (4) a difficult task. To overcome these two limitations, we follow a technique recently introduced in [50] (see also [51]), which consists in projecting the states \(\rho ^{\mu}_{[g(\theta )]}\) onto a finite-dimensional subspace that contains up to M photons. We shall denote the projected states as

$$ \rho ^{\mu}_{[g(\theta )], M}= \frac{\Pi _{M} \rho ^{\mu}_{[g(\theta )]} \Pi _{M}}{\operatorname{Tr} [\Pi _{M} \rho ^{\mu}_{[g(\theta )]} \Pi _{M} ]}, $$
(16)

where \(\Pi _{M}=\sum_{n=0}^{M}|{n}\rangle \langle{n}|\) denotes the projector onto the M-photon subspace, being \(|{n}\rangle \) a Fock state. In doing so, now the eigendecomposition of \(\rho ^{\mu}_{[g(\theta )], M}\) can be easily obtained numerically. For later convenience, we will denote the eigendecomposition of the numerator of the right hand side of Eq. (16) as

$$ \Pi _{M}\rho ^{\mu}_{[g(\theta )]}\Pi _{M}=\sum_{n=0}^{M} q_{n| \mu , g(\theta )}{\hat{P}}\bigl(|\varphi _{n, \mu , g(\theta )}\rangle \bigr). $$
(17)

Importantly, this technique also allows to transform the infinite-dimensional SDPs given by Eqs. (7)–(13) onto finite-dimensional SDPs that can be solved numerically. The resulting SDPs and their derivation are provided in Appendix B.

2.3.4 Lower bound on the probabilities \(p_{n| s, g(\theta )}\)

As explained in the previous subsection, because the states \(\rho ^{\mu}_{[g(\theta )]}\) are infinite-dimensional, it might be difficult to calculate their eigendecomposition, and thus the probabilities \(p_{n| s, g(\theta )}\). Instead, here we provide a lower bound on these probabilities based on the eigendecomposition given by Eq. (17). In particular, in Appendix B it is shown that

$$ p_{n| s, g(\theta )}\geq q_{n| s, g(\theta )}-\epsilon _{s}:=p_{n| s, g( \theta )}^{\text{L}} $$
(18)

with \(\epsilon _{s}=2 \sqrt{1-\operatorname{Tr} [\Pi _{M} \rho ^{s}_{[g( \theta )]} \Pi _{M} ]}\).

3 Results

In this section, we now evaluate the secret key rate obtainable for various examples of functions \(g(\theta )\). For illustration purposes, we consider three main scenarios, depending on whether or not the function \(g(\theta )\) is fully characterized. Also, for the simulations, we consider a simple channel model whose transmission efficiency is given by \(10^{-\frac{\gamma}{10}}\), where γ (measured in dB) represents the overall system loss, i.e., it also includes the effect of the finite detection efficiency of Bob’s detectors. Moreover, for simplicity, we disregard any misalignment effect, and assume that the only source of errors are the dark counts of Bob’s detectors, whose probability is set to \(p_{d}=10^{-8}\) [23, 52]. In addition, as already mentioned, we consider that the BB84 encoding operators are ideal even though the analysis presented here is applicable if this condition is not met, and we take an error correction efficiency \(f=1.16\).

To obtain the bounds \(Y_{n, s, g(\theta )}^{Z, \mathrm{L}}\) and \(e_{n, s, g(\theta )}^{\mathrm{U}}\) we use the finite-dimensional versions of the SDPs above, which are presented in Appendix B. Note that, the resulting secret key rate is an increasing function of M. However, the time required to numerically solve such SDPs grows rapidly with this parameter. For this reason, we have set a sufficiently large M so that an increase in this parameter would result in a negligible improvement of the secret key rate as tested numerically. The effect that the parameter M has in the secret key rate, is studied in Appendix D.

3.1 Fully-characterized \(g(\theta )\)

Here, we consider the scenario in which the function \(g(\theta )\) is completely characterized, and we evaluate two specific examples of practical interest. The first example corresponds to the scenario given by Eq. (1), which has been considered in [42], while the second example can be interpreted as a noisy version of the first one.

3.1.1 Ideal discrete phase randomization

The results are shown in Fig. 1 for different values of the total number of random phases N selected by Alice. In particular, the solid lines in the figure have been obtained using the parameter estimation procedure presented in Sect. 2.3 based on SDP and the use of basis mismatched events. If we discard these latter events, the obtainable key rate decreases, as illustrated by the dashed-dot lines. Finally, the dotted lines correspond to the analysis in [42]. For completeness, this latter approach is summarized in Appendix E. In the first two cases, for simplicity, we set the intensity settings to the possibly sub-optimal values \(\omega =0\), \(\nu =s/5\) and we optimize s as a function of the overall system loss γ, while in the later case we set \(\omega =0\) and optimize both ν and s as a function of γ (which provides the optimal solution for this approach). Importantly, despite this fact, Fig. 1 shows that the use of SDP and basis mismatched events significantly improve the secret key rate when compared to the results in [42]. Furthermore, we find that the improvement of using basis mismatched events is more advantageous when N is small. Indeed, when \(N\geq 5\), this enhancement in performance is almost negligible. This is expected as basis mismatched events do not improve the estimation in the case of ideal continuous phase randomization, i.e., in the limit \(N\rightarrow \infty \). On the other hand, when N is small, the eigenstates \(|\psi _{n, s, g(\theta )}\rangle \) for \(n=0,1\) deviate more from a perfect Fock state, meaning that the virtual states \(|\lambda ^{\mathrm{virtual}}_{ \Delta , n, s, g(\theta )}\rangle \) deviate more from the X-encoded states \(\hat{V}_{\Delta _{X}}|\psi _{n, s, g(\theta )}\rangle \) and thus basis mismatched events provide a tighter estimation.

Figure 1
figure 1

Secret key rate in logarithmic scale versus the overall system loss for the ideal discrete phase-randomization scenario given by Eq. (1), as a function of the total number of random phases N selected by Alice. The solid lines correspond to the parameter estimation procedure based on SDP and basis mismatched events considered in this work, while the dashed-dotted lines represent the same procedure overlooking basis mismatched events. Finally, the dotted lines correspond to the analysis in [42] using linear programming

Note that, as shown in Fig. 2, when \(N\geq 6\), the improvement in the secret key rate that can be obtained by further increasing the value of N decelerates. Hence, it seems that a value of around \(N=8\) might be a good practical compromise, as this configuration requires only three random bits per pulse to select the random phase. As in the previous figure, here we set the intensities to \(\{s, s/5, 0\}\) and optimize s as a function of the overall system loss to simplify the numerics. This is done for both the ideal PR-WCP scenario and for the different values of N to ensure a fear comparison between both scenarios.

Figure 2
figure 2

Secret key rate in logarithmic scale versus the overall system loss for the ideal discrete phase-randomization scenario given by Eq. (1), as a function of the total number of random phases N selected by Alice, when Alice and Bob employ the parameter estimation procedure based on SDP and basis mismatched events considered in this work. Remarkably, as shown in the figure, only eight random phases are enough to deliver a secret key rate already quite close to the ideal scenario of perfect PR-WCPs, where the phase of each pulse is uniformly random in \([0,2\pi )\)

3.1.2 Noisy discrete phase randomization

Here we consider the situation in which the actual phase encoded by Alice in each emitted pulse follows a certain PDF around the selected discrete value \(\theta _{k}=2 \pi k/N\). This might happen due to device imperfections of the phase modulator or the electronics that control it. For concreteness and illustration purposes, we shall assume that this PDF is a truncated Gaussian distribution, though we remark that our analysis can be applied to any given distribution. A truncated Gaussian distribution has the form

$$ f (\theta ; \theta _{k}, \sigma _{k}, \lambda _{k}, \Lambda _{k} )= \frac{\phi (\theta ; \theta _{k}, \sigma _{k}^{2} )}{\Phi (\Lambda _{k}; \theta _{k}, \sigma _{k}^{2} )-\Phi (\lambda _{k}; \theta _{k}, \sigma _{k}^{2} )}, $$
(19)

when the phase θ is in the interval \(\lambda _{k}<\theta <\Lambda _{k}\), and zero otherwise. The functions \(\phi (x; \gamma , \sigma ^{2} )\) and \(\Phi (x; \gamma , \sigma ^{2} )\) in Eq. (19) are, respectively, given by

$$ \begin{aligned} &\phi (x; y, z )=\frac{1}{\sqrt{2 \pi z}} e^{- \frac{(x-y)^{2}}{2 z}}, \\ &\Phi (x; y, z )= \int _{-\infty}^{x} \frac{1}{\sqrt{2 \pi z}} e^{-\frac{(t-y)^{2}}{2 z}} \,dt . \end{aligned} $$
(20)

That is, in this scenario the function \(g(\theta )\) has the following form

$$ g(\theta )= \frac{1}{N}\sum _{k=0}^{N-1} f (\theta ; \theta _{k}, \sigma _{k}, \lambda _{k}, \Lambda _{k} ) $$
(21)

for certain parameters \(\theta _{k}\), \(\sigma _{k}\), \(\lambda _{k}\) and \(\Lambda _{k}\).

In the limit when the standard deviations \(\sigma _{k} \to 0\)k, Eq. (21) converges to the PDF given by Eq. (1), because in that regime each truncated Gaussian distribution approaches the Dirac delta function. On the other hand, when \(\sigma _{k} \to \infty \), and given that the concatenation of the truncation intervals defined by \(\lambda _{k}\) and \(\Lambda _{k}\) allow the phase to take any value within the range of \([0,2\pi )\) but do not overlap each other, Eq. (21) converges to the PDF of a uniform distribution in \([0,2\pi )\). Importantly, this means that the achievable secret key rate will increase with higher values of \(\sigma _{k}\), or, to put it in other words, when the uncertainty about the phase actually imprinted by Alice on each of her prepared signals increases, given that \(g(\theta )\) is completely characterized.

The simulation results are shown in Fig. 3, which presents a comparison between the achievable secret key rate for two different values of the standard deviations \(\sigma _{k}\), which, for simplicity, are assumed to be equal for all k. As expected, the larger the value of \(\sigma _{k}\) is, the higher the resulting secret key rate, regardless of the number N of random phases selected by Alice, though the improvement is more relevant when N is small. For simplicity and due to the lack of experimental data, Fig. 3 assumes that \(\lambda _{k}=\theta _{k}-3\sigma _{k}\) and \(\Lambda _{k}=\theta _{k}+3\sigma _{k}\). Moreover, like in the previous example, we set \(\omega =0\), \(\nu =s/5\) and we optimize s as a function of the overall system loss.

Figure 3
figure 3

Secret key rate in logarithmic scale versus the overall system loss when \(g(\theta )\) follows the PDF given by Eq. (21), as a function of the total number of random phases N selected by Alice, and for two different values of the standard deviations \(\sigma _{k}\), which are assumed to be equal for all k

3.2 Partially-characterized \(g(\theta )\)

Here, we now consider the scenario in which only partial information about the function \(g(\theta )\) is known. In particular, and for illustration purposes, we shall assume that the actual phase encoded by Alice in each emitted pulse could be any phase within a certain interval around the selected discrete value \(\theta _{k}=2 \pi k/N\), but its precise PDF \(g(\theta )\) is unknown. Precisely, let \(\delta _{\text{max}}\) denote the maximum possible deviation between the actual selected phase \(\theta _{k}\) and the actual imprinted phase, which we shall denote by \(\hat{\theta}_{k}\). That is, we assume that the actual imprinted phase lies in the interval \(\hat{\theta}_{k}\in [\theta _{k}-\delta _{\text{max}},\theta _{k}+ \delta _{\text{max}}]\), and we conservatively take the combination of values \(\hat{\theta}_{k}\) for all k that minimizes the secret key rate following the analysis presented in Appendix C.

The results are illustrated in Fig. 4, as a function of the total number of phases N selected by Alice and the value of the maximum deviation \(\delta _{\text{max}}\). Like in the previous examples, for simplicity, we fix \(\omega =0\), \(\nu =s/5\) and we optimize s as a function of the overall system loss. As expected, the larger the value of \(\delta _{\text{max}}\) is, the lower the resulting secret key rate.

Figure 4
figure 4

Secret key rate in logarithmic scale versus the overall system loss when the phases lie in the intervals \(\theta _{k}\pm \delta _{\text{max}}\) and the function \(g(\theta )\) is unknown, as a function of the total number of random phases N selected by Alice and the value of \(\delta _{\text{max}}\)

Also, from Fig. 4 we see that for higher values of \(\delta _{\text{max}}\), the secret key rate becomes less sensitive to the parameter N. Indeed, when \(\delta _{\text{max}}=10^{-1}\), the achievable secret key rate for the cases \(N=3, 4, 5\) essentially overlap each other, which is the left-most curve. This seems to be due to the fact that a significant increase in \(\delta _{\text{max}}\) allows in principle for some phases to lie close to each other, or even become identical if this parameter is large enough. Under this situation, the increase of N does not help to improve the performance, as the effective randomness remains almost the same.

4 Conclusion

In this paper we have considered the security of decoy-state quantum key distribution (QKD) when the phase of each generated signal is not uniformly random, as requested by the theory, but follows an arbitrary, continuous or discrete, probability density function (PDF). This might happen due to the presence of device imperfections in the phase-randomization process, and/or due to the use of an external phase modulator to imprint the random phases on the generated pulses, which limits the possible selected phases to a finite set.

Our analysis combines a novel parameter estimation technique, based on semi-definite programming, with the use of basis mismatched events, to tightly estimate the relevant parameters that are needed to evaluate the achievable secret key rate. In doing so, we have shown that decoy-state QKD is rather robust to faulty phase-randomization, particularly when the PDF that governs the random phases is well-characterized. Moreover, our results significantly outperform those of previous works while being also more general, in the sense that they can handle more realistic and practical scenarios.

This work might be relevant as well to other quantum communication protocols beyond QKD that use laser sources and decoy states.