# Deep Learning-Based Channel Reciprocity Learning for Physical Layer Secret Key Generation

Authors: Haoyu He; Yanru Chen; Xinmao Huang; Minghai Xing; Yang Li; Bin Xing; Liangyin Chen
Journal: Security and Communication Networks
 (2022)

---

## Abstract

Using the physical layer channel information of wireless devices to establish the highly consistent secret keys is a promising technology for improving the security of wireless networks. Nevertheless, in the time division duplex system, the reciprocity of the wireless channel that is the basic principle of key generation is impaired by nonsimultaneous sampling and noise factors. Existing physical layer key generation approaches rely on hand-crafted feature extraction algorithms, which have high overhead or security issues and are impractical in real-world situations. This paper presents a novel physical layer key generation method to extract highly consistent keys from imperfect channel responses, which exploits channel reciprocity through deep learning. Specifically, we first design the Channel Reciprocity Learning Net (CRLNet), a neural network for efficiently learning channel reciprocity features from the wireless channel in TDD OFDM systems. Later, a new key generation scheme based on CRLNet is developed that can achieve a high key agreement rate. Experiments indicate that the CRLNet-based key generation scheme performs excellently in terms of key generation rate, key error rate, and randomness, confirming that our method has better performance and lower overhead than existing methods.


---

## Body

## 1. Introduction

Physical layer key generation is a promising encryption technique in wireless systems, which has recently received much attention [1–3]. In contrast to its traditional counterpart, physical layer key generation uses the inherent unpredictability of channel changes between valid users to establish information-theoretic security without the assistance of a third party. This channel-based scheme achieves stronger security, higher key generation rate, and lower costs than the conventional ways [4–6]. With the development of emerging wireless systems, e.g., IoT, Internet of Vehicles (IoV), and Unmanned Aerial Vehicles (UAV), the physical layer key generation becomes popular in recent years [7–9]. The basic concept behind physical layer key generation is that two legitimate devices named Alice and Bob exchange information publicly to acquire channel responses, which are then utilized to extract symmetric keys. The viability of this procedure is based on three principles: temporal variation, channel reciprocity, and spatial decorrelation [2]. Among them, channel reciprocity requires that the channel features collected by Alice and Bob within the coherence time be highly correlated. This is fundamental for legal devices to produce matching keys from channel features separately. However, key generation is most commonly used in time-division duplex (TDD) systems, since nonsimultaneous sampling, channel noise, and hardware diversity significantly weaken the correlation of channel measurements between two authorized users [10]. Thus, it is crucial to construct reciprocal channel features in a nonideal wireless channel.Intentionally designed feature extraction methods can capture reciprocal component within channel measurements. Some researchers use conventional linear transforms to extract characteristics, such as principal component analysis (PCA) [10, 11], discrete cosine transform (DCT) [12], and wavelet transform (WT) [13]. Several applied nonlinear feature extraction approaches outperform the linear transform, such as [14, 15]. In simulation experiments, these approaches provide good key agreement and a high generation rate, but they lack robustness in practical wireless situations. There are some preprocessing algorithms that are specifically developed to exploit reciprocity from channel measurements [16–18]. On the one hand, these methods are computationally expensive or have security vulnerabilities. On the other hand, these human-crafted feature extraction approaches are based on personal observations and are inflexible in diverse real-world environments.Deep learning is a powerful features extraction technology, which does not need a predefined statistical characteristic of the channel model. In the field of wireless communication and networking, various deep learning applications have emerged in recent decades, including resource allocation [19], channel estimation [20], modulation classification [21], and low rate CSI feedback [22]. However, few studies have focused on applying deep learning to capture reciprocity in the field of physical layer key generation. Existing key generation methods depend on the prior knowledge of wireless channel and cannot work properly in the situations that do not follow the statistical distribution assumption of the channel response. Therefore, we intend to leverage powerful feature learning capability of DL to adaptively construct consistent secret keys from the imperfect channel in real-world wireless systems.In this paper, by employing deep learning, we propose a novel method for capturing reciprocal channel characteristics to efficiently generate secret keys. Specifically, we design the Channel Reciprocity Learning Net (CRLNet), a multibranch autoencoder-based neural network based on the prior knowledge of the channel measurement model. The proposed model is driven by the channel state information (CSI) of the TDD Orthogonal Frequency-Division Multiplexing (OFDM) system, which can achieve a higher key generation rate than RSS [2]. The CRLNet can be trained to adaptively learn the reciprocity components in weakly correlated channels using the collected CSI data. Furthermore, a complete key generation scheme is designed based on the CRLNet. To demonstrate the validity and effectiveness of our algorithm, we conduct comprehensive testing in various real-world wireless environments. The following are our primary contributions in detail.(1)
We design a novel multibranch autoencoder-based neural network, named CRLNet, and a special hybrid loss function to train the network according to the channel measurement model. Without any knowledge of the statistical distribution of channel responses, the model trained utilizing the CSI data from the commercial WiFi devices can construct highly correlated channel features that can be quantized into high-agreement secret keys.(2)
Based on our deep learning model, a practical secret key generation mechanism is developed. In contrast to the existing method, the proposed scheme achieves higher performance without high computing overhead or security risks.(3)
Extensive testing results conducted under static and mobile environments in both indoor and outdoor scenarios show that the proposed method is feasible and effective. A superior key generation rate, key error rate, and randomness are all achieved as compared to previous methods.The rest of this paper is arranged as follows. Related Works shows relevant researches. The standard flow for secret key generation and the reciprocal feature learning algorithm developed by us are shown in Materials and Methods. The designed deep learning based key generation scheme is also included in this section. The experiments used to evaluate the proposed method’s performance are presented in the Results and Discussion, which is preceded by the Conclusions.


