Abstract
Channel reciprocity is the foundation for physical layer key generation, which is influenced by noise, hardware impairments, and synchronization offsets. Weak channel reciprocity will result in a high key disagreement rate (KDR). The existing solutions for improving channel reciprocity cannot achieve satisfactory performance improvements. Furthermore, the existing quantization algorithms generally use one-dimensional channel features to quantize and generate secret keys, which cannot fully utilize channel information. The multidimensional vector quantization technique also needs to improve in terms of randomness and time complexity. This paper proposes a physical layer key generation scheme based on deep learning and balanced vector quantization. Specifically, we build a channel reciprocity compensation network (CRCNet) to learn the mapping relationship between Alice and Bob’s channel measurements. Alice compensates for channel measurements via a trained CRCNet to reduce channel measurement errors between legitimate users and enhance channel reciprocity. We also propose a balanced vector quantization algorithm based on integer linear programming (ILP-BVQ). ILP-BVQ reduces the time complexity of quantization on the basis of ensuring key randomness and a low KDR. Simulation results showed that the proposed CRCNet performs better in terms of channel reciprocity and KDR, while the proposed ILP-BVQ algorithm improves time consumption and key randomness.
1. Introduction
With the development of wireless communication and the commercialization of 5G technology, more sensitive information (such as mobile banking, e-payments, and medical data) is transmitted via the wireless medium [1, 2]. Due to the broadcast nature of the wireless channel, anyone with the proper receiving equipment can monitor a wireless transmission line and eavesdrop maliciously. Generally, data is encrypted by various encryption algorithms. Traditional encryption algorithms are implemented based on computational complexity and usually require a key management center, which is challenging in terms of key distribution and management. With the advancement of quantum computing and IoT applications, traditional encryption algorithms have gradually become unsuitable. Recently, physical layer security schemes based on the characteristics of the wireless environment have attracted much attention, including physical layer key generation techniques [2–5], authentication schemes based on wireless environment characteristics [6, 7], etc. This paper works on physical layer key generation between peer-to-peer users. Two legitimate nodes use channel variations between nodes to generate shared keys without the involvement of third-party entities, potentially achieving information-theoretic security.
Physical layer key generation schemes operate under the assumptions of wireless channel reciprocity, time variability, and spatial decoupling [8]. Wireless channel reciprocity ensures that two communicating parties generate the same key through the quantization process, while time-varying and spatial decorrelation ensure the randomness of the shared key. Current physical layer key generation schemes are shown in Figure 1, which consist of four steps: channel measurement, quantization, message coordination, and privacy amplification [4]. The legitimate users, Alice and Bob, obtain channel state information (CSI) via channel measurement. In the quantization process, Alice or Bob uses quantization algorithms to map the channel measurements into a string of binary bits. The information reconciliation process further ensures the consistency of shared keys through error correction codes, while the privacy amplification process aims to increase key entropy.

