Side channel attack method for public key cryptography in post quantum cryptography
Through the combination method of CPA attack and trial-and-error attack, the Pearson correlation matrix and the correct Hamming weight model filter key coefficients are solved, and the traditional CPA attacks are highly calculated and the probability of failure is high, and efficient key cracking is achieved .
Patent Information
- Application Number
- CN202411252386.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-20
AI Technical Summary
Traditional CPA attacks have a large amount of calculations on public key cryptography in post-quantum cryptography and have a high probability of attack failure, making it difficult to effectively crack the key.
By obtaining the key to be decrypted, performing a CPA attack, computing the Pearson correlation matrix and importing the correct Hamming weight model to filter the correct key coefficients, and combining the trial and error attack expansion to obtain a complete decryption key.
It significantly reduces the number and time of energy traces required for attacks, improves the attack success rate, greatly improves cost efficiency, and can accurately recover keys in a short time.
Smart Images

Figure CN119172049A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular to a side channel attack method for public key cryptography in post-quantum cryptography. Background Art
[0002] Traditional public key cryptography RSA (Rivest-Shamir-Adleman) algorithm and elliptic curve cryptography ECC rely on the computational intractability of integer factorization and discrete logarithm problems, respectively. However, with the advent of quantum computing, concerns have been raised because they can be cracked by Shor's algorithm in polynomial time, revealing the insufficient security of existing cryptographic algorithms. CRYSTALS-Kyber is a lattice-based post-quantum cryptographic algorithm constructed based on the error-modular learning problem. The error-modular learning problem is considered secure even in quantum computing. It is worth noting that Kyber's mathematical security has been widely recognized by the cryptographic community. However, for the upcoming deployment phase, it is urgent to emphasize its physical security.
[0003] Side channel security is a very important part of physical security. The first introduction of side channel attack (SCA) is to use the dependence of data on the power consumption of encryption devices to crack the secret key in the device. Correlated power analysis (CPA) attack is a very popular attack method in SCA non-invasive attack. Without destroying the operation of cryptographic devices, this attack uses a large amount of energy traces to analyze the energy consumption at a fixed time, and regards the energy consumption as a function of the processed data, and finally extracts the key in the device through data processing. Figure 7 The decryption process of Kyber is given. The receiver uses the received ciphertext and its own key to perform some corresponding operations to recover the information. At present, the test vector leakage assessment method has been used to assess that there are serious side channel leakage points in this process, including coefficient multiplication and modular reduction. CPA is to use the results of coefficient multiplication, modular reduction, etc. as intermediate values, and obtain the key information involved in the operation by performing some processing on the collected data.
[0004] However, traditional CPA attacks on the Kyber algorithm often require a lot of energy traces to be analyzed to obtain the secret key. This process is very costly and has a high chance of failure. Summary of the invention
[0005] The present application provides a side channel attack method for public key cryptography in post-quantum cryptography to solve the problem that the existing CPA attack has a large amount of calculation and a high probability of attack failure.
[0006] The method comprises:
[0007] Obtain a key to be decrypted, and perform a CPA attack on the key to be decrypted. The CPA attack includes performing correlation calculation based on the key to be decrypted to obtain a Pearson correlation matrix, and importing the Pearson correlation matrix into a modified Hamming weight model for screening to obtain a number of correct key coefficients; the modified Hamming weight model is used to calculate the complement of the intermediate value of the key to be decrypted, and the complement of the intermediate value is the attack position of the CPA;
[0008] A trial-and-error attack is performed on the correct key coefficients to obtain a complete decryption key, and the complete decryption key is used to decrypt the known ciphertext.
[0009] Preferably, the CPA attack further includes:
[0010] Obtaining an energy trace matrix when decrypting the known ciphertext, wherein the known ciphertext is encrypted by the key to be decrypted, and the point product position in the decryption process is the intermediate value;
[0011] A hypothetical intermediate value matrix is calculated based on the known ciphertext, and the intermediate value matrix is calculated based on the intermediate value;
[0012] Correlation calculation is performed based on the energy trace matrix and the assumed intermediate value matrix to obtain the Pearson correlation matrix, which includes a plurality of prediction coefficients, each of which has a different correlation.
[0013] Preferably, the CPA attack further includes:
[0014] Screening is performed according to the Pearson correlation matrix, and a plurality of first coefficients with the greatest correlation are screened out;
[0015] The Pearson correlation matrix is imported into the modified Hamming weight model for mapping and screening again, and the second coefficient with the largest positive correlation is screened out. When the second coefficient coincides with the first coefficient, the second coefficient is marked as a correct key coefficient of the key to be decrypted.
[0016] Preferably, the CPA attack further includes:
[0017] When both the first coefficient and the second coefficient have several coefficients with strong correlation and small correlation difference, Kendall calculation is calculated according to the first coefficient or the second coefficient to obtain a Kendall coefficient matrix, and a curve graph is drawn according to the Kendall coefficient matrix;
[0018] The most stable third coefficient is selected from the curve graph, and the third coefficient is marked as a correct key coefficient of the key to be decrypted.
[0019] Preferably, the CPA attack further includes:
[0020] Calculate all the key coefficients of a first preset number by using a CPA attack to obtain the correct key coefficients of the first preset number;
[0021] All the correct key coefficients include an initial key coefficient, other key coefficients, initial correlations and other correlations, the number of the initial key coefficients is at least a second preset number, the initial correlations correspond to the initial key coefficients, and the other correlations correspond to the other key coefficients;
[0022] The trial and error attack includes:
[0023] Key expansion is performed according to the correct key coefficient to obtain the complete decryption key.
[0024] Preferably, the trial and error attack further comprises:
[0025] Calculate according to the correct key coefficient and the key to be decrypted to obtain an initial index and other indexes, wherein the initial index corresponds to the initial key coefficient, and the other indexes correspond to the other key coefficients;
[0026] The correct key coefficient is processed by the first function, the second function, the third function, the fourth function and the fifth function in sequence, and after completing the fifth function, the first function, the second function and the third function are processed again in sequence to obtain the complete decryption key; the first function is the Kanan embedding algorithm, and the shortest vector for bounded distance decoding is obtained through the first function.
[0027] Preferably, the trial and error attack further comprises:
[0028] Calculating according to the correct key coefficient to obtain the shortest vector;
[0029] Convert the vector in the integer domain of the correct key coefficient to the NTT domain to obtain the first key coefficient whose number is the second preset number, and extract it from the first key coefficient to obtain the second key coefficient;
[0030] Updating the initial index and the other indexes using the initial correlation and the other correlations;
[0031] The initial key coefficients are updated using the other key coefficients, the initial correlations and other correlations until the number of the initial key coefficients reaches the second preset number.
[0032] Preferably, the step of converting the vector in the integer domain of the correct key coefficient into the NTT domain comprises:
[0033] Inputting the linear transformation matrix and the shortest vector into the second function for calculation to obtain the first key coefficient;
[0034] The step of extracting in the first key coefficient comprises:
[0035] The first key coefficient and the initial index are input into the third function for calculation to obtain the second key coefficient, where the second key coefficient is an array whose number is at least a first preset number extracted according to the initial index.
[0036] Preferably, the step of updating the initial index and the other indexes by using the initial correlation and the other correlations comprises:
[0037] Input the initial index, the other indexes, the initial coefficient and the other coefficients into the fourth function for calculation to obtain an updated index;
[0038] The step of updating the initial key coefficient using the other key coefficients, the initial correlation and other correlations comprises:
[0039] The other key coefficients, initial key coefficients, initial correlations and other correlations are input into the fifth function for calculation to obtain updated key coefficients.
[0040] Preferably, the trial and error attack further comprises:
[0041] The updated key coefficient and the updated index input are sequentially input into the first function, the second function and the third function, and when the number of the initial key coefficients is the second preset number, the initial key coefficients are output as the complete decryption key.
[0042] It can be seen from the above content that the present application provides a side channel attack method for public key cryptography in post-quantum cryptography, the method comprising obtaining a key to be decrypted, performing a CPA attack on the key to be decrypted, the CPA attack comprising performing correlation calculation based on the key to be decrypted to obtain a Pearson correlation matrix, and importing the Pearson correlation matrix into a modified Hamming weight model for screening to obtain a number of correct key coefficients; the modified Hamming weight model is used to calculate the complement of the corresponding intermediate value of the key to be decrypted, and the complement of the intermediate value is the attack position of the CPA; a trial-and-error grid attack is performed on the correct key coefficient to obtain a complete decryption key, and the complete decryption key is used to decrypt a known ciphertext. The present application solves the problem of large computational complexity and high probability of attack failure of existing CPA attacks through the above method. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0044] Figure 1 A flowchart of a side channel attack method for public key cryptography in post-quantum cryptography for this application;
[0045] Figure 2 A flowchart of obtaining the Pearson correlation matrix in a side channel attack method for public key cryptography in post-quantum cryptography for this application;
[0046] Figure 3 A flowchart for selecting the correct key coefficient in a side channel attack method for public key cryptography in post-quantum cryptography is provided for this application;
[0047] Figure 4 A flowchart of screening by Kendall coefficient matrix in a side channel attack method for public key cryptography in post-quantum cryptography in this application;
[0048] Figure 5 A flowchart of a trial-and-error attack in a side channel attack method for public key cryptography in post-quantum cryptography is provided for this application;
[0049] Figure 6 A flowchart of obtaining a complete decryption key in a side channel attack method for public key cryptography in post-quantum cryptography in this application;
[0050] Figure 7 This is the schematic diagram of Kyber’s decryption.
[0051] Figure 8 Figure 2 shows the actual energy consumption of the existing CPA attack on Kyber instances.
[0052] Fig. 9 Matrix diagram for calculating the assumed intermediate values in existing CPA attacks;
[0053] Fig.10 A data diagram of the Pearson correlation matrix in an example of a side channel attack method for public key cryptography in post-quantum cryptography in this application;
[0054] Fig.11 A data diagram of the Kendall coefficient matrix in an example of a side channel attack method for public key cryptography in post-quantum cryptography in this application;
[0055] Fig.12 This is a comparison chart of the success rate and time of the side channel attack in this application. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0057] The traditional CPA attack algorithm can be divided into the following five steps:
[0058] (1) Select an intermediate value of the algorithm to be executed: the intermediate value is f(d, k), d is the ciphertext or plaintext, and k is the partial key;
[0059] (2) Measure the actual energy consumption: Measure the energy trace of the correct key corresponding to D pieces of ciphertext data, with T sampling points;
[0060] (3) Calculate the hypothetical intermediate value: Calculate the hypothetical intermediate values of the K hypothetical keys corresponding to the D ciphertext data respectively;
[0061] (4) Mapping the intermediate value to the energy consumption value: Using the Hamming distance / Hamming weight model to simulate the energy leakage model;
[0062] (5) Compare the assumed energy consumption value (corresponding to the guessed key) and the energy trace (corresponding to the correct key) to select some correct keys;
[0063] (6) Repeat the above steps until all keys are recovered.
[0064] Figure 8 Figure 2 shows the actual energy consumption of existing CPA attacks on Kyber instances.
[0065] See also Figure 8 As you can see, examples of actual CPA attacks on Kyber include:
[0066] (1) Select the key in the Kyber decryption algorithm The first part of the coefficients and the ciphertext The result of the dot product of the first part of the coefficients is taken as the intermediate value, and the intermediate value is recorded as v i,j , let the coefficient of the first part of the ciphertext of the i-th item be d i , let the coefficient of the first part of the j-th guessed key be k j , the relationship satisfies: v i,j =(d i *k j ) mod q. The modulus q in Kyber is 3329.
[0067] (2) Calculate the hypothetical intermediate value. 1. In Kyber’s clean implementation, because the point multiplication operation is performed in the NTT domain, there are 3329 possible values for the first coefficient of the key k. These possible values are recorded as k j , K represents k j The number of all possible values, k is a vector of all elements: k = (k1, k2, k3, ..., k K )=(0,1,2,…,3328). 2. The coefficients of the first part of the ciphertext data can be expressed as element d i , D represents the number of all given ciphertext data, d is the vector composed of the first part of all plaintext data: d = (d1, d2, d3, ..., d D ). 3. Calculate all the assumed intermediate values: v i,j =(d i *k j ) mod q, i=1, 2, 3,..., D, j=1, 2, 3,..., K. V D×K Yes i,j The matrix composed of D×K Yes i,j The matrix formed by Fig. 9 .
[0068] (3) Use the Hamming distance or Hamming weight model to map the assumed intermediate value to an energy consumption value to simulate energy leakage. Here are the explanations of the Hamming distance and Hamming weight models respectively: Hamming weight: Calculate the Hamming weight of the assumed intermediate value, that is, the number of 1s in the assumed intermediate value. Hamming distance: Calculate the Hamming distance between the assumed intermediate value f(d, k) and d, that is, the number of 1→0 and 0→1 after the operation. In this example, the Hamming weight model is used to simulate the energy leakage model. Different leakage models can be selected according to different algorithms and implementation methods.
[0069] (5) Calculate the assumed energy value matrix H D×K With the energy trace matrix T D×T The Pearson correlation coefficient between them is calculated as follows: Where i represents the i-th column of H and j represents the j-th column of T. Finally, the correlation matrix ρ is obtained K×T If ρ 2,T-1 is the maximum value in the matrix, then the first byte of the correct key is k2, and the operation occurs at time T-1.
[0070]
[0071] From the above, it can be seen that the traditional CPA attack on the Kyber algorithm often requires a lot of energy traces to be analyzed to obtain the secret key. The cost of this process is very high and the probability of failure is also very high. Based on this, this embodiment provides the following implementation plan.
[0072] Figure 1 The present invention provides a flow chart of a side channel attack method for public key cryptography in post-quantum cryptography.
[0073] See also Figure 1 It can be seen that this embodiment provides a side channel attack method for public key cryptography in post-quantum cryptography, the method comprising:
[0074] S100, obtaining a key to be decrypted, and performing a CPA attack on the key to be decrypted. The CPA attack includes performing correlation calculation according to the key to be decrypted to obtain a Pearson correlation matrix, and importing the Pearson correlation matrix into a modified Hamming weight model for screening to obtain a number of correct key coefficients; the modified Hamming weight model is used to calculate the complement of the intermediate value of the key to be decrypted, and the complement of the intermediate value is the attack position of the CPA. Specifically, in this embodiment, the key coefficient to be decrypted in the key to be decrypted is extracted, and the correlation is calculated by the key coefficient to be decrypted and the related parameters generated in the process of decrypting the key to be decrypted, so as to obtain the Pearson correlation matrix, and preliminary correct key coefficients are screened in the Pearson correlation matrix, and the Pearson correlation matrix is imported into the modified Hamming weight model for re-screening, so as to re-screen the preliminary correct key coefficients and filter out the coefficients with negative correlation, so as to complete the CPA attack, and thereby obtain the correct key coefficient corresponding to the key to be decrypted.
[0075] It should be noted that in the CPA attack, only a certain number of the correct key coefficients need to be obtained, rather than all the key coefficients. The other key coefficients are obtained by expanding through subsequent trial and error attacks.
[0076] Figure 2 The present invention provides a flowchart for obtaining the Pearson correlation matrix in a side channel attack method for public key cryptography in post-quantum cryptography.
[0077] See also Figure 2 It can be seen that, further, in some embodiments, the CPA attack also includes:
[0078] S111, obtaining an energy trace matrix when decrypting the known ciphertext, wherein the known ciphertext is encrypted by the key to be decrypted, and the point product position in the decryption process is the intermediate value;
[0079] S112, calculating a hypothetical intermediate value matrix according to the known ciphertext, wherein the intermediate value matrix is calculated according to the intermediate value;
[0080] S113, performing correlation calculation based on the energy trace matrix and the assumed intermediate value matrix to obtain the Pearson correlation matrix, wherein the Pearson correlation matrix includes a plurality of prediction coefficients, and each prediction coefficient has a different correlation.
[0081] Specifically, in this embodiment, the energy trace matrix and the assumed intermediate value matrix are obtained in the process of decrypting the known ciphertext, and the Pearson correlation matrix is obtained by performing correlation calculation on the energy trace matrix and the assumed intermediate value matrix.
[0082] It should be noted that there are generally several coefficients obtained through the Pearson correlation matrix, so further screening is required to obtain the correct coefficients.
[0083] For example, we select the point product position fqmul(k,u1) as the intermediate value of our attack, and all the intermediate values in the following experiments are the values of this position. First, we capture the energy trace matrix T of the receiving device when decrypting different ciphertexts. Here we only capture the energy traces of about 15. Secondly, we calculate the hypothetical intermediate value matrix V through the known ciphertext. The calculation of this matrix can be pre-calculated without taking up the time of the attack. Then, the correlation between the matrix T and the matrix V is calculated to obtain the Pearson correlation matrix ρ.
[0084] Among them, the data diagram of Pearson correlation matrix ρ can be found in Fig.10 .
[0085] See also Fig.10 It can be seen that Fig.10 The horizontal axis of the KeyGuess image is the guessed key (in the range of (0, 3329)), and the vertical axis is the absolute value of the maximum Pearson correlation of the guessed key at all times. Fig.10 In the KeyGuess image, we pick out the two coefficients with the largest correlation (1049 and 2280) as candidates for the correct key. Fig.10 The horizontal axis in the TracePoints image is the time, the vertical axis is the Pearson correlation value, Correct: 2280 represents the correct key coefficient 2280, and the other curves represent other incorrect guessed key coefficients.
[0086] Figure 3 The present invention provides a flowchart for screening the correct key coefficient in a side channel attack method for public key cryptography in post-quantum cryptography.
[0087] See also Figure 3It can be seen that, further, in some embodiments, the CPA attack also includes:
[0088] S121, screening according to the Pearson correlation matrix, and screening out a plurality of first coefficients with the greatest correlation;
[0089] S122, import the Pearson correlation matrix into the modified Hamming weight model for mapping and screening again, and screen out the second coefficient with the largest positive correlation. When the second coefficient coincides with the first coefficient, mark the second coefficient as a correct key coefficient of the key to be decrypted.
[0090] Specifically, in this embodiment, the correct key coefficients are obtained in sequence by screening the coefficients under the mapping of the Pearson correlation matrix and the modified Hamming weight model in sequence.
[0091] For example, the screening of the Pearson correlation matrix can be found in Fig.10 .
[0092] According to Fig.10 From the KeyGuess image, we can see that when calculating one coefficient, two or more coefficients that meet the requirements are obtained, so the coefficients need to be further screened.
[0093] See also Fig.10 From the TracePoints image, we can see that the mapping model used is the modified Hamming weight model. As can be seen from the figure below, after using such a model, the false positive key 1049 shows a strong negative correlation, so we can eliminate the false positive 1049 based on its strong negative correlation at time 750, and thus select 2280 as the correct key coefficient for the basemul. In this example, the correct key coefficient can be picked out without using the Kendall correlation coefficient.
[0094] Figure 4 The present invention provides a flowchart of screening through the Kendall coefficient matrix in a side channel attack method for public key cryptography in post-quantum cryptography.
[0095] See also Figure 4 It can be seen that, further, in some embodiments, the CPA attack also includes:
[0096] S131, when both the first coefficient and the second coefficient have several coefficients with strong correlation and small correlation difference, calculate Kendall calculation according to the first coefficient or the second coefficient to obtain a Kendall coefficient matrix, and draw a curve graph according to the Kendall coefficient matrix;
[0097] S132, selecting the most stable third coefficient from the curve graph, and marking the third coefficient as a correct key coefficient of the key to be decrypted.
[0098] Specifically, in this embodiment, considering that there are still a plurality of very similar coefficients after screening through the Pearson correlation matrix and the modified Hamming weight model, the Kendall coefficient matrix is introduced in this embodiment to solve this type of situation.
[0099] Fig.11 This application discloses a data graph of the Kendall coefficient matrix in an example of a side channel attack method for public key cryptography in post-quantum cryptography.
[0100] See also Fig.11 It can be seen that, for example, Fig.11 Figure (a) shows the absolute value of the correlation value corresponding to each guessed key in the PCC correlation matrix under 15 energy traces. We marked the top 4 guessed key coefficients as 564, 1687, 2010, and 2264. The correlation of these four coefficients is very prominent among the many guessed key coefficients, and their values are very close. At this time, if you directly select any one of the 4 candidate guessed keys, there is only a 1 / 4 probability of selecting the correct key coefficient 564. So here we additionally apply Kendall's correlation coefficient. The specific method is to calculate the Kendall coefficient matrix of these four candidate guessed keys, Fig.11 Figure (b) shows the relationship between the maximum value of |Kendall'stau| and the energy traces of the four key guessed key coefficients. It shows that the Kendall's correlation coefficient expands the difference between the correct key coefficient and the false positive key coefficient. As the number of energy traces increases, the absolute value of the correlation corresponding to the correct key coefficient tends to be stable, while the value of the false positive key coefficient decreases rapidly. When the number of energy traces = 15, we can easily distinguish the correct key coefficient 564. We gradually reduce the number of energy traces to 11 and calculate the Pearson correlation coefficient and Kendall's correlation coefficient. The results are as follows Fig.11 Figure (c) and Fig.11 As shown in Figure (d), it can be seen that the correct key 564 is almost impossible to identify. We can combine the two correlation values of the four candidate key coefficients to select the final correct candidate from the four candidate key coefficients.
[0101] It should be noted that it is necessary to use the CPA attack to calculate all of the first preset number of key coefficients, and only when the first preset number of correct key coefficients are obtained can the CPA attack be considered completed, wherein all the correct key coefficients include initial key coefficients, other key coefficients, initial correlations and other correlations, the number of the initial key coefficients is at least the second preset number, the initial correlation corresponds to the initial key coefficient, and the other correlations correspond to the other key coefficients.
[0102] Here, referring to the above step S100 and the subsequent branch steps corresponding to S100, the CPA attack has the following examples:
[0103] The CPA attack is divided into two stages: the capture stage and the modeling calculation stage. Our optimization is mainly concentrated in the latter stage, including modifying the Hamming weight model (HW or power leakage model) and adding an optional Kendall's tau calculation after the PCC calculation. Now we will modify the leakage model and add the optional Kendall's tau calculation respectively. (1) The arithmetic logic unit (ALU) and multiplier unit (MU) in the ARM processor are usually optimized for 2's complement operations. Most arithmetic and logic instructions in the processor instruction set are designed based on two's complement calculations. Therefore, we fine-tune the HW or power leakage model based on this feature, by calculating the HW of the complement of the intermediate value instead of directly calculating the HW of the intermediate value. Through this fine-tuning, the attack is enhanced while avoiding false positive key coefficients obtained by erroneous attacks. We briefly explain why the false positive key coefficient can be avoided from being selected. Assuming s0 is the correct key coefficient, s'0=3329-s0 is a false positive key coefficient. The intermediate values of the two guessed key coefficients are summarized as follows: r1 = s0 × u1 mod q, r'1 = ((3329-s0) × u1) mod q = -(s0 × u1) mod q. Then, the two intermediate values are mapped to the assumed power consumption through the modified HW leakage model. Their assumed power consumption values show a negative correlation, while the correct key coefficients naturally show a positive correlation at the corresponding time. Therefore, when calculating the PCC correlation, we can distinguish the correct key and false positive key coefficients by considering their signs at the corresponding time.
[0104] The goal of the enhanced CPA attack is to use fewer energy traces to find the correct key coefficients while ensuring the efficiency and success rate of the attack. With a limited number of energy traces, the calculated PCC values for all guessed keys tend to be very high. Therefore, it is difficult to accurately recover partial key coefficients using only traditional CPA attacks, and trying to reconstruct 128 or the entire set of key coefficients becomes even more arduous. Our solution is as follows. After calculating the PCC correlation matrix for each partial key coefficient, we set its threshold to 0.9 or even higher and adjust it based on the value of this matrix. For each partial key coefficient, if there are f guessed key coefficients whose correlation exceeds the threshold, we regard it as a candidate key coefficient Then, we map the assumed intermediate values of the f candidate coefficients to the candidate assumed power consumption value matrix H' D×f .
[0105] Next, we calculate the Kendall correlation coefficient between the assumed power value matrix H' and the actual power matrix T. Finally, we get an f×T Kendall correlation coefficient matrix K d , select the candidate key with the highest correlation coefficient as the correct coefficient of this part of the key. Here is the Kendall correlation coefficient calculation formula:
[0106]
[0107] Where n is the number of samples, c and d represent the number of consistent and inconsistent pairs, respectively, and t x and t y denote the number of tie pairs in the x variable and in the y variable, respectively.
[0108] S200, a trial-and-error grid attack is performed on the correct key coefficient to obtain a complete decryption key, and the complete decryption key is used to decrypt the known ciphertext. Specifically, in this embodiment, the key expansion of the correct key coefficient is achieved through a trial-and-error grid attack, so that the complete decryption key corresponding to the decryption key can be obtained, wherein the complete decryption key also corresponds to the known ciphertext.
[0109] Among them, steps S100 to S200 can be understood as using the above CPA attack method to attack the first 60 basemuls and record the attack results. The attack results here include the corresponding key coefficients, the values of the two correlations, and the corresponding basemul indexes. We import this information into the trial and error grid attack to obtain the final correct 128 correct key coefficients.
[0110] The comparison of the success rate and time of the two-step attack execution is shown in Fig.12 .
[0111] Figure 5This application discloses a flowchart of a trial-and-error attack in a side-channel attack method for public key cryptography in post-quantum cryptography.
[0112] See also Figure 5 It can be seen that, further, in some embodiments, the trial and error attack further includes:
[0113] S210, performing calculation according to the correct key coefficient and the key to be decrypted to obtain an initial index and other indexes, wherein the initial index corresponds to the initial key coefficient, and the other indexes correspond to the other key coefficients;
[0114] S220, sequentially process the correct key coefficient using the first function, the second function, the third function, the fourth function and the fifth function, and after completing the fifth function, sequentially re-process the first function, the second function and the third function to obtain the complete decryption key; the first function is the Kanan embedding algorithm, and the shortest vector for bounded distance decoding is obtained through the first function.
[0115] Specifically, in this embodiment, the lattice attack provides a fault tolerance and can recover a set of all 128 key coefficients. Using this method, we propose a more flexible and general application method. Algorithm 2 (the specific content of Algorithm 2 is shown below) shows the proposed trial-and-error lattice attack algorithm, where represents the number of different parts of the key coefficients that have been attacked by the CPA attack. Each trial and error replaces the key coefficient with the lowest correlation among the 38 coefficients, and then continues to use the lattice attack method after the replacement. One of the benefits of using the proposed method is that in order to recover a set of key coefficients, we can use at least 38 / 39 CPA attacks instead of 128 CPA attacks. Of course, the more CPA attacks, the higher the success rate of this method, but the efficiency will also decrease. In the trial and error method, the key coefficient with the lowest correlation among the 38 / 39 key coefficients is replaced with a key coefficient with a higher correlation. It should be noted that it is necessary to set appropriate lattice attack parameters, otherwise it may take a long time to try the lattice attack, resulting in low overall recovery efficiency.
[0116] Algorithm 2:
[0117] Input: initial index index = [1, 2, ..., 37, 38], other index other_index = [39, 40, ..., n-2, n-1], initial key coefficient guess_sk = [sk_bu0, ..., sk_bu38], other key coefficient other_sk =
[0118] [sk_bu39, ..., sk_bu(n-1)], initial correlation coefficient ken = [k_bu0, ..., k_bu38], other correlation coefficients other_ken = [k_bu39, ..., k_bu(n-1)], NTT linear transformation matrix M;
[0119]
[0120] Among them, the Lattice_attack can be understood as the first function, the Matrix_multiply can be understood as the second function, the extract can be understood as the third function, the update_index can be understood as the fourth function, and the update_guess_sk can be understood as the fifth function.
[0121] Among them, Lattice_attack is Algorithm 1. For details of Algorithm 1, please refer to the following.
[0122]
[0123]
[0124] In Algorithm 1, let I a =(a0,…,a sr-1 ) is the index of the key coefficient that has been recovered, then I b =(b0,…,a 127-sr ) represents the index of the coefficient that has not been restored. Can be written as Here N is the matrix expression of the inverse NTT transformation, The index in matrix N is I a The corresponding columns are composed of Represents the vector of successfully recovered key coefficients. Similarly, N B and The same is true. Among these quantities, N, N A , are all known quantities, assuming A=-N B , This will result in a lower dimensional LWE problem than the original LWE problem in Kyber: t = A · s' + s i , which makes the problem much simpler. We first consider it as a bounded distance decoding (BDD) / unique shortest vector problem (uSVP) lattice problem. Algorithm 1 gives the algorithm for solving this lower dimensional LWE problem using the Kanan embedding technique, where the matrices BDD and B kan Is of the following form:
[0125]
[0126] The specific steps of Algorithm 2 can be found in Figure 6 .
[0127] See also Figure 6 It can be seen that, further, in some embodiments, the trial and error attack further includes:
[0128] S221, performing calculation according to the correct key coefficient to obtain the shortest vector;
[0129] S222, converting the vector of the correct key coefficient in the integer domain into the NTT domain to obtain the first key coefficient whose number is the second preset number, and extracting it from the first key coefficient to obtain the second key coefficient. Specifically, in this embodiment, the linear transformation matrix and the shortest vector are input into the second function for calculation to obtain the first key coefficient; the first key coefficient and the initial index are input into the third function for calculation to obtain the second key coefficient, and the second key coefficient is an array whose number extracted according to the initial index is at least the first preset number.
[0130] S223, using the initial correlation and the other correlations to update the initial index and the other indexes. Specifically, in this embodiment, the initial index, the other indexes, the initial coefficients and the other coefficients are input into the fourth function for calculation to obtain an updated index.
[0131] S224, using the other key coefficients, initial correlations and other correlations to update the initial key coefficients until the number of the initial key coefficients is the second preset number. Specifically, in this embodiment, the other key coefficients, initial key coefficients, initial correlations and other correlations are input into the fifth function for calculation to obtain the updated key coefficients.
[0132] It should be noted that in order to obtain a complete decryption key, the updated key coefficient and the updated index input need to be input into the first function, the second function and the third function in sequence, and when the number of the initial key coefficients is the second preset number, the initial key coefficient is output as the complete decryption key.
[0133] Here, referring to the above step S200 and the subsequent branch steps corresponding to S200, the trial-and-error attack has the following examples:
[0134] The matrix_multiply function has two inputs, one is the known NTT positive linear transformation matrix M, and the other is the shortest vector result in the integer domain after the lattice attack. The output is a set of 128 key coefficients in the NTT domain. The function is to transform the vector in the integer domain into the NTT domain. The extract function has two inputs, one is a set of 128 key coefficients in the NTT domain obtained in the previous step, and the other is the initial index index of the algorithm input. The output is an array of 39 dimensions that extracts 128 coefficients based on the initial index. The function is to extract the corresponding key coefficient from the result of the previous step. The update_index function has four inputs, one is the initial index index, one is other index other_index, one is the initial correlation coefficient ken of the algorithm input, and one is other correlation coefficient other_ken of the algorithm input. The output is index (overwrite the original index). The function is to update the index index based on other_index, ken and other_ken arrays for subsequent Lattice_attack. The update_guess_sk function has four inputs, one is the initial key coefficient guess_sk, one is the other key coefficient other_sk, one is the initial correlation coefficient ken, and one is the other correlation coefficient other_ken. One of the outputs is guess_sk (overwriting the original guess_sk). The function is to update guess_sk based on the other_sk, ken, and other_ken arrays for subsequent Lattice_attack use.
[0135] Lattice attack It provides a fault tolerance and can recover a set of all 128 key coefficients. Using this method, we propose a more flexible and general application method. Algorithm 2 shows the proposed trial-and-error lattice attack algorithm, where represents the number of different parts of key coefficients that have been attacked by the CPA attack. Each trial and error replaces the key coefficient with the lowest correlation among the 38 / 39 coefficients, and then continues to use the lattice attack method after the replacement. One of the benefits of using the proposed method is that in order to recover a set of key coefficients, we can use at least 38 / 39 CPA attacks instead of 128 CPA attacks. Of course, the more CPA attacks, the higher the success rate of this method, but the efficiency will also decrease. In the trial and error method, the key coefficient with the lowest correlation among the 38 / 39 key coefficients is replaced with a key coefficient with a higher correlation. It should be noted that it is necessary to set appropriate lattice attack parameters, otherwise it may take a long time to try lattice attacks, resulting in low overall recovery efficiency.
[0136] This embodiment has the following advantages:
[0137] Using the traditional CPA attack to recover a set of 128 key coefficients in Kyber512 requires 30×128 energy traces, and it takes 2×128 minutes to get a possible correct result. If one of the 128 key coefficients is recovered incorrectly, it is impossible to get the correct key. Experiments show that the two-step attack we proposed can accurately recover a complete set of key coefficients of Kyber512 in about 9 minutes using only 15×60 random ciphertexts. From the perspective of energy trace cost, the cost of the number of energy traces is reduced by 3.2 times, and the attack time is shortened by about 28 times, which greatly improves the attacker's attack efficiency and accuracy.
Claims
1. A side channel attack method for public key cryptography in post-quantum cryptography, characterized in that: The method comprises: Obtain a key to be decrypted, and perform a CPA attack on the key to be decrypted. The CPA attack includes performing correlation calculation based on the key to be decrypted to obtain a Pearson correlation matrix, and importing the Pearson correlation matrix into a modified Hamming weight model for screening to obtain a number of correct key coefficients; the modified Hamming weight model is used to calculate the complement of the intermediate value of the key to be decrypted, and the complement of the intermediate value is the attack position of the CPA; A trial-and-error attack is performed on the correct key coefficients to obtain a complete decryption key, and the complete decryption key is used to decrypt the known ciphertext.
2. A side channel attack method for public key cryptography in post-quantum cryptography according to claim 1, characterized in that: The CPA attack also includes: Obtaining an energy trace matrix when decrypting the known ciphertext, wherein the known ciphertext is encrypted by the key to be decrypted, and the point product position in the decryption process is the intermediate value; A hypothetical intermediate value matrix is calculated based on the known ciphertext, and the intermediate value matrix is calculated based on the intermediate value; Correlation calculation is performed based on the energy trace matrix and the assumed intermediate value matrix to obtain the Pearson correlation matrix, which includes a plurality of prediction coefficients, each of which has a different correlation.
3. A side channel attack method for public key cryptography in post-quantum cryptography according to claim 2, characterized in that: The CPA attack also includes: Screening is performed according to the Pearson correlation matrix, and a plurality of first coefficients with the greatest correlation are screened out; The Pearson correlation matrix is imported into the modified Hamming weight model for mapping and screening again, and the second coefficient with the largest positive correlation is screened out. When the second coefficient coincides with the first coefficient, the second coefficient is marked as a correct key coefficient of the key to be decrypted.
4. A side channel attack method for public key cryptography in post-quantum cryptography according to claim 3, characterized in that: The CPA attack also includes: When both the first coefficient and the second coefficient have several coefficients with strong correlation and small correlation difference, Kendall calculation is calculated according to the first coefficient or the second coefficient to obtain a Kendall coefficient matrix, and a curve graph is drawn according to the Kendall coefficient matrix; The most stable third coefficient is selected from the curve graph, and the third coefficient is marked as a correct key coefficient of the key to be decrypted.
5. A side channel attack method for public key cryptography in post-quantum cryptography according to claim 4, characterized in that: The CPA attack also includes: Calculate all the key coefficients of a first preset number by using a CPA attack to obtain the correct key coefficients of the first preset number; All the correct key coefficients include an initial key coefficient, other key coefficients, initial correlations and other correlations, the number of the initial key coefficients is at least a second preset number, the initial correlations correspond to the initial key coefficients, and the other correlations correspond to the other key coefficients; The trial and error attack includes: Key expansion is performed according to the correct key coefficient to obtain the complete decryption key.
6. A side channel attack method for public key cryptography in post-quantum cryptography according to claim 5, characterized in that: The trial and error attack also includes: Calculate according to the correct key coefficient and the key to be decrypted to obtain an initial index and other indexes, wherein the initial index corresponds to the initial key coefficient, and the other indexes correspond to the other key coefficients; The correct key coefficient is processed by the first function, the second function, the third function, the fourth function and the fifth function in sequence, and after completing the fifth function, the first function, the second function and the third function are processed again in sequence to obtain the complete decryption key; the first function is the Kanan embedding algorithm, and the shortest vector for bounded distance decoding is obtained through the first function.
7. A side channel attack method for public key cryptography in post-quantum cryptography according to claim 6, characterized in that: The trial and error attack also includes: Calculating according to the correct key coefficient to obtain the shortest vector; Convert the vector in the integer domain of the correct key coefficient to the NTT domain to obtain the first key coefficient whose number is the second preset number, and extract it from the first key coefficient to obtain the second key coefficient; Updating the initial index and the other indexes using the initial correlation and the other correlations; The initial key coefficients are updated using the other key coefficients, the initial correlations and other correlations until the number of the initial key coefficients reaches the second preset number.
8. A side channel attack method for public key cryptography in post-quantum cryptography according to claim 7, characterized in that: The step of converting the vector in the integer domain of the correct key coefficient to the NTT domain comprises: Inputting the linear transformation matrix and the shortest vector into the second function for calculation to obtain the first key coefficient; The step of extracting in the first key coefficient comprises: The first key coefficient and the initial index are input into the third function for calculation to obtain the second key coefficient, where the second key coefficient is an array whose number is at least a first preset number extracted according to the initial index.
9. A side channel attack method for public key cryptography in post-quantum cryptography according to claim 8, characterized in that: The step of updating the initial index and the other indexes by using the initial correlation and the other correlations comprises: Input the initial index, the other indexes, the initial coefficient and the other coefficients into the fourth function for calculation to obtain an updated index; The step of updating the initial key coefficient using the other key coefficients, the initial correlation and other correlations comprises: The other key coefficients, initial key coefficients, initial correlations and other correlations are input into the fifth function for calculation to obtain updated key coefficients.
10. A side channel attack method for public key cryptography in post-quantum cryptography according to claim 9, characterized in that: The trial and error attack also includes: The updated key coefficient and the updated index input are sequentially input into the first function, the second function and the third function, and when the number of the initial key coefficients is the second preset number, the initial key coefficients are output as the complete decryption key.