## 2. Related Works

Physical layer key generation was first studied in the mid-1990s. It has been demonstrated that extracting secret keys from wireless channel characteristics can achieve reliable information-theoretic security [23]. In [24], the authors collect the sender’s signal in the IEEE 802.11 wireless network and extract the RSS estimation in the channel to quantify it into secret keys. The authors in [25] analyze the impact of changes in the environment on the performance of the RSS-based method and discover that the key generation rate was higher in a dynamic environment. Due to the limited key generation rate and insufficient randomness of RSS-based methods, [16, 26, 27] exploit fine-grained channel state information (CSI) to achieve better performance. In addition, [16] proves that CSI-based methods are immune to attacks that RSS-based methods are vulnerable to, such as predicted channel attack and stalker attack. However, since the majority of these researches are limited to theoretical analysis and simulation studies, it is difficult to demonstrate their feasibility and generality in the real wireless environment.Several deep learning based methods have recently emerged for extracting meaningful features from physical layer channel responses [28–32]. O’Shea and Hoydis [28] show several potential applications of deep learning in the physical layer. The authors model the wireless communication as the end-to-end autoencoder and achieve better performance than conventional methods. Abyaneh et al. [29] use convolutional neural networks to extract features from CSI, which improves the accuracy of the physical layer authentication system. Liu et al. [30] propose a self-supervised learning framework for IoT applications to learn the underlying physical features of sensing signals. Huang et al. [31] design a deep neural network for channel calibration in massive MIMO systems, which can construct a nonlinear mapping between DL and UL channels. Zhang et al. [32] use a fully connected neural network to learn the mapping function between CSI of different frequency bands in an FDD system. Inspired by these works, we apply deep learning to learn reciprocal features from the imperfect channel to generate consistent secret keys in complex wireless communication.


## 3. Materials and Methods

### 3.1. Secret Key Generation Flow

Generally, key generation based on physical channel characteristics includes five steps [2].(1)
Channel probing: legitimate devices named Alice and Bob periodically exchange probing packets to facilitate channel estimation in receiving end. Assuming the wireless channel response recorded at Alice and Bob areHa′ and Hb′, respectively, as expressed below,(1)Hu′=Hu+Nu,whereu=a,b represent channel response of Alice and Bob, Hu is the wireless channel response of the perfect channel, and Nu is the independent nonreciprocal components in the both ends of wireless communication.(2)
Reciprocity feature extraction: as mentioned above, reciprocity is greatly weakened by nonsimultaneous measurements due to the TDD system and separate noise residing in various devices, as present in Figure1. Because the reciprocal components of the channel are mixed with variable nonreciprocal components in the environment, it is difficult to directly extract matching key pairs from the results of channel estimation. The reciprocity feature extraction method is therefore in charge of extracting the reciprocity feature from the original channel response.(3)
Quantization: this stage’s goal is to convert the channel measurements into a bit sequence. Depending on the wireless communication environment, different quantization levels should be specified, resulting in a compromise among the key generation rate and the key error rate [6].(4)
Information reconciliation: the initial generated keys are not all exactly the same. Reconciliation is used to correct the mismatched bits in the key. The main methods include Cascade [33], error correcting code (ECC) [34], BCH code [35], and Golay code [36].(5)
Privacy amplifying: during the information reconciliation stage, Alice and Bob transmit some information that eavesdroppers may hear. To ensure the security of the generated key, the hash function is generally used to convert the corrected initial key to fixed-length final keys that can be used directly in cryptographic techniques [37].Figure 1
The first dimension of normalized CSI value’s real part recorded by Alice and Bob. It can be observed that the reciprocity of the channel is weakened by other factors.Reciprocity feature learning is the most essential phase in physical layer key generation, with a significant influence on key error rate, key generation rate, and randomness of the generated key. The initial key with a lower key error rate can facilitate the subsequent stages. Therefore, we build a neural network model capable of learning the reciprocity component from the channel response.


### 3.2. Reciprocity Learning Design