The scheme shown in Figure 1 is the basic flow of existing physical layer key generation techniques, and there are still some shortcomings waiting for improvement in all four steps. During the real-world channel probing process, the reciprocity of channel measurements between two legitimate users is usually weak due to nonsimultaneous measures, channel noise, and hardware impairments [9]. This leads to a high KDR between the keys generated by each of the two legitimate users. Additionally, most of the physical layer key generation schemes use only a unique channel feature for quantization [10–12], resulting in incomplete channel information utilization and the inability to achieve optimal performance. Wireless key generation is enabled by joining multidimensional channel features, which in theory, can improve information utilization and increase the key generation rate (KGR). So, this paper focuses on the two problems of weak channel reciprocity in the channel measurement step and multidimensional vector quantization in the quantization step.
Firstly, to solve the problem of weak channel reciprocity, researchers adopt artificially designed reciprocity features or linear transformation methods to improve channel reciprocity, such as low-pass filter [13], DCT [14], and PCA [15]. These manually designed feature extraction methods are mainly based on personal observation or experience and were designed and implemented for a special channel model. Therefore, they cannot be flexibly applied to various models or practical environments and have significant limitations.
Deep learning can extract high-performance features without predefining channel model statistics. Compared with manually designed feature extraction-based algorithms, deep learning-based key generation methods are not limited by the channel model and can achieve superior performance. However, few studies have focused on applying deep learning to improve the correlation between channel measurements of weak reciprocal channels. Therefore, we intend to use deep learning’s powerful learning capability to compensate for imperfect channels in real-world wireless systems.
Then, researchers adopt vector quantization to solve the problem of low information utilization in scalar quantization. However, the existing vector quantization algorithms, such as [16–18], have defects in key randomness, KDR, or time complexity. Therefore, we propose a new vector quantization algorithm in this paper to improve performance compared to the existing vector quantization algorithms.
1.1. Related Work
1.1.1. Review of Channel Reciprocity Improvement
Researchers adopt manually designed feature extraction algorithms to extract reciprocal features from weak reciprocal channels. One direction of research in feature extraction methods is to use traditional linear transforms such as the discrete cosine transform (DCT) [14], principal component analysis (PCA) [15, 19], and wavelet transform [10, 20]. Another research direction is to extract nonlinear features from the original channel response, such as amplitude, phase, and power delay distribution [13, 21, 22]. These artificially designed feature extraction methods have shortcomings in performance enhancement and applicability.
In recent decades, deep learning has been gradually applied to wireless communications and networks [23, 24], including channel estimation [25], modulation classification [26], and resource allocation [27]. With its excellent performance, deep learning has also been applied to enhance network security such as the fields of authentication, physical layer key generation, etc. Fang et al. [6] proposed an adaptive authentication scheme based on time-varying environments and intelligent machine learning-assisted processes. Zhang et al. [28] use fully connected neural networks to implement the mapping of nonreciprocal uplink and downlink channels in FDD systems. Letafati et al. [29] utilized RNNs to compensate for discrepancies in observations from both sides caused by injected signals from man-in-the-middle attacks and flaws in legitimate transceivers. Han et al. [30] model communication as an end-to-end autoencoder to improve channel reciprocity and perform better than the original scheme. Letafati et al. [31] utilize echo-state networks to compensate for the observation mismatch between legitimate communicating parties caused by unbalanced hardware impairments. Guan et al. [32] propose a feed-forward neural network-based prediction (NNBP) algorithm to enhance key consistency.
1.1.2. Review of Vector Quantization
Chen et al. [16] used the kmeans clustering algorithm for vector quantization, but the limitations of the kmeans algorithm will lead to weak randomness in shared keys. Hong et al. [17] used a balanced kmeans vector quantization algorithm that adds a limit of an equal number of samples in each cluster to the kmeans clustering algorithm to improve the randomness of the generated keys. However, the time consumption of this algorithm is too high, and the time complexity of the clustering process for sample assignment is . Han et al. [18] proposed a heuristic-based balanced vector quantization algorithm that assigns samples to clusters based on their distances to the corresponding cluster centers. However, instead of immediately assigning all samples to their nearest centroid, samples are assigned one by one while sequentially ignoring already full clusters. The vector quantization algorithm proposed in [18] can achieve the goal of balanced cluster quantization. The time complexity of this algorithm is . However, the algorithm cannot guarantee that the clusters do not overlap, and one cluster may have a high dispersion and contain points from another cluster within its bounding volume. This leads to a high disagreement rate for the quantized shared keys.
In [33], a balanced clustering algorithm based on integer linear programming was proposed. The algorithm is similar to kmeans in that both consist of initialization and iteration phases, with assignment and update steps for each iteration. The iterative phase is implemented by formulating the sample assignment problem with constant size constraints as an integer linear program and solving it by a simplex algorithm. The time complexity of this algorithm is only . In addition, the clustering algorithm minimizes cluster dispersion while satisfying the constant size constraint, providing compact and nonoverlapping clusters.
1.2. Main Contribution
Inspired by these works, this paper applies deep learning and balanced vector quantization to the physical layer key generation field. Firstly, we propose a method that uses deep learning to compensate for weak reciprocal channel measurements for efficient key generation. Specifically, we designed a channel reciprocal compensation network (CRCNet), a one-dimensional convolutional neural network (CNN) driven by the CSI of TDD orthogonal frequency division multiplexing (OFDM) systems. In the training phase, the model adaptively learns the mapping relationship between the channel measurements from two legitimate users by using the CSI data collected in the channel probing phase. Then, we extend the balanced clustering algorithm proposed in the paper [33] to the quantization process of physical layer key generation, called the balanced vector quantization algorithm based on integer linear programming (ILP-BVQ). ILP-BVQ adds a cluster balancing mechanism to guarantee the randomness of shared keys and solves the sample allocation problem in the balancing quantization process by integer linear programming. It greatly reduces the time complexity while ensuring key randomness and a low KDR. Our main contributions are presented as follows:(1)We design a CRCNet for weak reciprocal channels. Without the need to know the statistical distribution of the channel response, the model trained with the collected CSI data can compensate for the channel measurements to obtain highly correlated channel measurements and enhance channel reciprocity.(2)Based on existing balanced vector quantization algorithms, we propose a balanced vector quantization algorithm based on integer linear programming. The algorithm lowers the time complexity of the balanced vector quantization process from to and ensures the randomness of the generated keys and the KDR.(3)A practical key generation scheme based on the proposed CRCNet and ILP-BVQ algorithm is constructed. Simulation experiments verify the performance of the proposed scheme. Compared to the existing schemes, our method performs better regarding channel reciprocity, KDR, and time consumption.
The remaining sections of this paper are organized as follows. Section 2 illustrates the system model. Section 3 describes the proposed channel reciprocity compensation network. Section 4 describes the proposed balanced vector quantization algorithm. Then, the proposed scheme’s performance is evaluated by simulation experiments in Section 5. Section 6 concludes the paper.
2. System Model
The system model consists of two legitimate users, Alice and Bob, and an eavesdropper, Eve, as shown in Figure 2. Each user is equipped with a single antenna. Alice and Bob aim to generate a consistently shared key using the unauthenticated wireless channel. Eve can eavesdrop on all communications between the communicating parties. We assume that Eve cannot interfere with the communications during the channel measurement process. Assume that all three parties in the model know the common pilot information. Let be the common pilot signal and denote the channel vector from device to device , where . The signals received by Alice and Bob can be expressed as follows:where is the additive Gaussian white noise, .

