Deep learning side channel attack method and system based on self-attention mechanism
By directly modeling the original energy trace using a self-attention mechanism, a side-channel attack model is constructed, which solves the problems of time-consuming manual preprocessing and gradient in existing methods, and achieves faster model training and more efficient attack results.
Patent Information
- Application Number
- CN202111438540.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2041-11-30
AI Technical Summary
Existing deep learning side-channel attack methods require manual preprocessing, which is time-consuming and suffers from gradient vanishing and gradient exploding problems, affecting model training efficiency.
A self-attention mechanism is used to directly model the original energy trace. By using the multi-head self-attention mechanism and residual connections, a side-channel attack model is constructed, which avoids the drawbacks of convolutional and recurrent neural networks and improves the training speed of the model.
It enables faster model training, solves the problems of vanishing and exploding gradients, and improves the parallelization capability and attack efficiency of the model.
Smart Images

Figure CN116208311B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of side channel attacks of embedded devices, and particularly relates to a deep learning side channel attack method and system based on a self-attention mechanism. BACKGROUND
[0002] With the development of information technology, the importance of information security is increasing. Encryption algorithms are emerging. The traditional method of cracking encryption algorithms often cracks the key through brute force method. The core idea of side channel attack is to use the physical leakage information generated during the operation of the cryptographic chip to obtain the key information (such as execution time, power consumption, electromagnetic radiation, etc.). According to some information leaked during the implementation of the cryptographic algorithm, all possible values of a byte of the key can be guessed, but for all bytes of the key, they share the same leakage information, that is, all bytes of the key can be inferred according to the same leakage information. The attack complexity is reduced from exponential level to linear level.
[0003] Due to the outstanding performance of deep learning in computer vision, natural language processing and other fields, side channel researchers have shifted their attention to deep learning, trying to use deep learning to build attack models for modeling attacks. The current mainstream deep learning side channel attack method is based on artificial intervention preprocessing of original data to reduce the number of features, but such artificial intervention preprocessing will take a lot of time. SUMMARY
[0004] The purpose of the present application is to solve the problems of the prior art, and to provide a side channel attack method based on a self-attention mechanism for deep learning of original energy traces, which can directly model attacks on original energy traces.
[0005] The technical solution for achieving the purpose of the present application is: a deep learning side channel attack method based on a self-attention mechanism, the method comprising the following steps:
[0006] Step 1, running an encryption device, collecting plaintext, keys used for encrypting plaintext, and data information leaked during the first round of device operation, and constructing a data set;
[0007] Step 2, constructing a side channel attack model based on a self-attention mechanism for deep learning of original energy traces, training using the data set, and collecting training indicators;
[0008] Step 3, using the trained model to perform side channel attacks and collecting attack result data;
[0009] Step 4, evaluating the attack results of the model, determining the key obtained by the attack, and evaluating the attack effect of the model.
[0010] Further, the deep learning side-channel attack model is specifically:
[0011] The input features are first normalized by Norm, i.e., the features of all energy traces are normalized;
[0012] Then, the normalized output is subjected to an Embbding operation, i.e., input to a fully connected layer, while adding position encoding information to associate the time sequence relationship between the features; the position encoding is calculated according to the formula:
[0013]
[0014]
[0015] wherein pos represents the position of the feature in the energy trace, d model represents the vector X embed of the input features after Embbeding, d embed represents the dimension of X
[0016] The position encoding and the output of the Embedding are added to X p , which is then input to N encoder blocks.
[0017] Finally, the output of the encoder blocks is put into a fully connected expansion layer, and the feature dimension is reduced by an average pooling layer, followed by a linear fully connected layer, and then classified by softmax to output the probability of each intermediate value.
[0018] Further, the core module of the encoder block is a multi-head self-attention mechanism, which requires that each input vector of the encoder block be subjected to three fully connected layers to obtain three different vectors, namely Query vector Q, Key vector K and Value vector V; then, the transpose of Q and K is multiplied to obtain a matching score vector, which is normalized by dividing by the square root of the dimension of the input vector, and then put into a softmax layer to output a weighted score, which finally acts on V, thereby completing the self-attention solution of the input, and outputting Z:
[0019]
[0020] The output Z of the multi-head self-attention mechanism is then normalized, which is batch normalization here, and then subjected to residual connection, followed by a fully connected learning module, and then an activation function module, which selects SELU; the output of the encoder block is subjected to normalization and residual connection again.
[0021] A deep learning side-channel attack system based on a self-attention mechanism, the system comprising:
[0022] a data set construction module configured to run the encryption device, collect plaintext, a key used for encryption of the plaintext, and data information leaked during a first round of encryption of the device, and construct a data set;
[0023] a model construction and training module configured to construct a side-channel attack model based on a self-attention mechanism and deep learning of original energy traces, train the model using the data set, and collect training indicators;
[0024] an attack module configured to perform side-channel attacks using the trained model and collect attack result data;
[0025] an evaluation module configured to evaluate the attack result of the model, determine a key obtained through the attack, and evaluate attack effects of the model.
[0026] A computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
[0027] Step 1: running the encryption device, collecting plaintext, a key used for encryption of the plaintext, and data information leaked during a first round of encryption of the device, and constructing a data set;
[0028] Step 2: constructing a side-channel attack model based on a self-attention mechanism and deep learning of original energy traces, training the model using the data set, and collecting training indicators;
[0029] Step 3: performing side-channel attacks using the trained model and collecting attack result data;
[0030] Step 4: evaluating the attack result of the model, determining a key obtained through the attack, and evaluating attack effects of the model.
[0031] A computer-readable storage medium has a computer program stored thereon, and the computer program is executable on a processor to implement the following steps:
[0032] Step 1: running the encryption device, collecting plaintext, a key used for encryption of the plaintext, and data information leaked during a first round of encryption of the device, and constructing a data set;
[0033] Step 2: constructing a side-channel attack model based on a self-attention mechanism and deep learning of original energy traces, training the model using the data set, and collecting training indicators;
[0034] Step 3: performing side-channel attacks using the trained model and collecting attack result data;
[0035] Step 4: evaluating the attack result of the model, determining a key obtained through the attack, and evaluating attack effects of the model.
[0036] Compared with the prior art, the present application has the following advantages: the self-attention mechanism is introduced to improve the channel attack, so that there is a new model reference when attacking the original energy trace, the model is better parallelized than other attack models, and the problems of gradient disappearance and gradient explosion in optimizing the model are solved, the disadvantages of using traditional convolutional deep neural networks and traditional recurrent neural networks in the field of side channel are eliminated, and the model training speed is accelerated.
[0037] The present application will be described in further detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0038] Figure 1 A flowchart of a deep learning side channel attack method based on a self-attention mechanism in an embodiment.
[0039] Figure 2 An architecture diagram of a deep learning side channel attack model based on a self-attention mechanism for an original energy trace in an embodiment. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0041] In an embodiment, a deep learning side channel attack method based on a self-attention mechanism is provided in combination with Figure 1 , which comprises the following steps:
[0042] Step 1: running an encryption device, collecting plaintext, keys used for plaintext encryption, and data information leaked by the first round of encryption during device operation, and constructing a data set;
[0043] Step 2: constructing a deep learning side channel attack model based on a self-attention mechanism for an original energy trace, training using the data set, and collecting training indicators;
[0044] Step 3: using the trained model to perform side channel attack and collecting attack result data;
[0045] Step 4: evaluating the attack result of the model to determine the key obtained by the attack and evaluating the attack effect of the model.
[0046] Further, in one of the embodiments, step 1 of running the encryption device and collecting plaintext, keys used for plaintext encryption, and data information leaked by the first round of encryption during device operation specifically comprises:
[0047] Step 1-1, randomly generate a number of 16-byte plaintexts P i , divide the plaintexts into several groups, run the encryption device, and encrypt each group of plaintexts into ciphertexts under the condition of a fixed key K i , the leaked intermediate value is Y i , different groups use different keys for encryption, that is,
[0048]
[0049] wherein, is an XOR operation, Sbox corresponds to an S-box, and is an AES algorithm byte substitution operation; encrypting multiple plaintexts with a fixed key should ensure that all keys in the key space participate in encryption, and the validation set and the attack set have different keys.
[0050] Step 1-2, while running the encryption device in step 1-1, control the device running period through assembly language, and use coil synchronization to collect leaked electromagnetic information; here, the collection of leaked messages is synchronized with the encryption device in a period.
[0051] For each plaintext encryption operation, a set of characteristics is collected and denoted as Trace i , and for each Trace i , the corresponding intermediate value Y i is calculated using the encryption algorithm, and then the characteristics Trace i , the intermediate value Y i , and the plaintext P i form a three-tuple data (Trace i , Y i , P i ), and a data set databses N is formed;
[0052] Step 1-3, divide the data set databses N into a training set databses n_train , a validation set databses n_valid , and an attack set databses n_attack , wherein N, n_train, n_valid, and n_attack are the number of original energy traces, the number of training set energy traces, the number of validation set energy traces, and the number of attack set energy traces, respectively. The intermediate value Y i is determined by the used leakage function, wherein the attack set accounts for ninety percent, and the validation set and the attack set each account for five percent.
[0053] Further, in one embodiment, step 2 constructs a deep learning side-channel attack model based on the self-attention mechanism for the original energy trace, trains the model using the dataset, and collects training indicators. The specific process includes:
[0054] Step 2-1, constructing a deep learning side-channel attack model, which is used to input the feature Trace i Output the vector y composed of the probability of each intermediate value i ';
[0055] Step 2-2, put the training set databses n_train Trace i of each triple into the model, and the model outputs y i ', Y i in the triple and the model output y i ' input the loss function to optimize the model;
[0056] Here, the loss function used by the present application is the cross-entropy loss function. The cross-entropy loss function is:
[0057]
[0058] Where n is the number of energy traces, q(Trace i ) is the probability distribution predicted by the model for the ith energy trace, and p(Trace i ) is the true probability distribution of the ith energy trace.
[0059] Step 2-3, after each cycle of model training, the validation set databses n_valid is used for model training, where Trace i of each triple is put into the model, and the model outputs y′ i Unlike step 2-2, only the model performance indicators, i.e. the accuracy, are collected here, and the loss function does not optimize the model; the accuracy is the probability that the model predicts correctly, which is used to optimize the model to make the model output more in line with expectations. The formula for calculating the accuracy is:
[0060]
[0061] Where num_t is the number of correctly predicted samples, and num_total is the total number of samples.
[0062] Step 2-4, repeat steps 2-2 and 2-3 until the preset number of times is reached. After the end, the model will no longer be optimized and will only be used for prediction.
[0063] Further, in one embodiment, the deep learning side-channel attack model in step 2-1 will be described in detail below:
[0064] The original energy trace features are too many, so the application introduces a self-attention mechanism to use an encoder to encode the original energy trace first, and then extract features from the encoded low-dimensional data. The application completely discards convolution, can efficiently and parallelly construct the network, and at the same time does not need to perform any preprocessing on the original energy trace. After using the self-attention mechanism for processing, the extraction of features and classification can pay more attention to more important features, and the residual architecture is adopted to avoid the problems of gradient disappearance and gradient explosion in the training process of the network.
[0065] The energy trace features leak the key information that the attacker wants. The application uses a deep learning network to establish a model M to combine these leaked information. The original energy trace Trace (hereinafter referred to as T) is put into the model M, and the corresponding leaked information (such as Hamming weight) of X can be output. In the training process, the label and the output probability of the model are put into the cross-entropy function together, the loss function is optimized, the loss is continuously reduced using the optimization algorithm, the model is optimized, the important features of the training set are learned by the model, and the training set is well classified and can be generalized to the verification set and the attack set.
[0066] In combination Figure 2 , the model is specifically:
[0067] The input features are first normalized by Norm, that is, the features of all energy traces are normalized;
[0068] Then, the normalized output is subjected to an Embbding operation, that is, input to a fully connected layer, and at the same time, position encoding information is added to associate the time sequence relationship between the features; the position encoding is calculated according to the following formula:
[0069]
[0070]
[0071] Where, pos represents the position of the feature in the energy trace, d model represents the vector X embed of the input feature after Embbeding, i represents the position of the X embed vector.
[0072] The position encoding and the output of the Embedding are added to X p , and then input to N encoder blocks; N is set to between 3 and 5.
[0073] Finally, the output of the encoder block is put into a fully connected expansion layer, which reduces the feature dimension by an average pooling layer, followed by a linear fully connected layer, and then classified by softmax to output the probability of each intermediate value.
[0074] Further, the core module of the encoder block is a multi-head self-attention mechanism, that is, multiple uses of the self-attention mechanism are then spliced together, which is efficiently parallelized to greatly reduce the training time. This mechanism requires that first, each input vector of the encoder block is processed by three fully connected layers to obtain three different vectors, Query vector Q, Key vector K and Value vector V; then Q and the transpose of K are multiplied to obtain a matching score vector, which is normalized by dividing , and then the matching score vector is put into the softmax layer to output the weighted score, which finally acts on V, thereby completing the self-attention solution to the input, and outputting Z:
[0075]
[0076] After that, the output Z of the multi-head self-attention mechanism is normalized, which is batch normalization here, and then residual connection is performed, followed by a fully connected learning module, and then an activation function module, which selects SELU. Before the output of the encoder block, normalization and residual connection are performed again, and the whole process does not have any convolutional network. The self-attention module of the present application can be completely operated by matrix parallel operation, and efficient parallelization can greatly reduce the running time. In the field of deep learning side channel attack on original energy traces, it is a new model innovation.
[0077] Further, in one embodiment, step 3 uses the trained model to perform side channel attacks and collects attack result data, specifically including:
[0078] Step 3-1, put Trace n_attack in databses i in the attack set into the trained model for attack;
[0079] Step 3-2, collect the output of the model to obtain the output result set Result n_attack .
[0080] Further, in one embodiment, step 4 evaluates the attack results of the model to determine the key obtained by the attack and evaluate the attack effect of the model, specifically including:
[0081] Step 4-1, calculate the guessing entropy and success rate index of the result set Result n_attack output by the model;
[0082] For each record in the result set, output the guess vector in descending order of probability: g = (g1, g2, ..., g |K| ), where |K| is the key space size (one byte of key space is 2). 8 =256), g1 is the value with the highest probability, that is, g1 is the key that is considered to be obtained from a real attack;
[0083] The success rate is defined as g1 equal to the real key k. * The average empirical probability, guessing entropy is defined as k. * The goal is to guess the average position of vector g; the underlying theoretical basis is Bayes' theorem and maximum likelihood estimation.
[0084]
[0085] p k Indicates the use of N a In the case of a raw energy trace attack, the probability of each guessed key is calculated based on the model's output. In N... a The smaller the correct key k * Corresponding probability The larger the value, the better the model performance. When the model is well-trained and has good generalization ability, the correct key k... * In N a The energy trace was guessed during the attack. When the model performs well, N a It will converge to a certain value, and at the same time, it is guessed that the entropy converges to 0, and the success rate converges to 1.
[0086] Step 4-2: Visualize the guessing entropy and success rate. Based on the visualization results, evaluate the minimum number of energy traces required for the model to successfully attack. If the minimum number of traces is less than a preset threshold, the model is considered to have excellent attack performance.
[0087] In one embodiment, a deep learning side-channel attack system based on a self-attention mechanism is provided, the system comprising:
[0088] The dataset building module is used to run the encryption device, collect plaintext, the key used for plaintext encryption, and data information leaked during the first round of encryption when the device is running, and build the dataset.
[0089] The model building and training module is used to build a side-channel attack model based on self-attention mechanism for deep learning against the original energy trace, train it using the dataset, and collect training metrics.
[0090] The attack module is used to perform side-channel attacks using the trained model and collect attack result data.
[0091] An evaluation module is configured to evaluate the attack result of the model, determine the key obtained by the attack, and evaluate the attack effect of the model.
[0092] The specific definitions of the deep learning side-channel attack system based on the self-attention mechanism can refer to the definitions of the deep learning side-channel attack method based on the self-attention mechanism in the foregoing, and will not be repeated here. Each module in the deep learning side-channel attack system based on the self-attention mechanism can be implemented by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in a hardware form, or can be stored in a memory in a computer device in a software form, so as to be called and executed by a processor to perform the operations corresponding to each module.
[0093] In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
[0094] Step 1, running an encryption device, collecting plaintext, a key used for encryption of the plaintext, and data information leaked by the device during the first round of encryption, and constructing a data set;
[0095] Step 2, constructing a side-channel attack model based on the self-attention mechanism for deep learning of the original energy trace, training by using the data set, and collecting training indicators;
[0096] Step 3, performing side-channel attack by using the trained model, and collecting attack result data;
[0097] Step 4, evaluating the attack result of the model, determining the key obtained by the attack, and evaluating the attack effect of the model.
[0098] The specific definitions of each step can refer to the definitions of the deep learning side-channel attack method based on the self-attention mechanism in the foregoing, and will not be repeated here.
[0099] In one embodiment, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the following steps:
[0100] Step 1, running an encryption device, collecting plaintext, a key used for encryption of the plaintext, and data information leaked by the device during the first round of encryption, and constructing a data set;
[0101] Step 2, constructing a side-channel attack model based on the self-attention mechanism for deep learning of the original energy trace, training by using the data set, and collecting training indicators;
[0102] Step 3, using the trained model to perform side channel attack, and collecting attack result data;
[0103] Step 4, evaluating the attack result of the model, determining the key obtained by attack, and evaluating the attack effect of the model.
[0104] The specific definition of each step can refer to the definition of the deep learning side channel attack method based on self-attention mechanism in the above, which will not be repeated here.
[0105] The basic principles, main features and advantages of the present application are shown and described above. Those skilled in the art should understand that the present application is not limited by the above examples, and the above examples and descriptions in the specification are only to illustrate the principles of the present application. Without departing from the spirit and scope of the present application, various changes and improvements can be made to the present application, and these changes and improvements all fall within the scope of the claimed present application. The scope of protection of the present application is defined by the appended claims and their equivalents.
Claims
1. A deep learning side-channel attack method based on a self-attention mechanism, characterized in that, The method includes the following steps: Step 1: Run the encryption device, collect plaintext, the key used for plaintext encryption, and data leaked during the first round of encryption while the device is running, and construct a dataset; Step 2: Construct a side-channel attack model based on self-attention mechanism for deep learning targeting the original energy trace, train it using the dataset, and collect training metrics. Step 3: Use the trained model to perform a side-channel attack and collect the attack result data; Step 4: Evaluate the attack results of the model, determine the key obtained from the attack, and evaluate the attack effect of the model. Step 1 involves running the encryption device and collecting plaintext, the key used for plaintext encryption, and data leaked during the first round of encryption while the device is running. Specifically, this includes: Step 1-1: Randomly generate several 16-byte plaintext P bytes. i The plaintext is divided into several groups, and an encryption device is run. Each group of plaintext is encrypted using a fixed key K. i In the case of encryption into ciphertext, the leaked intermediate value is Y. i Different groups use different keys for encryption, that is: in, For the XOR operation, Sbox corresponds to Sbox, which is the byte substitution operation of the AES algorithm; Step 1-2: While running the encryption device in step 1-1, control the device's operating cycle and use coils to synchronously collect leaked electromagnetic information; For each plaintext encryption operation, a set of features is collected and recorded as Trace. i At the same time, for each Trace i Use an encryption algorithm to calculate its corresponding intermediate value Y. i Then the feature trace i The median value Y i Plaintext P i Trace data i Y i P i ), forming a dataset databses N ; Steps 1-3, transfer the dataset to the dataset. N Divided into training set databses n_train Validation set databses n_valid and attack set databses n_attack , where N, n_train, n_valid, and n_attack are the number of original energy traces, the number of energy traces in the training set, the number of energy traces in the validation set, and the number of energy traces in the attack set, respectively; Step 2 involves constructing a side-channel attack model based on a self-attention mechanism using deep learning to target the original energy trace. This model is trained using the dataset, and training metrics are collected. The specific process includes: Step 2-1: Construct a deep learning side-channel attack model, which is used to trace the input features. i Output the vector y consisting of the probabilities of each of its intermediate values. i '; Step 2-2, transfer the training set databses n_train Used for model training, where the trace of each triple is... i Input into the model, the model outputs y i ', Y in the triple i and the model output y i Input the loss function to optimize the model; Steps 2-3: After each training cycle of the model, the validation set databses are... n_valid Used for model training, where the trace of each triple is... i When input into the model, the model will output y. i Unlike step 2-2, this step only collects the model's performance metrics, namely accuracy, and does not optimize the model using the loss function. The accuracy rate is the probability that the model correctly predicts the input sample, and is used to optimize the model so that its output better matches expectations. The formula for calculating the accuracy rate is: Where num_t is the number of correctly predicted samples, and num_total is the total number of samples; Steps 2-4, repeat steps 2-2 and 2-3 until the preset number of times is reached.
2. The deep learning side-channel attack method based on self-attention mechanism according to claim 1, characterized in that, The deep learning side-channel attack model in step 2-1 is as follows: The input features are first normalized using Norm, which means that the features of all energy traces are normalized; Then, the normalized output is subjected to an Embbbding operation, i.e., input to a fully connected layer, and positional encoding information is added to associate the temporal relationships between features; the formula for calculating the positional encoding is: Where pos represents the position of the feature in the energy trace, and d model X represents the vector X after the input features have been embedded. embed Dimension, i' represents X embed The location of the vector; Add the position code and the output of Embedding, denoted as X. p Then the data is input into N1 encoder blocks; Finally, the output of the encoder block is fed into a fully connected unfolded layer, and the feature dimension is reduced by an average pooling layer. Then it enters a linear fully connected layer, and then goes through a softmax layer for classification, outputting the probability of each intermediate value.
3. The deep learning side-channel attack method based on self-attention mechanism according to claim 2, characterized in that, The core module of the encoder block is a multi-head self-attention mechanism. This mechanism requires that each input vector of the encoder block first be processed through three fully connected layers to obtain three different vectors: a query vector Q, a key vector K, and a value vector V. Then, Q is multiplied by the transpose of K to obtain a matching score vector, which is then divided by... After normalization, the matching score vector is fed into a softmax layer to output a weighted score, which is then applied to V, thus completing the self-attention solution for the input and outputting Z: The output Z of the multi-head self-attention mechanism is then normalized (batch normalization) and followed by residual connections. Next, it enters the fully connected learning module and then the activation function module, which selects SELU. Before the encoder block output, it is normalized and residual connected again.
4. The deep learning side-channel attack method based on self-attention mechanism according to claim 3, characterized in that, Step 3, which involves using the trained model to perform a side-channel attack and collecting attack result data, specifically includes: Step 3-1, transfer the attack set databses n_attack Trace in i The trained model is then used for the attack. Step 3-2: Collect the output results of the model to obtain the output result set Result. n_attack .
5. The deep learning side-channel attack method based on self-attention mechanism according to claim 4, characterized in that, Step 4 involves evaluating the attack results of the model, determining the key obtained from the attack, and assessing the effectiveness of the model's attack. Specifically, this includes: Step 4-1, process the model's output result set Result n_attack Calculate the entropy and success rate metrics for guessing. For each record in the result set, output the guess vector in descending order of probability: g = (g1, g2, ..., g |K| ), where |K| is the key space size, and g1 is the value with the highest probability, that is, g1 is considered to be the key obtained by the real attack; The success rate is defined as g1 equal to the real key k. * The average empirical probability, guessing entropy is defined as k. * Guess the average position in vector g; Step 4-2: Visualize the guessing entropy and success rate. Based on the visualization results, evaluate the minimum number of energy traces required for the model to successfully attack. If the minimum number of traces is less than a preset threshold, the model is considered to have excellent attack performance.
6. A deep learning side-channel attack system based on a self-attention mechanism, using the method described in any one of claims 1 to 5, characterized in that, The system includes: The dataset building module is used to run the encryption device, collect plaintext, the key used for plaintext encryption, and data information leaked during the first round of encryption when the device is running, and build the dataset. The model building and training module is used to build a side-channel attack model based on self-attention mechanism for deep learning against the original energy trace, train it using the dataset, and collect training metrics. The attack module is used to perform side-channel attacks using the trained model and collect attack result data. The evaluation module is used to evaluate the attack results of the model, determine the key obtained from the attack, and evaluate the attack effectiveness of the model.
7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.