The major focus of this research is to extract the reciprocity component from the channel response in order to generate extremely consistent keys. We present the Channel Reciprocity Learning Net (CRLNet) to efficiently learn the reciprocal component of the original channel response.The design of CRLNet is based on formula (1) and its structure is displayed in Figure 2. To eliminate Nu from channel response as much as possible, we designed a nonreciprocity learning module (NRLM), which consists of three hidden linear layers whose numbers of neurons are 512, 256, and 256, its input is the origin channel response, and the output is nonreciprocal component expressed as Nu. The multibranch autoencoder part is a symmetrical structure, which consists of two encoders (Encodera, Encoderb) and a shared weight decoder (Decoder). The whole CRLNet is composed of a multibranch autoencoder and two NRLMs.Figure 2
CRLNet structure design.During the training phase, the input of the neural network is paired CSI (Ha′, Hb′) records by Alice and Bob, and the output is Ha^ and Hb^, which suppress the nonreciprocal part and are highly correlated. The encoded primary features Za of channel response are learned by Encodera from Ha′, whereas NRLMa is employed to distinguish the nonreciprocal component. Encoderb and NRLMb do the same operation on Hb′ as Encodera and NRLMa. The shared weight decoder is utilized to reconstruct Ha^ and Hb^ from strongly reciprocal encoded features Za, Zb. Finally, the desired reciprocal compressed features Za and Zb can directly be used for quantization. The reason why we choose Za, Zb instead of Ha^ and Hb^ that is also highly correlated is that they eliminate redundancy from adjacent subcarriers that may mitigate randomness [26].We propose a hybrid loss function, which consists of three parts:(1)
We adopt the mean squared error loss forZa and Zb to enforce the proposed neural network to learn the reciprocity between paired channel responses, as shown below:(2)L1=1m∑i=1mZai−Zbi2,whereZa, Zb represent output of Encodera and Encoderb respectively, and m is the number of training samples.(2)
The second loss function is based on formula (1). It is introduced to minimize the difference between the channel response recovered by the decoder plus the nonreciprocal part extracted by NRLM and the original input of Alice, as shown below:(3)L2=1m∑i=1mHai^+Na−Hai′2,whereHai^ is the output of Decoder for Zai, Na is the noise residing in Alice side, and Hai′ is imperfect CSI input from Alice. The result of loss restricts the difference between the result of reconstruction plus the nonreciprocal part extracted by NLRM and the original input to be small enough to ensure that the encoder has really learned the main channel features.(3)
The third loss function is similar to the second, but it is for Bob’s channel response, as shown below:(4)L3=1m∑i=1mHbi^+Nb−Hbi′2,where Hbi^ is the output of Decoder for Zbi, Nb is the noise residing in Bob side, and Hbi′ is imperfect CSI input from Bob.The proposed final loss function is expressed as below:(5)Loss=L1+L2+L3.


### 3.3. Data Collection and Preprocessing of Dataset

Our data is collected in a variety of scenarios, including mobile and static, and in both indoor and outdoor situations. Using two Lenovo X220 laptops equipped with the Intel WiFi Link 5300 wireless card, we acquired 100,000 pairs of CSI data in each scenario.The signal from two transmitting antennas and three receiving antennas are recorded and parsed to CSI values by the Linux 802.11n CSI Tool [38]. By utilizing the antenna diversity [16, 26], the estimated CSI has better randomness than a Single-Input and Single-Output (SISO) system. Each packet’s CSI value is a complex matrix with the shape of 30×2×3, which extracts from 30 subcarriers. Since neural networks cannot deal with complex numbers, the first step in preprocessing the datasets is to stack the real and imaginary parts of CSI matrix Hu′, which can be defined as(6)Hu′⟶RealHu′,ImagHu′,where Real·,Imag· denote the real and imaginary parts of the CSI matrix. The stacked matrix is then flattened to a one-dimensional vector with a size of 360. Because each dimension of the raw input regular has a distinctive magnitude, we normalize the datasets so that their range is between 0 and 1. The process for normalizing is as follows:(7)Hunorm′l=Hu′l−Humin′lHumax′l−Humin′l,where Humax′l and Humin′l are the max value and minimum value of l th dimension of Hu′, Hu′l is the l th element of the Hu′, and Hunorm′l is the normalized l th element of Hu′.


### 3.4. Secret Key Generation Scheme Based on Reciprocity Learning

We design a complete key generation scheme based on our proposed reciprocity learning algorithm, which is present in Figure3.Figure 3
The proposed key generation procedure based on CRLNet.In the training phase, we need to collect enough CSI data to serve as the training dataset of our model. In particular, Alice sends a probing packet to Bob at a rate of 10 packets per second during the channel probing stage. When Bob receives the packet, he replies an ACK packet to Alice immediately. We guarantee that the time interval between receiving the corresponding packet at both ends is less than 10 ms, which is much less than the coherence time, so the channel can be regarded constant within this time interval. This process is repeated until we collect enough channel responses. After preprocessing the data according to the above method, we randomly shuffle the dataset, selecting 80% of it for training the proposed deep learning model and the rest 20% for testing. The PyTorch framework is used to implement the proposed neural network, which is trained for 50 epochs using the Adam algorithm. The batch size is set to 128 and the learning rate is set at 1e − 3.In the key generation phase, we fix the network parameters of the model, and then equipEncodera on Alice and Encoderb on Bob, respectively. The Decoder and NRLM are only used to ensure that the model can suppress nonreciprocal noise and help encoders learn the main features of channel response during training. This overhead does not exist during the operational phase.We can intuitively observe whether CRLNet has extracted the reciprocity feature of the channel. The dispersion of channel characteristics throughout 30 subcarriers is illustrated in Figure4. Figure 5 shows the channel feature processed by CRLNet, which has a high degree of reciprocity.Figure 4
Channel response of Alice and Bob that contains nonreciprocal part before using CRLNet.Figure 5
Channel response of Alice and Bob after using CRLNet, which is highly reciprocal.The collected channel features are converted to a binary key using the uniform quantization approach [2]. Each bit of the key sequence Q can be calculated as(8)Qi=1,xi≥q+,0,xi≤q−,−1,else,where Qi is the i th bit of generated key and xi is the i th element of obtained reciprocal feature. q+ and q− are defined as(9)q+=F−10.5+εq−=F−10.5−ε,where F−1 is the inverse of the cumulative distribution function (CDF) of Gaussian distribution Nμ,σ2 and μ, σ are the mean and standard deviation value of the produced feature. ε is a quantization factor corresponding to the environment. The values which are quantified to −1 are deleted from the initial key from both Alice and Bob.For information reconciliation, we can adopt Cascade [33] or BCH code [35] protocol. With regard to privacy amplification, hash functions [37] can be used to convert the key to a fixed length secret key, which can be used for encryption directly. However, only the performance of the initial secret key is evaluated without information reconciliation and privacy amplification to ensure that the comparison is fair.