Theoretically, the channels between legitimate users are reciprocal in coherent time, , and two legitimate users obtain the same key by quantizing the reciprocal channel measurements. However, in the practical scenario, the channel estimation of legitimate users includes noise, device hardware impairment, and synchronization error. Alice and Bob’s actual channel measurement can be expressed as follows:where denotes the complex Gaussian estimation error of zero mean with variance at node .
We verify the channel reciprocity between two legitimate users through preliminary experimental simulations. The experimental parameters and environmental settings are the same as in the results section. Figure 3(a) shows the comparison of the RSSI between legitimate users without any preprocessing operation. Figure 3(b) shows the comparison for the CSI between legitimate users without any preprocessing operation. The phase slope effect due to synchronization offset must be considered when using CSI as a quantization feature, unlike RSSI as a quantization feature. We can see that other factors apparently weaken that channel reciprocity. Therefore, we train a CRCNet at Alice to improve channel reciprocity by learning the correlation between channel measurement sequences between two legitimate users. The details of our proposed model will be discussed later.

(a)

(b)
In our system model, the eavesdropper speculates the shared secret keys between legitimate users by quantifying the eavesdropped channel vectors and . Assume that the eavesdropper is at least half a wavelength away from the legitimate user. Since the wireless channel gain is decorrelated beyond half a wavelength in a multipath environment [34], the channel of Eve is not correlated with the channel of legitimate users. Eve cannot infer the shared keys generated by legitimate users from the measurement of the eavesdropped channel.
3. Channel Reciprocal Compensation Network
This research aims to improve the reciprocity of channel measurements among legitimate users to generate as many consistent keys as possible. Deep learning can extract high-performance features without predefining channel model statistics. The latest research shows that deep learning can capture the correlation between two signals in complex ways. So we are motivated to use deep learning to design CRCNet. CRCNet captures correlation information between CSI sequences of legitimate users to enhance channel reciprocity among legitimate users. Figures 4(a) and 4(b) show the CSI and RSSI between legitimate users after CRCNet processing, and the channel reciprocity is significantly improved.

(a)

(b)
The structure of CRCNet is shown in Figure 5 and consists of four hidden layers and one output layer. The first hidden layer is a fully connected layer containing 256 neurons. The second hidden layer is a one-dimensional convolutional layer without padding, with a kernel size and step size of 1 × 2 and 2, respectively. The third layer is another fully-connected layer with 256 neurons. The last hidden layer is an unpadded 1D convolutional layer with kernel size and step size of 1 × 2 and 2, respectively. All four hidden layers use the function as their activation function. The fully connected output layer contains 128 neurons.

