Lateral channel attack method based on graph convolutional neural network
By converting energy traces into graph data structures and reducing dimensionality, combined with the graph convolutional neural network model with multi-receptive fields, the problem of low signal-to-noise ratio of high-dimensional energy traces is solved, and the efficiency and accuracy of side channel attacks are improved.
Patent Information
- Application Number
- CN202510034168.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2025-04-11
AI Technical Summary
In side channel attack scenarios, the original energy trace is usually a high-dimensional signal, with low signal-to-noise ratio and sparse time distribution of key features, resulting in an increase in model calculation complexity, affecting training efficiency and attack accuracy.
By converting the energy traces into graph data structures, a uniform flow approximation and projection method is used to reduce the data dimensions, and a multi-receptive field graph convolution neural network model is designed for training, and node features are extracted to improve the model's feature extraction ability.
It effectively reduces the computational complexity, improves the model's feature extraction capability and the efficiency and accuracy of side channel attacks.
Smart Images

Figure CN119814277A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security, and in particular to a side channel attack method based on a graph convolutional neural network. Background Art
[0002] Side channel attack is an analysis method different from traditional cryptographic algorithm analysis. In addition to input and output, it can obtain some additional information such as power consumption or electromagnetic radiation leakage, and use the dependency between the leaked information and some intermediate values of the algorithm to crack the key. With the rapid development of deep learning, its application in side channel attacks has received widespread attention in recent years. In order to improve the performance of attacks, researchers have proposed a variety of innovative methods. For example, converting energy traces into two-dimensional images and applying two-dimensional convolutional neural networks, and using long short-term memory networks (LSTM) to capture correlations in time series, thereby enhancing the attack effect. In addition, the graph convolutional neural network combined with the time series modeling framework can effectively capture the spatial and temporal dynamics of data and show excellent performance, so it has also received widespread attention from researchers.
[0003] Although deep learning has powerful feature learning capabilities, in actual attack scenarios, since the original energy trace is usually a high-dimensional signal with a low signal-to-noise ratio and sparse temporal distribution of key features, if it is directly used to train the model, it will significantly increase the computational complexity of the model, thereby affecting the model training efficiency and the accuracy of the attack. Data preprocessing, data dimensionality reduction, and feature extraction before model training can effectively improve the efficiency of model training and the accuracy of the attack.
[0004] In order to better extract features and perform dimensionality reduction, the present invention proposes a side channel attack method based on a graph convolutional neural network. The method converts energy traces into a graph data structure, adopts a uniform flow approximation and projection method to reduce the data dimension, and inputs the reduced graph data structure into the designed graph convolutional neural network for training, thereby improving the feature extraction ability of the model and thus improving the efficiency and accuracy of side channel attacks. Summary of the invention
[0005] The present invention proposes a side channel attack method based on a graph convolutional neural network. The method first collects energy traces generated during the operation of a target cryptographic algorithm on a cryptographic device, and divides the energy traces into a training set and a test set; the energy traces are regarded as graph nodes, and the similarity between graph nodes is calculated using a non-Euclidean distance, and a weighted K-adjacent graph of the graph nodes is constructed using an approximate nearest neighbor search algorithm; the dimension reduction and feature extraction of the graph nodes are completed using a uniform flow approximation and projection method to form low-dimensional features of the graph nodes; a graph convolutional layer with multiple receptive fields is designed to construct a graph neural network model, and the graph node data and labels of the training set after dimension reduction are used for model training, and finally the graph node data in the test set after dimension reduction is analyzed using the trained optimal model of the graph convolutional neural network to achieve key recovery of the target cryptographic algorithm and complete the side channel attack.
[0006] The technical solution for achieving the purpose of the present invention is:
[0007] A side channel attack method based on graph convolutional neural network includes the following steps:
[0008] (1) Collect power consumption information of the target cryptographic algorithm;
[0009] Use power consumption acquisition equipment to collect power consumption information leaked when the target cryptographic algorithm in the cryptographic chip is running, obtain energy trace sets, and divide them into corresponding training sets and test sets;
[0010] (2) Use an approximate nearest neighbor search algorithm to convert the energy trace into a graph data structure;
[0011] The energy trace is regarded as a graph node, and the sample points of the energy trace are used as graph node features. The similarity between graph nodes is calculated using non-Euclidean distance, and the weighted K-neighbor graph is constructed using the approximate nearest neighbor search algorithm.
[0012] (3) Use uniform flow pattern approximation and projection method to reduce the dimension of node features;
[0013] Initialize the graph node information in the low-dimensional space, use binary cross entropy as the loss function for optimization, so that the distribution of graph nodes in the low-dimensional space retains the local and global structure of the graph nodes in the high-dimensional space as much as possible, and obtain the low-dimensional features of the graph nodes;
[0014] (4) Build a graph convolutional neural network model;
[0015] Based on the neural network structure model and low-dimensional graph node data structure, a multi-receptive field graph convolutional neural network model is designed to extract node features;
[0016] (5) Training graph convolutional neural network model;
[0017] Based on the graph node data and labels of the training set, the optimal model of the trained graph convolutional neural network is obtained through iterative training;
[0018] (6) Implement side channel attacks based on the trained graph convolutional neural network model;
[0019] Based on the trained graph convolutional neural network model, a side channel attack is carried out on the test set to complete key recovery.
[0020] In the side channel attack method based on graph convolutional neural network of the present invention, step (1) is to collect power consumption information of the target cryptographic algorithm, and the specific steps are as follows:
[0021] (1.1) Complete the code implementation of the target cryptographic algorithm and burn it into the target cryptographic device to be tested, and connect the power consumption collection device to the computer and the cryptographic device respectively;
[0022] (1.2) Assume that there are n random plaintext data, then the plaintext data set P = (p1, p2, ..., p i ,...,p n ), where p i represents the i-th plaintext data, 1≤i≤n; the target cryptographic algorithm has m key bytes, then set the fixed key key=(k1,k2,...,k j ,...,k m ), where k j represents the jth key byte, 1≤j≤m; each plaintext data is encrypted using the key, and the power consumption leakage generated during encryption is collected using the power consumption collection device, that is, an energy trace is formed. For n plaintext data, a total of n energy traces T=(t1,t2,...,t i ,...,t n ), where t i represents the i-th energy trace, 1≤i≤n, and each energy trace contains d sampling points, then the i-th energy trace t i It can be expressed as t i =(t i,1 ,t i,2 ,...,t i,j ,...,t i,d ), 1≤i≤n, 1≤j≤d;
[0023] (1.3) The collected energy traces T are divided into a training set and a test set.
[0024] In the side channel attack method based on graph convolutional neural network of the present invention, step (2) is to convert the energy trace into a graph data structure using the nearest neighbor search algorithm, and the specific steps are as follows:
[0025] (2.1) Treat each energy trace as a graph node and the energy trace set T as the graph node set X = (x1, x2, ..., x i ,...,x n ), x i =t i , and regard each sample point in each energy trace as the feature of the graph node; calculate the non-Euclidean distance between any two graph nodes in X and sort them in ascending order, with d(x i ,x j ) represents the graph node x i With x j The non-Euclidean distance, 1≤i≤n, 1≤j≤n, is calculated using KL divergence as follows:
[0026]
[0027] (2.2) Set the hyperparameter K, and x i The K points with the smallest non-Euclidean distance become x i The neighboring points of x i The neighboring point set {x1,x2,...,x j ...,x K}, 1≤j≤K; use exponential distribution probability to calculate the graph node x i The similarity with each point in the neighboring point set is expressed as p ij Represents x i and x j The similarity, 1≤i≤n, is calculated as follows:
[0028]
[0029] where ρ i Represents graph node x i The distance between the nearest neighbor, 1≤i≤n, is calculated as follows:
[0030] ρ i =min{d(x i ,x j )|1≤j≤K,d(x i ,x j )>0}
[0031] σ i is a normalization factor used to balance the similarity of each graph node with its neighbors, and is calculated as follows:
[0032]
[0033] (2.3) Using the above method, calculate the neighboring point set of all graph nodes in the graph node set X, as well as the similarity between all graph nodes and all their neighboring points;
[0034] (2.4) Use the set of graph nodes X as the vertex set V, and use the set of ordered pairs where each graph node points to each point in its neighboring point set: {(x i , x1), (x i , x2),..., (x i , x K ), 1 ≤ i ≤ n, as the edge set E, and use the similarity p between each graph node and its neighboring points as the weight set P to obtain a weighted directed graph Let A be the weighted adjacency matrix of G, and calculate the symmetric matrix of A Based on B, obtain the weighted K - adjacent graph G, complete the construction of the weighted K - adjacent graph, that is, form the graph data structure.
[0035] In the side - channel attack method based on graph convolutional neural network of the present invention, step (3) is to use the uniform manifold approximation and projection method to reduce the dimension of the energy trace, and the specific steps are as follows:
[0036] (3.1) To make the algorithm have a faster convergence speed and better stability, use the Laplacian eigenvectors for the initialization operation of the low - dimensional data. The Laplacian matrix L is defined as follows:
[0037] L = D 1 / 2 × (D - B) × D 1 / 2
[0038] where D is the degree matrix of the symmetric matrix B; set the hyperparameter r (r < d) as the target dimension of dimensionality reduction. By performing eigenvalue decomposition on the Laplacian matrix L, take the eigenvectors corresponding to the r eigenvalues with smaller values as the initialized low - dimensional data X'=(x'1, x'2,..., x' i ,..., x' n ), 1 ≤ i ≤ n, x' i =(x' i,1 , x' i,2 ,..., x' i,j ,..., x' i,r ), 1 ≤ j ≤ r, to complete the initialization operation of the low - dimensional data;
[0039] (3.2) Set the hyperparameter min_dist, use the nonlinear least - squares method to fit a piecewise function and calculate the values of parameters a and b based on the low - dimensional data, and then calculate the similarity between different nodes in the low - dimensional data. Let q ij represent the similarity between the graph nodes x' i and x' j , and the calculation method is as follows:
[0040]
[0041] Among them, 1≤i≤n, 1≤j≤K;
[0042] (3.3) In low-dimensional space, binary cross entropy C(P,Q) is used as the loss function to implement stochastic gradient descent. By optimizing the similarity distribution between nodes in high-dimensional space and low-dimensional space, the distribution of data points in low-dimensional space retains the local and global structure in high-dimensional space as much as possible. Here, P is the weight set of high-dimensional graph data, that is, the similarity p between each graph node and its neighboring points ij is a set of similarities of low-dimensional data, and C(P,Q) is calculated as follows:
[0043]
[0044] (3.4) Use the derivative of the cross entropy to update the coordinates of the low-dimensional data, optimize the projection space until convergence, complete the dimensionality reduction of the graph node features, and obtain the reduced low-dimensional data X' and the similarity set Q. Use the low-dimensional data X' and the similarity set Q to update the node features and the weight set in the weighted K-adjacency graph G.
[0045] In the side channel attack method based on graph convolutional neural network of the present invention, step (4) is to build a graph convolutional neural network model, and the specific steps are as follows:
[0046] In order to better extract features, a graph convolutional neural network model is designed, which mainly includes input layer, feature extraction layer, and output layer. The specific structure is as follows:
[0047] (4.1) The input layer accepts low-dimensional graph data as initial input, including graph node features, edge sets, weight information and labels, which are used to describe the low-dimensional graph structure and feature information of graph nodes; the label L is calculated using the identity leakage model. Where Sbox(·) represents the plaintext p i The j-th byte in is XORed with the j-th byte of the key and then outputted by the corresponding Sbox;
[0048] (4.2) The feature extraction layer aggregates and propagates the features of nodes in the graph structure data. Unlike traditional convolutional neural networks, graph convolution processes graph data and uses the topological structure information of the graph for learning, including the structure of the graph, the connection relationship between graph nodes, and the features of the nodes to generate node representations with higher-level semantics. This layer includes a multi-receptive field graph convolution layer, an activation layer with ReLU activation function, a batch processing layer, and a TOPK pooling layer.
[0049] (4.2.1) The multi-receptive field graph convolution layer contains three parallel graph convolution layers (GCN), each with a different receptive field, which can aggregate the information of different numbers of neighbors; by aggregating and fusing the information of different receptive fields, a more powerful and robust feature representation can be obtained. The calculation method is as follows:
[0050] H=[GCN(O1)(E,X',W1),GCN(O2)(E,X',W2),GCN(O3)(E,X',W3)]
[0051] Among them, O1, O2, and O3 are hyperparameters with values less than K, indicating the size of the receptive field of the graph convolution layer and the range of the aggregation neighborhood; X' and E are the input node set and edge set respectively, and W1, W2, and W3 are weight matrices under specific receptive field settings;
[0052] (4.2.2) The activation layer uses the ReLU activation function to introduce nonlinear factors into the convolution layer, so that the model can learn and represent more complex functional relationships, better learn the characteristics of the input data, and make the local features extracted by the convolution layer further strengthened or suppressed by the activation layer;
[0053] (4.2.3) The batch layer reduces the sensitivity to the weight initialization strategy, helps to keep the distribution of each layer input relatively stable, and makes the model training more robust;
[0054] (4.2.4) The TOPK pooling layer selects the most important nodes based on node features to reduce the amount of computation;
[0055] (4.3) The output layer further maps the features obtained after convolution and pooling and outputs the final result. This layer includes an activation layer of the Softmax activation function, a dropout layer, and a fully connected layer. The dropout layer uses regularization technology to prevent overfitting of the neural network. The fully connected layer maps the features extracted by the convolution layer to the category space. The activation layer of the Softmax activation function is used to convert the output of the model into a probability distribution, so that the output value can be interpreted as the predicted probability of each category.
[0056] In the side channel attack method based on graph convolutional neural network of the present invention, step (5) is to train the graph convolutional neural network model, and the specific steps are as follows:
[0057] (5.1) For the training set energy trace, convert it into a graph data structure according to step (2), and perform dimensionality reduction according to step (3). The low-dimensional training set data after dimensionality reduction includes graph node features, edge sets and weight information, and the label set of the data is calculated using the identity leakage model. All data is converted into scalars that are suitable for pytorch input, and a training data loader is created using DataLoader to load data in batches during the training process;
[0058] (5.2) Use the graph convolutional neural network model to predict the training set data and obtain the output of the model; the output of the graph convolutional neural network model is a probability distribution, which represents the predicted probability of each possible category;
[0059] (5.3) Using the training set labels and the prediction results of the graph convolutional neural network model, calculate the cross entropy loss between them. The cross entropy loss calculation method is as follows:
[0060]
[0061] Among them, u i represents the i-th element of the true label, v i Represents the i-th element of the predicted probability output by the graph convolutional neural network model, and C is the total number of categories;
[0062] (5.4) Add the losses of all samples and then find the average to get the average cross entropy loss of the batch;
[0063] (5.5) According to the size of the loss value, update the model parameters and perform back propagation to minimize the cross entropy loss to obtain a trained model.
[0064] In the side channel attack method based on graph convolutional neural network of the present invention, step (6) is to implement the side channel attack based on the trained graph convolutional neural network model, and the specific steps are as follows:
[0065] (6.1) For the test set energy trace, convert it into a graph data structure according to step (2), and perform dimensionality reduction according to step (3). The low-dimensional test set data after dimensionality reduction includes graph node features, edge sets, and weight information. All data is converted into scalars that are suitable for pytorch input. Use DataLoader to create a test data loader and load data in batches during the test process.
[0066] (6.2) Use the graph convolutional neural network model trained in step (5) to predict the test data and obtain the output of the model;
[0067] (6.3) Rank is used as the evaluation index to evaluate the model. The calculation method of rank is as follows:
[0068] rank(realkey)={i|sort(y k )[i]==y k [realkey]}
[0069] Where realkey represents the real key; sort(·) represents the descending sorting function, which is used to sort all the probabilities in the tensor in descending order; yk is the posterior probability distribution of the candidate key, which is a tensor representation containing C+1 elements, where each element corresponds to the probability of each key in the guessed key set {0,1,...,C}; the posterior probability distribution of the candidate key is calculated by maximum likelihood estimation of the output of the model, the probability value corresponding to realkey is recorded, and then the distribution is sorted in descending order using the descending sorting function to find the index of the probability value corresponding to realkey in the sorting result. The index i is the rank of the correct key; when the rank output by the model is 0, the attack is considered successful.
[0070] The beneficial effects of the present invention are:
[0071] (1) The method of the present invention is based on a deep learning attack method of a graph convolutional neural network. By converting energy trace data into a graph data structure, a graph convolutional neural network model is designed and trained to perform side channel attacks. The model can enhance the expression ability of features by using the topological relationship between nodes. In the convolution layer, multiple graph convolutional layers with different receptive fields are used in parallel to fuse the learned features into enhanced feature representations, thereby improving the learning ability and classification ability of the model.
[0072] (2) The present invention performs nonlinear dimensionality reduction on the collected high-dimensional graph data structure through uniform flow approximation and projection, retains the local structure and global structure of the data, and maximizes the use of key information in the graph data structure to obtain useful information; compared with the convolutional neural network that needs to extract features from the original data every time it is trained, the uniform flow approximation and projection preprocessing only needs to be performed once, which greatly reduces the complexity of the calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 This is a flow chart of a side channel attack method based on a graph convolutional neural network in the present invention.
[0074] Specific implementation examples
[0075] The present invention will be further described in detail below in conjunction with the embodiments and drawings, but the present invention is not limited thereto. Example
[0076] A side channel attack method based on graph convolutional neural network, refer to Figure 1 , including the following steps:
[0077] (1) Collect power consumption information of the target cryptographic algorithm;
[0078] (2) Use the nearest neighbor search algorithm to convert the energy trace into a graph data structure;
[0079] (3) Use uniform flow pattern approximation and projection method to reduce the dimension of node features;
[0080] (4) Build a graph convolutional neural network model;
[0081] (5) Training graph convolutional neural network model;
[0082] (6) Implement side channel attacks based on the trained graph convolutional neural network model.
[0083] In the side channel attack method based on graph convolutional neural network of the present invention, step (1) is to collect power consumption information of the target cryptographic algorithm, and the specific steps are as follows:
[0084] (1.1) Complete the code implementation of the target cryptographic algorithm and burn it into the target cryptographic device to be tested, and connect the power consumption collection device to the computer and the cryptographic device respectively;
[0085] (1.2) Assume that there are n random plaintext data, then the plaintext data set P = (p1, p2, ..., p i ,...,p n ), where p i represents the i-th plaintext data, 1≤i≤n; the target cryptographic algorithm has m key bytes, then set the fixed key key=(k1,k2,...,k j ,...,k m ), where k j represents the jth key byte, 1≤j≤m; each plaintext data is encrypted using the key, and the power consumption leakage generated during encryption is collected using the power consumption collection device, that is, an energy trace is formed. For n plaintext data, a total of n energy traces T=(t1,t2,...,t i ,...,t n ), where t i represents the i-th energy trace, 1≤i≤n, and each energy trace contains d sampling points, then the i-th energy trace t i It can be expressed as t i =(t i,1 ,t i,2 ,...,t i,j ,...,t i,d ), 1≤i≤n, 1≤j≤d;
[0086] (1.3) The collected energy traces T are divided into a training set and a test set.
[0087] In the side channel attack method based on graph convolutional neural network of the present invention, step (2) is to convert the energy trace into a graph data structure using the nearest neighbor search algorithm, and the specific steps are as follows:
[0088] (2.1) Treat each energy trace as a graph node and the energy trace set T as the graph node set X = (x1, x2, ..., x i ,...,x n ), x i =t i , and regard each sample point in each energy trace as the feature of the graph node; calculate the non-Euclidean distance between any two graph nodes in X and sort them in ascending order, with d(x i ,x j ) represents the graph node x i With x j The non-Euclidean distance, 1≤i≤n, 1≤j≤n, is calculated using KL divergence as follows:
[0089]
[0090] (2.2) Set the hyperparameter K, and x i The K points with the smallest non-Euclidean distance become x i The neighboring points of x i The neighboring point set {x1,x2,...,x j ...,x K}, 1≤j≤K; use exponential distribution probability to calculate the graph node x i The similarity with each point in the neighboring point set is expressed as p ij Represents x i and x j The similarity, 1≤i≤n, is calculated as follows:
[0091]
[0092] where ρ i Represents graph node x i The distance between the nearest neighbor, 1≤i≤n, is calculated as follows:
[0093] ρ i =min{d(x i ,x j )|1≤j≤K,d(x i ,x j )>0}
[0094] σ i is a normalization factor used to balance the similarity of each graph node with its neighbors, and is calculated as follows:
[0095]
[0096] (2.3) Using the above method, calculate the neighboring point set of all graph nodes in the graph node set X, as well as the similarity between all graph nodes and all their neighboring points;
[0097] (2.4) Use the set of graph nodes X as the vertex set V, and use the set of ordered pairs where each graph node points to each point in its neighboring point set: {(x i , x1), (x i , x2),..., (x i , x K ), 1 ≤ i ≤ n, as the edge set E, and use the similarity p between each graph node and its neighboring points as the weight set P to obtain a weighted directed graph Let A be the weighted adjacency matrix of, and calculate the symmetric matrix of A Based on B, obtain the weighted K - adjacent graph G to complete the construction of the weighted K - adjacent graph, that is, form the graph data structure.
[0098] In the side - channel attack method based on graph convolutional neural network of the present invention, step (3) is to use the uniform manifold approximation and projection method to reduce the dimension of the energy trace. The specific steps are as follows:
[0099] (3.1) To make the algorithm have a faster convergence speed and better stability, use the Laplacian eigenvectors for the initialization operation of low - dimensional data. The Laplacian matrix L is defined as follows:
[0100] L = D 1 / 2 ×(D - B)×D 1 / 2
[0101] where D is the degree matrix of the symmetric matrix B; set the hyperparameter r (r < d) as the target dimension of dimensionality reduction. By performing eigenvalue decomposition on the Laplacian matrix L, take the eigenvectors corresponding to the r smallest eigenvalues as the initialized low - dimensional data X'=(x'1, x'2,…, x' i ,..., x' n ), 1 ≤ i ≤ n, x' i =(x' i,1 , x' i,2 ,..., x' i,j ,..., x' i,r ), 1 ≤ j ≤ r, to complete the initialization operation of low - dimensional data;
[0102] (3.2) Set the hyperparameter min_dist, use the non - linear least - squares method to fit a piece - wise function and calculate the values of parameters a and b based on the low - dimensional data, and then calculate the similarity between different nodes in the low - dimensional data. Let q ij represent the similarity between the graph nodes x' i and x' j . The calculation method is as follows:
[0103]
[0104] Among them, 1≤i≤n, 1≤j≤K;
[0105] (3.3) In low-dimensional space, binary cross entropy C(P,Q) is used as the loss function to implement stochastic gradient descent. By optimizing the similarity distribution between nodes in high-dimensional space and low-dimensional space, the distribution of data points in low-dimensional space retains the local and global structure in high-dimensional space as much as possible. Here, P is the weight set of high-dimensional graph data, that is, the similarity p between each graph node and its neighboring points ij is a set of similarities of low-dimensional data, and C(P,Q) is calculated as follows:
[0106]
[0107] (3.4) Use the derivative of the cross entropy to update the coordinates of the low-dimensional data, optimize the projection space until convergence, complete the dimensionality reduction of the graph node features, and obtain the reduced low-dimensional data X' and the similarity set Q. Use the low-dimensional data X' and the similarity set Q to update the node features and the weight set in the weighted K-adjacency graph G.
[0108] In the side channel attack method based on graph convolutional neural network of the present invention, step (4) is to build a graph convolutional neural network model, and the specific steps are as follows:
[0109] In order to better extract features, a graph convolutional neural network model is designed, which mainly includes input layer, feature extraction layer, and output layer. The specific structure is as follows:
[0110] (4.1) The input layer accepts low-dimensional graph data as initial input, including graph node features, edge sets, weight information and labels, which are used to describe the low-dimensional graph structure and feature information of graph nodes; the label L is calculated using the identity leakage model. Where Sbox(·) represents the plaintext p i The j-th byte in is XORed with the j-th byte of the key and then outputted by the corresponding Sbox;
[0111] (4.2) The feature extraction layer aggregates and propagates the features of nodes in the graph structure data. Unlike traditional convolutional neural networks, graph convolution processes graph data and uses the topological structure information of the graph for learning, including the structure of the graph, the connection relationship between graph nodes, and the features of the nodes to generate node representations with higher-level semantics. This layer includes a multi-receptive field graph convolution layer, an activation layer with ReLU activation function, a batch processing layer, and a TOPK pooling layer.
[0112] (4.2.1) The multi-receptive field graph convolution layer contains three parallel graph convolution layers (GCN), each with a different receptive field, which can aggregate the information of different numbers of neighbors; by aggregating and fusing the information of different receptive fields, a more powerful and robust feature representation can be obtained. The calculation method is as follows:
[0113] H=[GCN(O1)(E,X',W1),GCN(O2)(E,X',W2),GCN(O3)(E,X',W3)]
[0114] Among them, O1, O2, and O3 are hyperparameters with values less than K, indicating the size of the receptive field of the graph convolution layer and the range of the aggregation neighborhood; X' and E are the input node set and edge set respectively, and W1, W2, and W3 are weight matrices under specific receptive field settings;
[0115] (4.2.2) The activation layer uses the ReLU activation function to introduce nonlinear factors into the convolution layer, so that the model can learn and represent more complex functional relationships, better learn the characteristics of the input data, and make the local features extracted by the convolution layer further strengthened or suppressed by the activation layer;
[0116] (4.2.3) The batch layer reduces the sensitivity to the weight initialization strategy, helps to keep the distribution of each layer input relatively stable, and makes the model training more robust;
[0117] (4.2.4) The TOPK pooling layer selects the most important nodes based on node features to reduce the amount of computation;
[0118] (4.3) The output layer further maps the features obtained after convolution and pooling and outputs the final result. This layer includes an activation layer of the Softmax activation function, a dropout layer, and a fully connected layer. The dropout layer uses regularization technology to prevent overfitting of the neural network. The fully connected layer maps the features extracted by the convolution layer to the category space. The activation layer of the Softmax activation function is used to convert the output of the model into a probability distribution, so that the output value can be interpreted as the predicted probability of each category.
[0119] In the side channel attack method based on graph convolutional neural network of the present invention, step (5) is to train the graph convolutional neural network model, and the specific steps are as follows:
[0120] (5.1) For the training set energy trace, convert it into a graph data structure according to step (2), and perform dimensionality reduction according to step (3). The low-dimensional training set data after dimensionality reduction includes graph node features, edge sets and weight information, and the label set of the data is calculated using the identity leakage model. All data is converted into scalars that are suitable for pytorch input, and a training data loader is created using DataLoader to load data in batches during the training process;
[0121] (5.2) Use the graph convolutional neural network model to predict the training set data and obtain the output of the model; the output of the graph convolutional neural network model is a probability distribution, which represents the predicted probability of each possible category;
[0122] (5.3) Using the training set labels and the prediction results of the graph convolutional neural network model, calculate the cross entropy loss between them. The cross entropy loss calculation method is as follows:
[0123]
[0124] Among them, u i represents the i-th element of the true label, v i Represents the i-th element of the predicted probability output by the graph convolutional neural network model, C is the total number of categories, C = 255;
[0125] (5.4) Add the losses of all samples and then find the average to get the average cross entropy loss of the batch;
[0126] (5.5) According to the size of the loss value, update the model parameters and perform back propagation to minimize the cross entropy loss to obtain a trained model.
[0127] In the side channel attack method based on graph convolutional neural network of the present invention, step (6) is to implement the side channel attack based on the trained graph convolutional neural network model, and the specific steps are as follows:
[0128] (6.1) For the test set energy trace, convert it into a graph data structure according to step (2), and perform dimensionality reduction according to step (3). The low-dimensional test set data after dimensionality reduction includes graph node features, edge sets, and weight information. All data is converted into scalars that are suitable for pytorch input. Use DataLoader to create a test data loader and load data in batches during the test process.
[0129] (6.2) Use the graph convolutional neural network model trained in step (5) to predict the test data and obtain the output of the model;
[0130] (6.3) Rank is used as the evaluation index to evaluate the model. The calculation method of rank is as follows:
[0131] rank(realkey)={i|sort(y k )[i]==y k [realkey]}
[0132] Where realkey represents the real key; sort(·) represents the descending sorting function, which is used to sort all the probabilities in the tensor in descending order; y k is the posterior probability distribution of the candidate key, which is a tensor representation containing C+1 elements, where each element corresponds to the probability of each key in the guessed key set {0,1,...,C}; the posterior probability distribution of the candidate key is calculated by maximum likelihood estimation of the output of the model, the probability value corresponding to realkey is recorded, and then the distribution is sorted in descending order using the descending sorting function to find the index of the probability value corresponding to realkey in the sorting result. The index i is the rank of the correct key; when the rank output by the model is 0, the attack is considered successful.
Claims
1. A side channel attack method based on graph convolutional neural network, characterized in that: The following steps are involved: (1) Collect power consumption information of the target cryptographic algorithm; Use power consumption acquisition equipment to collect power consumption information leaked when the target cryptographic algorithm in the cryptographic chip is running, obtain energy trace sets, and divide them into corresponding training sets and test sets; (2) Use an approximate nearest neighbor search algorithm to convert the energy trace into a graph data structure; The energy trace is regarded as a graph node, and the sample points of the energy trace are used as graph node features. The similarity between graph nodes is calculated using non-Euclidean distance, and the weighted K-neighbor graph is constructed using the approximate nearest neighbor search algorithm. (3) Use uniform flow pattern approximation and projection method to reduce the dimension of node features; Initialize the graph node information in the low-dimensional space, use binary cross entropy as the loss function for optimization, so that the distribution of graph nodes in the low-dimensional space retains the local and global structure of the graph nodes in the high-dimensional space as much as possible, and obtain the low-dimensional features of the graph nodes; (4) Build a graph convolutional neural network model; Based on the neural network structure model and low-dimensional graph node data structure, a multi-receptive field graph convolutional neural network model is designed to extract node features; (5) Training graph convolutional neural network model; Based on the graph node data and labels of the training set, the optimal model of the trained graph convolutional neural network is obtained through iterative training; (6) Implement side channel attacks based on the trained graph convolutional neural network model; Based on the trained graph convolutional neural network model, a side channel attack is carried out on the test set to complete key recovery.
2. According to claim 1, a side channel attack method based on graph convolutional neural network is characterized in that: The specific steps of collecting the power consumption information of the target cryptographic algorithm in step (1) are as follows: (1.1) Complete the code implementation of the target cryptographic algorithm and burn it into the target cryptographic device to be tested, and connect the power consumption collection device to the computer and the cryptographic device respectively; (1.2) Assume that there are n random plaintext data, then the plaintext data set P = (p1, p2, ..., p i ,...,p n ), where p i represents the i-th plaintext data, 1≤i≤n; the target cryptographic algorithm has m key bytes, then set the fixed key key=(k1,k2,...,k j ,...,k m ), where k j represents the jth key byte, 1≤j≤m; each plaintext data is encrypted using the key, and the power consumption leakage generated during encryption is collected using the power consumption collection device, that is, an energy trace is formed. For n plaintext data, a total of n energy traces T=(t1,t2,...,t i ,...,t n ), where t i represents the i-th energy trace, 1≤i≤n, and each energy trace contains d sampling points, then the i-th energy trace t i It can be expressed as t i =(t i,1 ,t i,2 ,...,t i,j ,...,t i,d ), 1≤i≤n, 1≤j≤d; (1.3) The collected energy traces T are divided into a training set and a test set.
3. According to claim 1, a side channel attack method based on graph convolutional neural network is characterized in that: The energy trace is converted into a graph data structure using an approximate nearest neighbor search algorithm as described in step (2). The specific method is as follows: (2.1) Treat each energy trace as a graph node and the energy trace set T as the graph node set X = (x1, x2, ..., x i ,...,x n ), x i =t i , and each sample point in each energy trace is regarded as the feature of the graph node; Calculate the non-Euclidean distance between any two graph nodes in X and sort them in ascending order, with d(x i ,x j ) represents the graph node x i With x j The non-Euclidean distance, 1≤i≤n, 1≤j≤n, is calculated using KL divergence as follows: (2.2) Set the hyperparameter K, and x i The K points with the smallest non-Euclidean distance become x i The neighboring points of x i The neighboring point set {x1,x2,...,x j ...,x K }, 1≤j≤K; use exponential distribution probability to calculate the graph node x i The similarity with each point in the neighboring point set is expressed as p ij Represents x i and x j The similarity, 1≤i≤n, is calculated as follows: where ρ i Represents graph node x i The distance between the nearest neighbor, 1≤i≤n, is calculated as follows: ρ i =min{d(x i ,x j )|1≤j≤K,d(x i ,x j )>0} σ i is a normalization factor used to balance the similarity of each graph node with its neighbors, and is calculated as follows: (2.3) Using the above method, calculate the neighboring point set of all graph nodes in the graph node set X, as well as the similarity between all graph nodes and all their neighboring points; (2.4) Let the graph node set X be the vertex set V, and let each graph node point to the ordered pair set of each point in its neighboring point set: {(x i ,x1),(x i ,x2),...,(x i ,x K )}, 1≤i≤n, as the edge set E, the similarity p of each graph node and its neighboring points is used as the weight set P, and a weighted directed graph is obtained. Let A be The weighted adjacency matrix of A is calculated. Based on B, the weighted K-adjacency graph G is obtained, and the construction of the weighted K-adjacency graph is completed, that is, a graph data structure is formed.
4. According to claim 1, a side channel attack method based on graph convolutional neural network is characterized in that: The uniform flow pattern approximation and projection method described in step (3) is used to reduce the dimension of the energy trace. The specific steps are as follows: (3.1) In order to make the algorithm have faster convergence speed and better stability, the Laplace eigenvector is used to initialize the low-dimensional data. The Laplace matrix L is defined as follows: L=D 12 ×(D-B)×D 12 where D is the degree matrix of the symmetric matrix B; set the hyperparameter r (r < d) as the target dimension of dimensionality reduction. By performing eigenvalue decomposition on the Laplacian matrix L, take the eigenvectors corresponding to the r smallest eigenvalues as the initialized low-dimensional data X'=(x'1,x'2,...,x' i ,...,x' n ), 1 ≤ i ≤ n, x' i =(x' i,1 ,x' i,2 ,...,x' i,j ,...,x' i,r ), 1 ≤ j ≤ r, to complete the initialization operation of the low-dimensional data; (3.2) Set the hyperparameter min_dist, use nonlinear least squares method to fit a piecewise function and calculate the values of parameters a and b based on low-dimensional data, and then calculate the similarity between different nodes in the low-dimensional data, q ij Represents a low-dimensional data graph node x' i With x' j The similarity between them is calculated as follows: Among them, 1≤i≤n, 1≤j≤K; (3.3) In low-dimensional space, binary cross entropy C(P,Q) is used as the loss function to implement stochastic gradient descent. By optimizing the similarity distribution between nodes in high-dimensional space and low-dimensional space, the distribution of data points in low-dimensional space retains the local and global structure in high-dimensional space as much as possible. Here, P is the weight set of high-dimensional graph data, that is, the similarity p between each graph node and its neighboring points ij A set of, Q is the similarity q of low-dimensional data ij The calculation method of C(P,Q) is as follows: (3.4) Use the derivative of the cross entropy to update the coordinates of the low-dimensional data, optimize the projection space until convergence, complete the dimensionality reduction of the graph node features, and obtain the reduced low-dimensional data X' and the similarity set Q. Use the low-dimensional data X' and the similarity set Q to update the node features and the weight set in the weighted K-adjacency graph G.
5. According to claim 1, a side channel attack method based on graph convolutional neural network is characterized in that: The specific steps of building a graph convolutional neural network model in step (4) are as follows: In order to better extract features, a graph convolutional neural network model is designed, which mainly includes input layer, feature extraction layer, and output layer. The specific structure is as follows: (4.1) The input layer accepts low-dimensional graph data as initial input, including graph node features, edge sets, weight information, and labels, which are used to describe the low-dimensional graph structure and feature information of graph nodes; The label L is calculated using the identity leakage model, Where Sbox(·) represents the plaintext p i The j-th byte in is XORed with the j-th byte of the key and then outputted by the corresponding Sbox; (4.2) The feature extraction layer aggregates and propagates the features of nodes in the graph structure data. Unlike traditional convolutional neural networks, graph convolution processes graph data and uses the topological structure information of the graph for learning, including the structure of the graph, the connection relationship between graph nodes, and the features of the nodes to generate node representations with higher-level semantics. This layer includes a multi-receptive field graph convolution layer, an activation layer with ReLU activation function, a batch processing layer, and a TOPK pooling layer. (4.2.1) The multi-receptive field graph convolution layer contains three parallel graph convolution layers (GCN), each with a different receptive field, which can aggregate the information of different numbers of neighbors; by aggregating and fusing the information of different receptive fields, a more powerful and robust feature representation can be obtained. The calculation method is as follows: H=[GCN(O1)(E,X',W1),GCN(O2)(E,X',W2),GCN(O3)(E,X',W3)] Among them, O1, O2, and O3 are hyperparameters with values less than K, indicating the size of the receptive field of the graph convolution layer and the range of the aggregation neighborhood; X' and E are the input node set and edge set respectively, and W1, W2, and W3 are weight matrices under specific receptive field settings; (4.2.2) The activation layer uses the ReLU activation function to introduce nonlinear factors into the convolution layer, so that the model can learn and represent more complex functional relationships, better learn the characteristics of the input data, and make the local features extracted by the convolution layer further strengthened or suppressed by the activation layer; (4.2.3) The batch layer reduces the sensitivity to the weight initialization strategy, helps to keep the distribution of each layer input relatively stable, and makes the model training more robust; (4.2.4) The TOPK pooling layer selects the most important nodes based on node features to reduce the amount of computation; (4.3) The output layer further maps the features obtained after convolution and pooling and outputs the final result. This layer includes an activation layer of the Softmax activation function, a dropout layer, and a fully connected layer. The dropout layer uses regularization technology to prevent overfitting of the neural network. The fully connected layer maps the features extracted by the convolution layer to the category space. The activation layer of the Softmax activation function is used to convert the output of the model into a probability distribution, so that the output value can be interpreted as the predicted probability of each category.
6. According to claim 1, a side channel attack method based on graph convolutional neural network is characterized in that: The specific steps of training the graph convolutional neural network model described in step (5) are as follows: (5.1) For the training set energy trace, convert it into a graph data structure according to step (2), and perform dimensionality reduction according to step (3). The low-dimensional training set data after dimensionality reduction includes graph node features, edge sets and weight information, and the label set of the data is calculated using the identity leakage model. All data is converted into scalars that are suitable for pytorch input, and a training data loader is created using DataLoader to load data in batches during the training process; (5.2) Use the graph convolutional neural network model to predict the training set data and obtain the output of the model; the output of the graph convolutional neural network model is a probability distribution, which represents the predicted probability of each possible category; (5.3) Using the training set labels and the prediction results of the graph convolutional neural network model, calculate the cross entropy loss between them. The cross entropy loss calculation method is as follows: Among them, u i represents the i-th element of the true label, v i Represents the i-th element of the predicted probability output by the graph convolutional neural network model, and C is the total number of categories; (5.4) Add the losses of all samples and then calculate the average to get the average cross entropy loss of the batch; (5.5) According to the size of the loss value, update the model parameters and perform back propagation to minimize the cross entropy loss to obtain a trained model.
7. The side channel attack method based on graph convolutional neural network according to claim 1 is characterized in that: The specific steps of implementing the side channel attack based on the trained graph convolutional neural network model in step (6) are as follows: (6.1) For the test set energy trace, convert it into a graph data structure according to step (2), and perform dimensionality reduction according to step (3). The low-dimensional test set data after dimensionality reduction includes graph node features, edge sets, and weight information. All data is converted into scalars that are suitable for pytorch input. Use DataLoader to create a test data loader and load data in batches during the test process. (6.2) Use the graph convolutional neural network model trained in step (5) to predict the test data and obtain the output of the model; (6.3) Rank is used as the evaluation index to evaluate the model. The calculation method of rank is as follows: rank(realkey)={i|sort(y k )[i]==y k [realkey]} Among them, realkey represents the real key; sort() represents the descending sorting function, which is used to sort all the probabilities in the tensor in descending order; y k is the posterior probability distribution of the candidate key, which is a tensor representation containing C+1 elements, where each element corresponds to the probability of each key in the guessed key set {0,1,...,C}; the posterior probability distribution of the candidate key is calculated by maximum likelihood estimation of the output of the model, the probability value corresponding to realkey is recorded, and then the distribution is sorted in descending order using the descending sorting function to find the index of the probability value corresponding to realkey in the sorting result. The index i is the rank of the correct key; when the rank output by the model is 0, the attack is considered successful.
Citation Information
Patent Citations
Convolutional neural network-based side channel attack method and system
CN114285545A
Hydroelectric generating set fault diagnosis method and system based on multi-sensory domain GCN
CN115238739A
Related power consumption analysis method based on uniform flow pattern approximation and projection
CN117768195A
Underwater unmanned underwater vehicle track fusion method and system based on graph convolutional neural network
CN118445753A