## 3.1. Secret Key Generation Flow

Generally, key generation based on physical channel characteristics includes five steps [2].(1)
Channel probing: legitimate devices named Alice and Bob periodically exchange probing packets to facilitate channel estimation in receiving end. Assuming the wireless channel response recorded at Alice and Bob areHa′ and Hb′, respectively, as expressed below,(1)Hu′=Hu+Nu,whereu=a,b represent channel response of Alice and Bob, Hu is the wireless channel response of the perfect channel, and Nu is the independent nonreciprocal components in the both ends of wireless communication.(2)
Reciprocity feature extraction: as mentioned above, reciprocity is greatly weakened by nonsimultaneous measurements due to the TDD system and separate noise residing in various devices, as present in Figure1. Because the reciprocal components of the channel are mixed with variable nonreciprocal components in the environment, it is difficult to directly extract matching key pairs from the results of channel estimation. The reciprocity feature extraction method is therefore in charge of extracting the reciprocity feature from the original channel response.(3)
Quantization: this stage’s goal is to convert the channel measurements into a bit sequence. Depending on the wireless communication environment, different quantization levels should be specified, resulting in a compromise among the key generation rate and the key error rate [6].(4)
Information reconciliation: the initial generated keys are not all exactly the same. Reconciliation is used to correct the mismatched bits in the key. The main methods include Cascade [33], error correcting code (ECC) [34], BCH code [35], and Golay code [36].(5)
Privacy amplifying: during the information reconciliation stage, Alice and Bob transmit some information that eavesdroppers may hear. To ensure the security of the generated key, the hash function is generally used to convert the corrected initial key to fixed-length final keys that can be used directly in cryptographic techniques [37].Figure 1
The first dimension of normalized CSI value’s real part recorded by Alice and Bob. It can be observed that the reciprocity of the channel is weakened by other factors.Reciprocity feature learning is the most essential phase in physical layer key generation, with a significant influence on key error rate, key generation rate, and randomness of the generated key. The initial key with a lower key error rate can facilitate the subsequent stages. Therefore, we build a neural network model capable of learning the reciprocity component from the channel response.


## 3.2. Reciprocity Learning Design

The major focus of this research is to extract the reciprocity component from the channel response in order to generate extremely consistent keys. We present the Channel Reciprocity Learning Net (CRLNet) to efficiently learn the reciprocal component of the original channel response.The design of CRLNet is based on formula (1) and its structure is displayed in Figure 2. To eliminate Nu from channel response as much as possible, we designed a nonreciprocity learning module (NRLM), which consists of three hidden linear layers whose numbers of neurons are 512, 256, and 256, its input is the origin channel response, and the output is nonreciprocal component expressed as Nu. The multibranch autoencoder part is a symmetrical structure, which consists of two encoders (Encodera, Encoderb) and a shared weight decoder (Decoder). The whole CRLNet is composed of a multibranch autoencoder and two NRLMs.Figure 2
CRLNet structure design.During the training phase, the input of the neural network is paired CSI (Ha′, Hb′) records by Alice and Bob, and the output is Ha^ and Hb^, which suppress the nonreciprocal part and are highly correlated. The encoded primary features Za of channel response are learned by Encodera from Ha′, whereas NRLMa is employed to distinguish the nonreciprocal component. Encoderb and NRLMb do the same operation on Hb′ as Encodera and NRLMa. The shared weight decoder is utilized to reconstruct Ha^ and Hb^ from strongly reciprocal encoded features Za, Zb. Finally, the desired reciprocal compressed features Za and Zb can directly be used for quantization. The reason why we choose Za, Zb instead of Ha^ and Hb^ that is also highly correlated is that they eliminate redundancy from adjacent subcarriers that may mitigate randomness [26].We propose a hybrid loss function, which consists of three parts:(1)
We adopt the mean squared error loss forZa and Zb to enforce the proposed neural network to learn the reciprocity between paired channel responses, as shown below:(2)L1=1m∑i=1mZai−Zbi2,whereZa, Zb represent output of Encodera and Encoderb respectively, and m is the number of training samples.(2)
The second loss function is based on formula (1). It is introduced to minimize the difference between the channel response recovered by the decoder plus the nonreciprocal part extracted by NRLM and the original input of Alice, as shown below:(3)L2=1m∑i=1mHai^+Na−Hai′2,whereHai^ is the output of Decoder for Zai, Na is the noise residing in Alice side, and Hai′ is imperfect CSI input from Alice. The result of loss restricts the difference between the result of reconstruction plus the nonreciprocal part extracted by NLRM and the original input to be small enough to ensure that the encoder has really learned the main channel features.(3)
The third loss function is similar to the second, but it is for Bob’s channel response, as shown below:(4)L3=1m∑i=1mHbi^+Nb−Hbi′2,where Hbi^ is the output of Decoder for Zbi, Nb is the noise residing in Bob side, and Hbi′ is imperfect CSI input from Bob.The proposed final loss function is expressed as below:(5)Loss=L1+L2+L3.