Since the neural network cannot handle complex numbers and channel state information is a complex-valued matrix, this requires preprocessing of the dataset. Firstly, the real and imaginary parts of the CSI matrix are stacked using the following equation:
Then, stretch the stacked matrix into a one-dimensional vector of size 128. Because each dimension of the raw input has a different magnitude, we also need to normalize the dataset so that it ranges between 0 and 1.
The flow of physical layer key generation with CRCNet is shown in Figure 6 and consists of two phases: the training phase and the key generation phase.

In the training phase, we must first collect sufficient CSI data to serve as a dataset for the training model. Alice and Bob send common pilots to each other, and the channel response H is obtained through the least-squares estimation. After collecting sufficient CSI data at different coherence times, Bob sends the preprocessed CSI data stream to Alice. Alice uses the preprocessed CSI data stream as input and as target output to train CRCNet. We use the mean square error (MSE) function as a loss function to minimize the error between the predicted and target outputs. The adaptive moment estimation optimizer is used to inversely learn and correct weight parameters layer-by-layer until the neural network converges.
In the key generation phase, the network parameters stay constant, and the trained network is deployed to Alice. Alice and Bob exchange common pilot signals for channel estimation and preprocess the measured CSI to obtain CSI streams and . Alice uses as the input of the trained CRCNet to obtain the compensation CSI . Alice uses the predicted output as the input of the quantization algorithm, and Bob uses the directly as the input of the quantization algorithm.
The main challenge in applying deep learning to physical layer key generation is the additional need for computational resources. Therefore, we choose to train the network on the base station side and deploy it to meet the demand of training and storing the network without additional consumption on the user side [28, 35]. Moreover, the network’s training can be conducted in the cloud without consuming node resources. Given an environment to train a network, the network can be used for a long time as long as no large-scale changes occur in that environment. Therefore, it is more cost-effective to incur some computational costs in exchange for a lower KDR.
4. Balanced Vector Quantization Based on Integer Linear Programming
The reasons for using the ILP-BVQ algorithm in this paper are as follows: firstly, compared with the traditional scalar quantization algorithm, the vector quantization algorithm can improve information utilization and key generation rates by combining multidimensional channel features. Then, compared to [16], the ILP-BVQ algorithm with balancing constraints can increase the randomness of shared keys. Compared to the balanced vector quantization scheme in [17], the ILP-BVQ algorithm models the sample assignment task as an integer linear programming problem, reducing its time complexity from to . The algorithm in [18] can provide similar algorithmic time complexity and key randomness as ILP-BVQ. However, it cannot guarantee that the clusters will not overlap, which could lead to a higher KDR. Therefore, this paper uses the ILP-BVQ algorithm as the quantization algorithm for the physical layer key generation scheme.
Assume that the channel measurement samples used by Alice and Bob for quantization are and , and , , where is the CSI sequence length. To reduce the computational effort and KDR, we run the complete iterative clustering process at Alice. Bob only executes the sample assignment process once using Alice’s clustering results. The detailed description of the ILP-BVQ algorithm is as follows.
Given the CSI sequences and , the quantization order , and the number of quantization regions . The objective is to independently divide and into clusters each, and each cluster should contains to sample points. The and with the same subscript index should fall in the same quantization region as much as possible to obtain the same binary code. The problem can be formulated as follows:where is the -th sample point, is the set of sample points in the -th cluster, represents the number of samples in the -th cluster, represents the cluster center of the -th cluster, and represents the square distance between and .
Let denote the division matrix, indicate that the sample point belongs to cluster , and indicate that the sample point does not belong to cluster . Thus, the problem shown in equation (4) can be reformulated as follows:
The problem shown in equation (5) can be solved with the iterative method. Firstly, select initial cluster centers by kmeans++ algorithm [36]. Then iteratively execute the sample assignment step and the cluster center update step.
In the sample assignment step, the cluster centers remain unchanged and samples are assigned to various clusters based on their distances from each cluster center. Minimize the MSE while satisfying the constraints. Thus, the problem of equation (5) can be reformulated as an ILP as shown in equation (6), where , , and are the slack variables used to eliminate inequalities, they are integers, and . The paper [33] proved that the integer constraint can be removed from equation (6), which makes it a linear programming task that can be solved efficiently with the simplex algorithm [37].
In the cluster center update step, we minimize the MSE by updating the cluster center when all sample points are evenly assigned. Cluster centers are updated as follows:
The specific process of ILP-BVQ is shown in Algorithm 1.
|
5. Results
5.1. Simulation Setup and Dataset Generation
Through simulation experiments, we evaluate the performance of CRCNet and the ILP-BVQ algorithm proposed in this paper. We use QUAsi deterministic RadIo channel GenerAtor (QuaDRiGa) to simulate multipath fading channels [38]. The QuaDRiGa simulation platform has detailed simulation scene geometry, continuous-time evolution, and spatially correlated large- and small-scale fading. Moreover, the QuaDRiGa platform employs a drift model to enable the smooth evolution of small-scale parameters such as the mobile terminal’s power, delay, transmission angle, and arrival angle over short multipath intervals. In this work, the reason for using QuaDRiGa is to consider the generation of channel pulses close to real-world application scenarios.
The steps to simulate the channel through the QuaDRiGa platform are as follows: First, define the channel parameters, such as the channel bandwidth, center frequency, signal-to-noise ratio, etc. Then, define the network layout, including setting the transmitter position, receiver movement trajectory, and transmitter and receiver antenna properties. Next, select the channel model that best represents the conditions you want to simulate for the receiver’s movement trajectory, such as an urban environment, a suburban environment, or a rural environment. The channel model is defined by the parameter file. Finally, use QuaDRiGa to generate a channel model based on the defined parameters and the selected channel model.
To evaluate the performance of the key generation scheme, we simulated an OFDM system with 64 subcarriers for our study. We design the codebook by generating a random multipath channel with L = 8 taps and a power delay distribution. Table 1 presents the channel simulation parameter settings. The channel model is an urban macrocellular scenario selected from the 3GPP report TR38.901 [39].
This paper uses the above QuaDRiGa platform and OFDM system to obtain CSI data. First, using the QuaDRiGa platform to build the channel model, we obtain the channel coefficients h that vary with time. Then, the channel coefficient h is used as the channel of the OFDM system, and the legitimate communication parties perform channel detection through the OFDM system. Finally, the receivers preprocess the received signals and perform channel estimation to obtain the CSI data for experiments.
Figure 7 shows the simulation experiment setup, where the base station Alice is at a fixed position at 25 m height and the user Bob at 1.5 m. Alice and Bob were both equipped with a vertically polarized short-dipole single antenna. The red line in the figure represents the channel probing process, and the black line represents the moving direction of Bob, who moves along a straight line at a speed of 0.5 m/s. Alice and Bob perform channel probing at a fixed time interval. After obtaining sufficient channel data, Alice merges the CSI data collected by Bob, which is used to generate a dataset to train a deep learning model. Note that the physical environment and the spatial distribution of scattering clusters do not change with each sampling.

5.2. Evaluation Metrics
We use the following metrics for performance evaluation.(i)Pearson correlation coefficient ρ is used to measure the correlation of the channel between two legitimate users which is defined as follows: where and σ denote the mean and variance. E [∙] denotes the expectation operation.(ii)Mean Square Error (MSE) is used to evaluate the average error of the channel measurements between two legitimate users which is defined as follows:where denotes the length of the CSI sequence.(iii)Key disagreement rate (KDR) is the percentage of different bits between shared keys generated by two legitimate users which is defined as follows: where represents the length of the key obtained by quantization.(iv)Time consumption is used to reveal the time complexity of different quantization algorithms. We tested the time consumption by building a simulation system in Matlab.(v)Randomness reveals the distribution of the shared keys. We used the National Institute of Standards and Technology (NIST) statistical test [40] to test the randomness of the generated keys.(vi)Mutual information is a measure of the interdependence between variables. In this paper, we use it to measure the similarity between the eavesdropping key and the shared key which is defined as follows:
5.3. CRCNet Performance Evaluation
The function of CRCNet is to enhance the correlation of channel measurements between legitimate users to lower the KDR in the subsequent quantization process. We compare the performance of CRCNet with the following five schemes:(1)PCA [19]: using principal component analysis algorithm to reduce hardware fingerprint variance during channel measurements.(2)WAKG [20]: using wavelet analysis to preprocess the channel estimation to improve channel correlation.(3)SGF [21]: the Savitzky Golay Filter (SGF) method is used to increase the correlation of RSS values between users and access points.(4)KGNet [28]: a key generation neural network (KGNet) is proposed to generate reciprocal channel features in FDD communication systems based on band feature maps.(5)AE [30]: the inverse features are extracted from the weakly correlated channel estimates with a trained autoencoder to generate features for quantization in various channel environments.
In Figure 8, the performance of the various channel reciprocity improvement schemes used to obtain channel correlation is plotted as a function of the SNR in dB. We can see that the correlation of all schemes tends to increase when the SNR increases. And our proposed CRCNet has the best performance in channel compensating, with at least a 1% performance improvement compared to the other five schemes. In Figure 9, the MSE performance of the legitimate interuser channel obtained by the various channel reciprocity improvement schemes is plotted as a function of SNR in dB. It can be seen that these six schemes perform similarly at low SNRs. As the SNR increases, the MSE reduces, and the performance advantage of CRCNet steadily increases compared to the other schemes.