## 3.3. Data Collection and Preprocessing of Dataset

Our data is collected in a variety of scenarios, including mobile and static, and in both indoor and outdoor situations. Using two Lenovo X220 laptops equipped with the Intel WiFi Link 5300 wireless card, we acquired 100,000 pairs of CSI data in each scenario.The signal from two transmitting antennas and three receiving antennas are recorded and parsed to CSI values by the Linux 802.11n CSI Tool [38]. By utilizing the antenna diversity [16, 26], the estimated CSI has better randomness than a Single-Input and Single-Output (SISO) system. Each packet’s CSI value is a complex matrix with the shape of 30×2×3, which extracts from 30 subcarriers. Since neural networks cannot deal with complex numbers, the first step in preprocessing the datasets is to stack the real and imaginary parts of CSI matrix Hu′, which can be defined as(6)Hu′⟶RealHu′,ImagHu′,where Real·,Imag· denote the real and imaginary parts of the CSI matrix. The stacked matrix is then flattened to a one-dimensional vector with a size of 360. Because each dimension of the raw input regular has a distinctive magnitude, we normalize the datasets so that their range is between 0 and 1. The process for normalizing is as follows:(7)Hunorm′l=Hu′l−Humin′lHumax′l−Humin′l,where Humax′l and Humin′l are the max value and minimum value of l th dimension of Hu′, Hu′l is the l th element of the Hu′, and Hunorm′l is the normalized l th element of Hu′.


## 3.4. Secret Key Generation Scheme Based on Reciprocity Learning

We design a complete key generation scheme based on our proposed reciprocity learning algorithm, which is present in Figure3.Figure 3
The proposed key generation procedure based on CRLNet.In the training phase, we need to collect enough CSI data to serve as the training dataset of our model. In particular, Alice sends a probing packet to Bob at a rate of 10 packets per second during the channel probing stage. When Bob receives the packet, he replies an ACK packet to Alice immediately. We guarantee that the time interval between receiving the corresponding packet at both ends is less than 10 ms, which is much less than the coherence time, so the channel can be regarded constant within this time interval. This process is repeated until we collect enough channel responses. After preprocessing the data according to the above method, we randomly shuffle the dataset, selecting 80% of it for training the proposed deep learning model and the rest 20% for testing. The PyTorch framework is used to implement the proposed neural network, which is trained for 50 epochs using the Adam algorithm. The batch size is set to 128 and the learning rate is set at 1e − 3.In the key generation phase, we fix the network parameters of the model, and then equipEncodera on Alice and Encoderb on Bob, respectively. The Decoder and NRLM are only used to ensure that the model can suppress nonreciprocal noise and help encoders learn the main features of channel response during training. This overhead does not exist during the operational phase.We can intuitively observe whether CRLNet has extracted the reciprocity feature of the channel. The dispersion of channel characteristics throughout 30 subcarriers is illustrated in Figure4. Figure 5 shows the channel feature processed by CRLNet, which has a high degree of reciprocity.Figure 4
Channel response of Alice and Bob that contains nonreciprocal part before using CRLNet.Figure 5
Channel response of Alice and Bob after using CRLNet, which is highly reciprocal.The collected channel features are converted to a binary key using the uniform quantization approach [2]. Each bit of the key sequence Q can be calculated as(8)Qi=1,xi≥q+,0,xi≤q−,−1,else,where Qi is the i th bit of generated key and xi is the i th element of obtained reciprocal feature. q+ and q− are defined as(9)q+=F−10.5+εq−=F−10.5−ε,where F−1 is the inverse of the cumulative distribution function (CDF) of Gaussian distribution Nμ,σ2 and μ, σ are the mean and standard deviation value of the produced feature. ε is a quantization factor corresponding to the environment. The values which are quantified to −1 are deleted from the initial key from both Alice and Bob.For information reconciliation, we can adopt Cascade [33] or BCH code [35] protocol. With regard to privacy amplification, hash functions [37] can be used to convert the key to a fixed length secret key, which can be used for encryption directly. However, only the performance of the initial secret key is evaluated without information reconciliation and privacy amplification to ensure that the comparison is fair.