Figure 10 compares the KDR for the six reciprocity improvement schemes. As expected, CRCNet achieves the lowest KDR. At SNR = 30 dB, the KDR of CRCNet reduces from 4.8% to 0.89% compared to WAKG, whereas the KDRs of the other four schemes are 3.9%, 2.8%, 1.5%, and 1.13%, respectively. Note that the six schemes here use the same quantization algorithm.

5.4. ILP-BVQ Performance Evaluation
In this paper, we compare the performance of the ILP-BVQ algorithm with the following four quantization algorithms:(1)Scalar quantization [12]: a multi-bit adaptive quantization scheme that uses only magnitude for quantization.(2)Kmeans vector quantization [16]: multidimensional quantization using the kmeans clustering algorithm with CSI.(3)Balanced kmeans quantization [17]: add balanced constraints to the kmeans vector quantization to ensure the randomness of the key.(4)BKQ-BM [18]: a variation of the kmeans algorithm ensures that each cluster has the same size, randomizing the shared key.
Figure 11 compares the KDR of the five quantization algorithms. We can see that the KDR of four vector quantization algorithms is significantly lower than scalar quantization. In addition, three balanced vector quantization algorithms have a lower KDR than the kmeans algorithm. This is because the balanced quantization algorithm adds the constraint of the same-sized number of samples per cluster, which is used to improve the secret key randomness with some performance sacrifice. ILP-BVQ and balanced kmeans perform the same, and they differ only in the sample allocation method, which does not affect the result of key generation. The BKQ-BM algorithm has the highest KDR because it cannot guarantee that the clustering results do not overlap. Figure 12 compares the KDR of the three quantization algorithms with and without using CRCNet for channel compensation. It shows that for all algorithms, using CRCNet can reduce the KDR as a result of the improved channel correlation between legitimate users through CRCNet channel compensation.


In Figure 13, the time consumption of Alice and Bob with four vector quantization algorithms is plotted as a function of SNR in dB. It is evident that the kmeans quantization algorithm, which does not require consideration of the balancing constraint, has the lowest time consumption. Among the three balanced vector quantization algorithms, ILP-BVQ and BKQ-BM have similar time consumption and are significantly lower than the balanced kmeans algorithm. This is because the time complexity of the sample allocation algorithm for each of these three algorithms is , , and , respectively. Figure 14 shows a comparison of the time consumption of Alice and Bob using the four vector quantization algorithms in different numbers of quantization regions. The kmeans quantization algorithm has the lowest time consumption, followed by ILP-BVQ and BKQ-BM, while the balanced kmeans have the highest time consumption.


In this paper, we add a balancing constraint to the kmeans vector quantization algorithm to limit the number of samples in each cluster to enhance shared key randomness. We use the NIST test [40] to verify the randomness of generated keys of the proposed scheme. The output of each NIST test is the value. The detected sequence passes the test when the value exceeds a certain threshold (usually 0.01). Only test the original key generated by the quantized gray code. In this case, set the number of quantized regions to 16. This experiment tests four vector quantization algorithms. Each algorithm tests 100 sets of keys, and the length of each set of keys is 256.
The results of the NIST test are shown in Table 2. The tests of three balanced kmeans algorithms passed most of the test items with high probability. The kmeans algorithm has significantly lower test results than the three balanced kmeans algorithms, passing a minority of test items. This is because the kmeans quantization algorithm cannot ensure the same number of samples in each cluster. The number of samples in a specific cluster may be relatively high, and some bit sequences in the quantization results are large-scale repeated, resulting in lower key randomness.
5.5. Information Leakage
Considering the existence of eavesdroppers, we analyze the relationship between eavesdropping channel correlation and information leakage by controlling the relative positions of the eavesdroppers and legitimate users. Figure 15 shows the setup of the experimental scenario in the presence of an eavesdropper. Fix the positions of base station Alice and legitimate user Bob, and control the eavesdropper Eve to move to both sides away from Alice and Bob, respectively. The blue line in the figure is the eavesdropper’s moving direction. We analyze the effect of the eavesdropper being close to the base station or close to the user on key leakage. The differences between the three balanced quantization schemes, ILP-BVQ, BKQ-BM, and balanced kmeans, are only reflected in the quantization process on the Alice side of the base station. Therefore, only the scalar and kmeans quantization schemes are compared here.

This paper uses mutual information to represent the information leakage rate. Before computing the mutual information, we need to build a dataset containing , , and with a size of . Where and are the original keys quantified by Alice and Bob, is the eavesdropping key quantified by Eve using the same quantization algorithm as the legitimate user, L is the key length, and N is the number of samples. Both the original key and the eavesdropping key are discrete random variables represented in binary with the same length.
This paper uses the Monte Carlo technique-based approximation technique to estimate the mutual information. At first, we randomly selected a large number of samples from the data set (each sample contains , , and ). Then, the mutual information of each sample is calculated using equation (11). Finally, the mutual information of all samples is averaged to obtain the approximate mutual information value.
The first scenario assumes that eve is near user Bob. The results of mutual information in the case with and without the CRCNet model using three quantization algorithms, scalar quantization, kmeans quantization, and ILP-BVQ, are shown in Figure 16. As the figure shows, the key leakage is minimal, only reaching about 10% at = 0.8. This indicates that even if the eavesdropping channel is highly correlated with the legitimate channel, the eavesdropper can obtain only limited information about generated keys. Using CRCNet and the balanced vector quantization algorithm can also help reduce the rate of key leakage.

The second scenario is when Eve is close to the base station, Alice. This scenario is slightly different from the previous one. In this case, the data Alice uses for quantization is compensated, and the correlation of the channel data Eve uses for quantization is different from the actual one. Figure 17 shows the results of the mutual information calculation. Under the same eavesdropping channel correlation condition, the mutual information is significantly smaller when close to base station Alice than when close to user Bob. This is because the eavesdropper has no information about the parameters of the CRCNet. Alice’s data for quantization are equivalent to a transformation, which reduces the key leakage rate. The experimental results of the two scenarios above show that vector quantization outperforms scalar quantization in terms of preventing information leakage. Moreover, CRCNet can reduce the key leakage rate and improve key robustness.

6. Conclusions
In this paper, we propose a deep learning-based channel reciprocity compensation method and a balanced vector quantization algorithm for generating physical layer keys. Firstly, we build a channel reciprocity compensation network to describe the wireless environment and learn the mapping relationship of wireless channels among legitimate users. The trained CRCNet compensates Alice’s channel measurements, and shared keys are generated based on quantizing the compensated channel measurements. This scheme achieves significant performance improvements over existing schemes in terms of channel reciprocity and KDR. In addition, to address the weak randomness of the kmeans algorithm and the high time complexity of the balanced kmeans algorithm in existing vector quantization algorithms. We propose an ILP-based balanced vector quantization algorithm. A cluster balancing mechanism is added to ensure the randomness of shared keys and solve the sample assignment problem in the balanced quantization process by integer linear programming. Because the ILP-BVQ algorithm’s clustering results do not overlap, we can reduce the algorithm’s time complexity from to while maintaining a low KDR. Finally, we build a physical layer key generation system on Matlab by simulating the channel variations in a real environment with QuaDRiGa [38]. The comparable performance of our scheme has been verified.
6.1. Future Work
One of the future research works is to use migration learning and meta-learning models in the field of physical layer key generation, which can help to solve the inapplicability problem caused by environmental changes. Since most of the current physical layer key generation schemes are based on point-to-point schemes, the other future research work is to extend the research to the multi-user domain and group key generation application.
Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.
Conflicts of Interest
The authors declare that there are no conflicts of interest.
Acknowledgments
This work is supported by the National Key R&D Program of China (grant no. 2020YFE0200600) and National Nature Science Foundation of China (grant no. U22B2026).