## 4. Results and Discussion

### 4.1. Performance of Deep Learning Model

We compare the performance of CRLNet with the following three benchmark models in the four diverse environments (indoor static, indoor mobile, outdoor static, and outdoor mobile):(1)
AE [28] is a normal single-branch autoencoder model, whose encoder part and decoder part have the same structure as the CRLNet.(2)
FNN [31]: the FNN is a model for UL/DL channel calibration in generic massive MIMO systems. It is a multilayer perceptron with three hidden layers.(3)
KGNet [32]: the KGNet is proposed for band feature mapping function for key generation in FDD systems.Because these comparison models have only single input and single output, these networks function as the mapping between CSI of Alice and CSI of Bob. The network’s input is CSI of Alice, and mean square error is used to minimize the difference between the network output and CSI of Bob. The network’s input and output are a pair of reciprocal features for these benchmark models. The mean square error (MSE) between the reciprocal featuresZa, Zb is utilized to compare the performance of the neural networks, which is described as(10)MSE=1m∑i=1mZai−Zbi2.The MSE indicates the ability of the model to learn the channel reciprocity. Figure6 shows the MSE comparison results in all testing scenarios. We observe that our model performs better than all other benchmark models in these scenarios, while the performance of AE is worse than that of CRLNet, which means that the NRLM we designed really learned to eliminate the nonreciprocal part from channel response.Figure 6
The comparison results of CRLNet and benchmark models in terms of MSE in different testing cases. It can be observed that CRLNet outperforms other neural networks.To prove the efficiency of the proposed hybrid loss function, we compare the performance of trained model withL1 and without L1 loss function. The existence of reconstruction loss L2 and L3 loss functions is necessary, because it is used to ensure that the model has really learned the main features of the channel response. As shown in Figure 7, the CRLNet with the L1 loss function performs excellently, while the model without the L1 loss function fails to achieve an acceptable MSE. The comparison results verify the irreplaceable role of L1 for learning channel reciprocity.Figure 7
The MSE of CRLNet trained withL1 and without L1 loss function in different testing cases. This highlights how important L1 loss is for CRLNet.The task of NRLM is to separate the nonreciprocal part from the input channel response. To study the influence of different network design ofNRLM on the resulting reciprocal feature extraction performance, the following experiment was conducted. As shown in Figure 8, we compared original CRLNet and three modified CRLNet equipped with distinct NRLM modules in terms of MSE. The NRLM1 is the NRLM we proposed above, the NRLM2 adds an extra hidden layer on the original NRLM, the NRLM3 increases the number of neurons in each hidden layer of original NRLM, and the NRLM4 is composed of three 1D convolutional layers. The specific parameters of these modules are given in Table 1. We can see that increasing the hidden layer’s depth or width does not bring a meaningful improvement. Using a 1D convolutional layer to replace the fully connected layer can get lower MSE, but it will significantly increase overhead in training phase. Therefore, the original NRLM has a good tradeoff between performance and computational cost.Figure 8
Compare CRLNet performance with the original and modified NRLM in terms of MSE.Table 1
Parameters of original and modified NRLM.
NameHidden layers parametersNRLM1(512, 256, 256)NRLM2(512, 256, 256, 128)NRLM3(1024, 512, 512)NRLM4conv1×3,relu,conv1×3,relu,conv1×3


### 4.2. Performance of Key Generation

We employ different models in the reciprocity feature extraction step to compare the performance of the key generation; the other steps remain the same. We use the following metrics to verify the effectiveness of the initial generated key:(1)
Key Error Rate (KER) is defined as the number of conflict bits in the initial keys generated by two devices divided by the total number of the generated bits.(2)
Key Generation Rate (KGR) is defined as the number of bits generated by each probing packet.(3)
Randomness: the standard NIST test suite [39] is used to measure the randomness of the initial key.We first compare average KER of initial key of the four deep learning models under testing dataset in different environments. As shown in Figure9, CRLNet outperforms other benchmark models in terms of KER. When the KER of other models is too high to be used for matched key establishment in practice, a suitably low KER is achieved in all test cases.Figure 9
The KER of comparison model in all testing cases with the quantization factorε is set to 0.01. The CRLNet achieve much lower KER than other models.Our model and the benchmark model produce reciprocity feature with different sizes; therefore the KGR cannot be directly compared. For a fair comparison, we first use the PCA method to reduce the output features of the three comparison models to the same dimension as the CRLNet and then quantize the features to the initial keys. Figure10 indicates that CRLNet has the highest KGR under all experimental scenarios.Figure 10
The KGR of comparison model in all testing cases with the quantization factorε is set to 0.01. The CRLNet achieve the highest KGR.In Figures11 and 12, we compare KER and KGR with different quantization factors ε of 0.01, 0.05, 0.1, and 0.15 in all scenarios. The result demonstrates that as the quantization factor increases, both the KER and KGR decrease, implying a performance tradeoff. To acquire the best performance in the real world, we can adjust the quantization factor based on the signal-to-noise ratio (SNR) of the environment.Figure 11
The KGR of CRLNet using different quantization factor in all testing cases.Figure 12
The KER of CRLNet using different quantization factor in all testing cases.To verify the sufficient randomness of the generated keys, we perform NIST statistical tests on testing datasets. Table2 shows the test results in four environments with the quantization factor of 0.01. All the cases pass the test and have the p-value much larger than 0.01, which is the threshold to pass the test.Table 2
NIST statistical test suite results in different scenarios with the quantization factor of 0.01.
ScenarioIndoor staticIndoor mobileOutdoor staticOutdoor mobileApproximate entropy0.7980.8150.8610.854Cumulative sums0.4970.8620.7470.903DFT0.4660.5240.6100.583Frequency0.4510.7790.6050.822Ranking0.3750.4160.3790.471Runs0.8370.6050.4810.524Serial0.3160.5230.8770.9010.4520.5060.7080.924


### 4.3. Impact of the SNR

In order to prove the generalization performance of the proposed key generation method in complex scenarios, we added artificial Gaussian white noise, which caused the SNR to change from 0 dB to 20 dB. We compared our method with three benchmark methods [28, 31, 32], in terms of KER versus signal-to-noise ratio. As shown in Figure 13, the CRLNet based key generation scheme outperforms the counterparts in respect of KER. This demonstrates that the benefit of our method is that it is independent of the channel’s statistical properties and can generate a consistent key based on the training dataset in an adaptable and effective manner.Figure 13
The KER of the four methods versus SNR of dataset.


### 4.4. Computational Complexity

The difference in computational complexity between our method and existing physical layer key generation methods is in the reciprocity feature extraction stage. In our method, there is no information sharing across legitimate nodes during the key generation process. In addition, our feature extraction only requires a single encoder of the CRLNet, which retains a low overhead.In Figure14, we compared the average execution time of the feature extraction stage for single packet between the proposed method and the above benchmark methods. The hardware environments we use are as follows: AMD Ryzen 5600X CPU, 16 GB RAM, Windows 10 Home 64-bit operating system. For all comparison methods, we use it to process 20,000 packets and calculate the average execution time for each packet. This process is repeated 20 times, and the average value is taken as the final result. As can be seen, our proposed method has the shortest execution time because it only relies on the lightweight encoder network module to extract reciprocal features.Figure 14
The execution time of channel feature extraction.


## 4.1. Performance of Deep Learning Model

We compare the performance of CRLNet with the following three benchmark models in the four diverse environments (indoor static, indoor mobile, outdoor static, and outdoor mobile):(1)
AE [28] is a normal single-branch autoencoder model, whose encoder part and decoder part have the same structure as the CRLNet.(2)
FNN [31]: the FNN is a model for UL/DL channel calibration in generic massive MIMO systems. It is a multilayer perceptron with three hidden layers.(3)
KGNet [32]: the KGNet is proposed for band feature mapping function for key generation in FDD systems.Because these comparison models have only single input and single output, these networks function as the mapping between CSI of Alice and CSI of Bob. The network’s input is CSI of Alice, and mean square error is used to minimize the difference between the network output and CSI of Bob. The network’s input and output are a pair of reciprocal features for these benchmark models. The mean square error (MSE) between the reciprocal featuresZa, Zb is utilized to compare the performance of the neural networks, which is described as(10)MSE=1m∑i=1mZai−Zbi2.The MSE indicates the ability of the model to learn the channel reciprocity. Figure6 shows the MSE comparison results in all testing scenarios. We observe that our model performs better than all other benchmark models in these scenarios, while the performance of AE is worse than that of CRLNet, which means that the NRLM we designed really learned to eliminate the nonreciprocal part from channel response.Figure 6
The comparison results of CRLNet and benchmark models in terms of MSE in different testing cases. It can be observed that CRLNet outperforms other neural networks.To prove the efficiency of the proposed hybrid loss function, we compare the performance of trained model withL1 and without L1 loss function. The existence of reconstruction loss L2 and L3 loss functions is necessary, because it is used to ensure that the model has really learned the main features of the channel response. As shown in Figure 7, the CRLNet with the L1 loss function performs excellently, while the model without the L1 loss function fails to achieve an acceptable MSE. The comparison results verify the irreplaceable role of L1 for learning channel reciprocity.Figure 7
The MSE of CRLNet trained withL1 and without L1 loss function in different testing cases. This highlights how important L1 loss is for CRLNet.The task of NRLM is to separate the nonreciprocal part from the input channel response. To study the influence of different network design ofNRLM on the resulting reciprocal feature extraction performance, the following experiment was conducted. As shown in Figure 8, we compared original CRLNet and three modified CRLNet equipped with distinct NRLM modules in terms of MSE. The NRLM1 is the NRLM we proposed above, the NRLM2 adds an extra hidden layer on the original NRLM, the NRLM3 increases the number of neurons in each hidden layer of original NRLM, and the NRLM4 is composed of three 1D convolutional layers. The specific parameters of these modules are given in Table 1. We can see that increasing the hidden layer’s depth or width does not bring a meaningful improvement. Using a 1D convolutional layer to replace the fully connected layer can get lower MSE, but it will significantly increase overhead in training phase. Therefore, the original NRLM has a good tradeoff between performance and computational cost.Figure 8
Compare CRLNet performance with the original and modified NRLM in terms of MSE.Table 1
Parameters of original and modified NRLM.
NameHidden layers parametersNRLM1(512, 256, 256)NRLM2(512, 256, 256, 128)NRLM3(1024, 512, 512)NRLM4conv1×3,relu,conv1×3,relu,conv1×3


## 4.2. Performance of Key Generation

We employ different models in the reciprocity feature extraction step to compare the performance of the key generation; the other steps remain the same. We use the following metrics to verify the effectiveness of the initial generated key:(1)
Key Error Rate (KER) is defined as the number of conflict bits in the initial keys generated by two devices divided by the total number of the generated bits.(2)
Key Generation Rate (KGR) is defined as the number of bits generated by each probing packet.(3)
Randomness: the standard NIST test suite [39] is used to measure the randomness of the initial key.We first compare average KER of initial key of the four deep learning models under testing dataset in different environments. As shown in Figure9, CRLNet outperforms other benchmark models in terms of KER. When the KER of other models is too high to be used for matched key establishment in practice, a suitably low KER is achieved in all test cases.Figure 9
The KER of comparison model in all testing cases with the quantization factorε is set to 0.01. The CRLNet achieve much lower KER than other models.Our model and the benchmark model produce reciprocity feature with different sizes; therefore the KGR cannot be directly compared. For a fair comparison, we first use the PCA method to reduce the output features of the three comparison models to the same dimension as the CRLNet and then quantize the features to the initial keys. Figure10 indicates that CRLNet has the highest KGR under all experimental scenarios.Figure 10
The KGR of comparison model in all testing cases with the quantization factorε is set to 0.01. The CRLNet achieve the highest KGR.In Figures11 and 12, we compare KER and KGR with different quantization factors ε of 0.01, 0.05, 0.1, and 0.15 in all scenarios. The result demonstrates that as the quantization factor increases, both the KER and KGR decrease, implying a performance tradeoff. To acquire the best performance in the real world, we can adjust the quantization factor based on the signal-to-noise ratio (SNR) of the environment.Figure 11
The KGR of CRLNet using different quantization factor in all testing cases.Figure 12
The KER of CRLNet using different quantization factor in all testing cases.To verify the sufficient randomness of the generated keys, we perform NIST statistical tests on testing datasets. Table2 shows the test results in four environments with the quantization factor of 0.01. All the cases pass the test and have the p-value much larger than 0.01, which is the threshold to pass the test.Table 2
NIST statistical test suite results in different scenarios with the quantization factor of 0.01.
ScenarioIndoor staticIndoor mobileOutdoor staticOutdoor mobileApproximate entropy0.7980.8150.8610.854Cumulative sums0.4970.8620.7470.903DFT0.4660.5240.6100.583Frequency0.4510.7790.6050.822Ranking0.3750.4160.3790.471Runs0.8370.6050.4810.524Serial0.3160.5230.8770.9010.4520.5060.7080.924


## 4.3. Impact of the SNR

In order to prove the generalization performance of the proposed key generation method in complex scenarios, we added artificial Gaussian white noise, which caused the SNR to change from 0 dB to 20 dB. We compared our method with three benchmark methods [28, 31, 32], in terms of KER versus signal-to-noise ratio. As shown in Figure 13, the CRLNet based key generation scheme outperforms the counterparts in respect of KER. This demonstrates that the benefit of our method is that it is independent of the channel’s statistical properties and can generate a consistent key based on the training dataset in an adaptable and effective manner.Figure 13
The KER of the four methods versus SNR of dataset.


## 4.4. Computational Complexity

The difference in computational complexity between our method and existing physical layer key generation methods is in the reciprocity feature extraction stage. In our method, there is no information sharing across legitimate nodes during the key generation process. In addition, our feature extraction only requires a single encoder of the CRLNet, which retains a low overhead.In Figure14, we compared the average execution time of the feature extraction stage for single packet between the proposed method and the above benchmark methods. The hardware environments we use are as follows: AMD Ryzen 5600X CPU, 16 GB RAM, Windows 10 Home 64-bit operating system. For all comparison methods, we use it to process 20,000 packets and calculate the average execution time for each packet. This process is repeated 20 times, and the average value is taken as the final result. As can be seen, our proposed method has the shortest execution time because it only relies on the lightweight encoder network module to extract reciprocal features.Figure 14
The execution time of channel feature extraction.


## 5. Conclusions

In this paper, we propose a physical layer key generation scheme that can generate consistent keys from imperfect wireless channels, by designing deep neural networks to extract channel reciprocity features. The developed CRLNet can efficiently learn the reciprocity component of channel state information (CSI) in TDD OFDM systems. Based on the CRLNet, we design a complete key generation scheme that performs excellently on commercial WiFi devices. Extensive experiments are conducted under static and mobile environments in both indoor and outdoor scenarios. The results confirm that CRLNet can extract reciprocal channel features more efficiently than the benchmark neural networks in terms of MSE. Furthermore, the CRLNet-based key generation scheme achieves higher KGR, lower KER, and sufficient randomness compared to the existing methods in all testing scenarios.



---

*Source: 1844345-2022-03-19.xml*