Password side channel waveform automatic segmentation method based on template matching

The side channel waveform of public key cryptographic devices is automatically segmented through template matching method, which solves the problem of traditional methods relying on manual experience and high time complexity. It achieves efficient and accurate waveform segmentation, adapts to different algorithms and devices, and reduces computational overhead.

CN120856296APending Publication Date: 2025-10-28BEIJING INST OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510760798.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2025-05-30
Filing Date
2025-06-09
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

In the existing side-channel analysis of public-key cryptographic devices, traditional waveform segmentation methods rely on manual experience, have poor flexibility and versatility, and automated segmentation methods have high time complexity and are difficult to meet large-scale application needs.

Method used

A template matching-based method is adopted to obtain the side channel waveform of the public key cryptographic algorithm signing process, preprocess the noise and perform sliding search for the most similar waveform segment, and then use template A and template B for correlation matching to automatically segment the cryptographic side channel waveform.

Benefits of technology

It achieves efficient and accurate waveform segmentation without human intervention, reduces time complexity and computational overhead, improves flexibility and versatility, adapts to different algorithms and devices, and meets large-scale application needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120856296A_ABST
    Figure CN120856296A_ABST
Patent Text Reader

Abstract

A password side channel waveform automatic segmentation method based on template matching comprises the following steps: acquiring side channel waveform data from a signature process of a public key cryptographic algorithm, and calibrating and preprocessing a starting point and an ending point; selecting an initial segment from the waveform, and extracting the waveform between the initial segment and the waveform as a template A through sliding matching and correlation coefficient calculation; taking the template A as a reference, performing correlation comparison with a subsequent equal-length waveform fragment, and if the correlation exceeds a preset threshold value, determining a next segmentation point; if not, generating a template B to continue matching; and if the threshold requirement cannot be met by taking the template B as the reference, calculating a correlation coefficient by adopting sliding matching by taking the template A and the template B as the reference in sequence, and finding a maximum correlation position as a new segmentation point. Iteration is carried out, the whole waveform is traversed, and calibration of all segmentation points is completed. According to the method, efficient and accurate waveform segmentation can be realized, and the automation degree and the actual application performance are both considered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to an automated method for segmenting cryptographic side-channel waveforms based on template matching, belonging to the fields of cryptography and side-channel analysis technology. Background Technology

[0002] Public-key cryptography has been widely used in key areas such as encrypted communication, digital signatures, and identity authentication, and has become a core component of modern information security systems. Its security is typically based on mathematical problems (such as large number factorization and elliptic curve discrete logarithms), providing strong theoretical guarantees from the algorithm design level. However, in practical applications, cryptographic devices generate physical signals such as time delays, power consumption fluctuations, and electromagnetic radiation during encryption and decryption operations. These physical signals can be collected and analyzed by external devices, thus exposing potentially sensitive information. Due to the complexity, time-consuming operation, and significant energy consumption of public-key algorithms, they are more vulnerable to side-channel attacks such as Simple Power Analysis (SPA).

[0003] Simple energy analysis (SEM), first proposed by Paul Kocher in 1999, is a side-channel analysis method. It captures the power consumption waveform of a device during the execution of a cryptographic algorithm and analyzes the power consumption differences generated by different basic operations (such as the modular square and modular multiplication of RSA). Because these operations typically have different power consumption characteristics, attackers can classify the power consumption waveforms to recover sensitive information such as private keys.

[0004] In simple energy analysis, waveform segmentation is a crucial step. Accurately segmenting the complete power consumption waveform at the operational granularity facilitates subsequent key recovery, improving reliability and success rate. However, both traditional waveform segmentation methods and newly proposed waveform segmentation schemes have certain technical bottlenecks.

[0005] Traditional segmentation methods, such as equidistant segmentation and spike segmentation, suffer from problems such as reliance on human experience, poor flexibility, and poor versatility. Equidistant segmentation requires that the number of basic operations be known and that the waveform lengths of different operations be approximately the same, thus limiting its applicability. Spike segmentation, on the other hand, relies on human experience for parameter configuration, resulting in poor flexibility and versatility, making it difficult to adapt to the diverse needs of different algorithms or devices.

[0006] To address the issue that traditional methods heavily rely on human experience, researchers have begun exploring the introduction of artificial intelligence into automated waveform segmentation tasks. In 2024, Wang et al. first introduced reinforcement learning into the segmentation process of simple energy analysis, successfully achieving automated waveform segmentation without human intervention, provided that the start and end points of the algorithm and the key length were known. However, this method requires extensive iterative searches and environmental interactions, resulting in high time complexity and computational overhead, making it difficult to meet the needs of large-scale applications. Summary of the Invention

[0007] To address the shortcomings of existing technologies, such as poor flexibility and versatility, difficulty in adapting to diverse needs under different algorithms or devices, high time complexity, and large computational overhead, which hinder large-scale applications, this invention proposes an automated waveform segmentation method for cryptographic side-channels based on template matching. The technical solution of this method is as follows:

[0008] An automated waveform segmentation method for cryptographic side-channels based on template matching includes the following steps:

[0009] Step 1: Obtain the side-channel waveform during the public-key cryptography algorithm signature process, determine the start and end positions of the signature, and extract the corresponding signature process waveform data accordingly.

[0010] Specifically, step 1 includes the following sub-steps:

[0011] Sub-step 1.1: Obtain the side-channel waveform during the public-key cryptography algorithm signature process, determine the start and end positions of the signature, and determine the signature algorithm waveform based on the horizontal coordinates of the start and end positions;

[0012] Sub-step 1.2: Preprocess the noise present in the waveform of the signature algorithm obtained from sub-step 1.1. Preprocessing methods include filtering, resampling, etc.

[0013] Step 2: Select an initial segment from the signature waveform as a reference template, slide the search within the preset search range to find the waveform segment most similar to the initial segment, and take its starting position as the best matching position, and calculate the correlation; extract the waveform template as template A based on the waveform between the initial segment position and the best matching position, for subsequent matching operations; at the same time, record the index of the best matching position as start_point and store it in the segmentation point array, and calculate the threshold. The length of the reference template and the size of the search range are determined based on the total length of the signature waveform and the key length, and the key length is given in advance.

[0014] Specifically, step 2 includes the following sub-steps:

[0015] Sub-step 2.1: Based on the total length of the signature waveform and the key length, determine the initial fragment length and the size of the search range, further including the following grandchild steps:

[0016] Sun's step 2.1.1: Calculate the "upper limit of the search range" as the ratio of the total length of the signature waveform to the key length; calculate the "lower limit of the search range" as the ratio of the total length of the signature waveform to twice the key length;

[0017] Sun Step 2.1.2: Initialize start_point to 0, and take the waveform from start_point to the "lower limit of search range" position in the signature waveform as the initial segment;

[0018] Step 2.1.3: Determine the waveform segment within the search range of [start_point + lower limit of search range, start_point + upper limit of search range];

[0019] Sub-step 2.2: Perform sliding matching within a preset search range to find the waveform segment most similar to the initial segment, further including the following sub-steps:

[0020] Step 2.2.1: Traverse each position index i between the "lower limit of the search range" and the "upper limit of the search range";

[0021] Step 2.2.2: Starting from index i, extract a waveform segment with the same length as the initial segment;

[0022] Step 2.2.3: Calculate the correlation between the waveform segment and the initial segment, and record the current correlation value and its corresponding index i;

[0023] Step 2.2.4: Among all the traversal results, select the waveform segment with the highest relevance, and its starting index i is the best matching position.

[0024] Sub-step 2.3: Based on the waveform between the initial segment position and the optimal matching position, extract waveform template A and record the matching information, further including the following sub-steps:

[0025] Step 2.3.1: Extract the waveform between the starting position start_point of the initial segment and the best matching position i, and use it as waveform template A;

[0026] Step 2.3.2: Update start_point to the index of the best matching position;

[0027] Step 2.3.3: Add the current start_point to the preset split point array for subsequent split point recording and waveform division.

[0028] Sub-step 2.4: Calculate the threshold used for relevance assessment, further including the following grandchild steps:

[0029] Sun Step 2.4.1: Using waveform template A as a reference template, starting from the beginning of the waveform, slide backwards to extract waveform segments of the same length as template A, with the extraction range being one-tenth of the total waveform length;

[0030] Step 2.4.2: Calculate the correlation between each extracted segment and template A, and record all the maximum correlation points;

[0031] Step 2.4.3: Perform K-means cluster analysis on the above maximum points and divide them into three categories;

[0032] Step 2.4.4: Select the category to which the maximum value belongs from the clustering results, and take the correlation value in the middle position of that category as the threshold for the final correlation judgment.

[0033] Step 3: Using template A as a reference, prepare to generate template B. Extract equal-length segments from the waveform data and calculate the correlation. If the correlation exceeds a preset threshold, determine the current starting position as the splitting point. If the correlation does not reach the threshold and template B has not yet been generated, continue to use template A as a reference template, slide within the search range to find the optimal matching segment, and extract the waveform between the current starting position and template B. If template B already exists, use template B as a reference and repeat the above correlation determination. If the correlation of the matching segment exceeds the threshold, the current position is also determined as the splitting point.

[0034] Specifically, step 3 includes the following sub-steps:

[0035] Sub-step 3.1: Calculate the correlation between template A and the subsequent waveform, compare the correlation between template A and the subsequent waveform with the calculated threshold, and further include the following sub-steps:

[0036] Step 3.1.1: Starting from the current start_point, extract a waveform segment of the same length as waveform template A.

[0037] Step 3.1.2: Calculate the correlation between the cut waveform segment and template A;

[0038] Step 3.1.3: Compare the calculated correlation with the threshold obtained in step 2.4;

[0039] Step 3.1.4: If the correlation is greater than or equal to the threshold, then the position is determined to be the cutting point;

[0040] Sub-step 3.2: If template B does not exist, generate template B, which further includes the following sub-steps:

[0041] Step 3.2.1: Within the waveform interval corresponding to [start_point + lower limit of search range, start_point + upper limit of search range], using waveform template A as the reference template, traverse each position index i sequentially using a sliding window method;

[0042] Step 3.2.2: Starting from index i, extract a waveform segment of the same length as waveform template A;

[0043] Step 3.2.3: Calculate the correlation between the waveform segment and waveform template A, and record the correlation value and the corresponding index i;

[0044] Step 3.2.4: Select the waveform segment with the highest correlation from all traversal results, and use its starting index i as the optimal matching point;

[0045] Step 3.2.5: Extract the waveform interval between start_point and the optimal matching point, and use it as waveform template B.

[0046] Sub-step 3.3: If template B already exists, then use template B to continue relevance matching. The specific process is similar to sub-step 3.1, and determine whether it constitutes a split point based on the relevance.

[0047] Step 4: If a split point was determined in Step 3, update start_point to that position and store it in the split point array. If no split point is found, check if there is enough data to continue the search. If there is insufficient data, take the end of the waveform data as the last split point. If there is still enough data, use template A and template B as references to continue using the sliding matching method to determine the new best matching position, update start_point and continue iterating until the waveform data processing is complete.

[0048] Specifically, step 4 includes the following sub-steps:

[0049] Sub-step 4.1: If the split point was determined in step 3, then update start_point to that position and store it in the split point array;

[0050] Sub-step 4.2: If the splitting point is not determined in step 3, then with template A and template B as references, continue to perform sliding matching operation in [start_point + lower limit of search range, start_point + upper limit of search range]. Traverse each i in the search range, take i as the starting point, take waveform segments of the same length as the template to calculate the correlation, find the starting point i of the waveform segment with the highest correlation, determine it as the new best matching position, and update start_point to this position.

[0051] Sub-step 4.3: Repeat steps 3 and 4 until all waveform data has been processed.

[0052] Beneficial effects

[0053] The method of the present invention has the following advantages compared with the prior art:

[0054] 1. Compared with traditional simple energy analysis waveform segmentation methods, the method proposed in this invention does not rely on human experience, and is highly flexible and versatile.

[0055] 2. Compared with existing automated segmentation methods, the method proposed in this invention has significantly reduced time complexity and lower computational overhead during runtime.

[0056] 3. This method can achieve efficient and accurate waveform segmentation without manual intervention, provided that the start and end points of the algorithm and the key length are known, while also taking into account both automation and practical application performance. Attached Figure Description

[0057] Figure 1 is a flow chart of the present invention;

[0058] Figure 2 This is a side-channel waveform acquired when running the RSA algorithm on an STM32F429 development board, as provided in an embodiment of the present invention, and the waveform diagram after data preprocessing.

[0059] Figure 3 This is a partial enlarged view of the RSA algorithm side channel waveform provided in the embodiment of the present invention;

[0060] Figure 4 This is a schematic diagram of the initial waveform segment calculated according to an embodiment of the present invention;

[0061] Figure 5 This is a schematic diagram of a waveform segment of template A provided in an embodiment of the present invention;

[0062] Figure 6 This is a schematic diagram of a waveform segment of template B provided in an embodiment of the present invention;

[0063] Figure 7 This is a schematic diagram of RSA waveform segmentation provided in an embodiment of the present invention.

[0064] Detailed implementation methods and examples

[0065] To better illustrate the purpose and advantages of this invention, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be noted that the embodiments and examples are merely illustrative and do not constitute any limitation on the invention.

[0066] Refer to the attached diagram in the specification for an automated waveform segmentation method for cryptographic side channels based on template matching.

[0067] In this embodiment, side-channel waveform data collected while running the RSA algorithm on the STM32F429 development board is selected as the research object. For example... Figure 1 The flowchart of the experiment is shown in the figure.

[0068] According to step 1 of the present invention, the starting position of the algorithm is first determined, the corresponding waveform is extracted, and after low-pass filtering and resampling, the waveform is obtained as shown below. Figure 2 The waveform shown is the waveform used for subsequent segmentation. Figure 3 This is a magnified preview of the waveform.

[0069] According to step 2 of the present invention, the length of the initial segment and the size of the search range are first determined. The total length of the signature waveform is L, the key length is 1024 bits, the "upper limit of the search range" is calculated as longest = L / 1024, the "lower limit of the search range" is calculated as shortest = L / (2*1024), the start_point is initialized to 0, and the preset search range is [start_point+shortest, start_point+longest]. The initial segment is a waveform segment between [0, shortest], such as... Figure 4 As shown. Within a preset search range, each horizontal coordinate i is traversed. Starting from i, a segment of the same length as the initial segment is extracted. The correlation between this segment and the initial segment is analyzed. The start_point is updated to the starting point corresponding to the segment with the highest correlation to the initial segment, and then added to the segmentation point array. Template A contains waveform data between [0, start_point], as shown... Figure 5 As shown. Using waveform template A as a reference template, starting from the beginning of the waveform, waveform segments of the same length as template A are sequentially slid backward, with the slicing range being one-tenth of the total waveform length. The correlation between each slice and template A is calculated, and all correlation maxima are recorded. K-means clustering analysis is performed on these maxima, dividing them into three categories. From the clustering results, the category to which the maximum value belongs is selected, and the correlation value in the middle position of that category is taken as the final correlation threshold. In this embodiment, the threshold is 0.55.

[0070] According to step 3 of the present invention, a waveform segment of the same length as template A is extracted starting from start_point, and its correlation with template A is calculated. If the correlation is greater than threshold, the end point of the extracted segment is determined as the split point; if the correlation is less than threshold and template B has not yet been generated, each position i is traversed within the range [start_point + shortest, start_point + longest], and a waveform segment of the same length as waveform template A is extracted starting from i. Its correlation with template A is calculated, and the starting point of the waveform segment with the highest correlation is recorded as the best matching point. Template B is the waveform segment between [start_point, best matching point], such as... Figure 6 As shown; if the correlation is less than the threshold and template B already exists, take the start_point as the starting point to extract a waveform segment of the same length as template B, calculate its correlation with template B, and if the correlation is greater than the threshold, then determine the end point of the extracted segment as the cutting point.

[0071] According to step 4 of the present invention, if the splitting point is determined in step 3, then start_point is updated to that position and stored in the splitting point array; if the splitting point is not determined in step 3, then with template A and template B as references, the sliding matching operation is continued in [start_point+shortest,start_point+longest], traversing each i in the search range, taking i as the starting point, taking waveform segments of the same length as the template to calculate the correlation, finding the starting point i of the waveform segment with the highest correlation, determining it as the new best matching position, and updating start_point to that position; step 3 and step 4 are executed repeatedly until all waveform data is processed.

[0072] The waveform segmentation result is illustrated as follows: Figure 7 As shown, the above process takes 7.7 seconds to run and has a 100% accuracy rate in segmentation.

[0073] In recent existing technologies, a reinforcement learning-based waveform segmentation method took 29 minutes to complete a correct segmentation in 2024, while the method of this invention only requires 7.7 seconds. This invention significantly improves segmentation efficiency while maintaining 100% accuracy.

[0074] The present invention has been described in detail above through embodiments. It should be noted that the above embodiments are merely preferred embodiments of the present invention and not all embodiments of the present invention, nor do they constitute any limitation on the scope of protection of the present invention. The scope of protection of the present invention is determined by the claims of this application. Any technical solutions or embodiments obtained by those skilled in the art through equivalent substitutions or other modifications to the technical features of the present invention without departing from the spirit and essence of the present invention fall within the scope of protection of the present invention.

Claims

1. A method for automated waveform segmentation in a cryptographic side channel based on template matching, characterized in that, The method includes the following steps: Step 1: Obtain the side-channel waveform during the public-key cryptography algorithm signing process, determine the start and end positions of the signature, and extract the corresponding signature process waveform data accordingly; Step 2: Select an initial segment from the signature waveform as a reference template, slide the search within a preset search range to find the waveform segment most similar to the initial segment, and take its starting position as the best matching position. Based on the waveform between the initial segment position and the best matching position, extract the waveform template A. At the same time, record the index of the best matching position as start_point and store it in the segmentation point array, and calculate the threshold. The length of the reference template and the size of the search range are determined based on the total length of the signature waveform and the key length, which is given in advance. Step 3: Using template A as a reference, prepare to generate template B. Extract equal-length segments from the waveform data and calculate the correlation. If the correlation exceeds a preset threshold, determine the current starting position as the splitting point. If the correlation does not reach the threshold and template B has not yet been generated, continue to use template A as a reference template, slide within the search range to find the optimal matching segment, and extract the waveform between the current starting position and template B. If template B already exists, use template B as a reference and repeat the above correlation determination. If the correlation of the matching segment exceeds the threshold, the current position is also determined as the splitting point. Step 4: If a split point was determined in Step 3, update start_point to that position and store it in the split point array; if no split point was found, check if there is enough data to continue the search; if there is insufficient data, directly use the end of the waveform data as the last split point; if there is still sufficient data, use template A and template B as references respectively, continue to use the sliding matching method to determine the new best matching position, update start_point and continue iterating until the waveform data processing is completed.

2. The automated waveform segmentation method for cryptographic side-channel based on template matching as described in claim 1, characterized in that, Step 1 includes the following sub-steps: Sub-step 1.1: Obtain the side-channel waveform during the public-key cryptography algorithm signature process, determine the start and end positions of the signature, and determine the signature algorithm waveform based on the horizontal coordinates of the start and end positions; Sub-step 1.2: Preprocess the noise in the signature algorithm waveform obtained in step 1.

1. Preprocessing methods include filtering, resampling, etc.

3. The automated waveform segmentation method for cryptographic side-channel based on template matching as described in claim 2, characterized in that, Step 2 includes the following sub-steps: Sub-step 2.1: Determine the initial segment length and search range based on the total length of the signature waveform and the key length; Sub-step 2.2: Perform sliding matching within the preset search range to find the waveform segment most similar to the initial segment; Sub-step 2.3: Based on the waveform between the initial segment position and the best matching position, extract waveform template A and record the matching information; Sub-step 2.4: Calculate the threshold used for correlation judgment.

4. The automated waveform segmentation method for cryptographic side-channel based on template matching as described in claim 3, characterized in that, Sub-step 2.1 further includes the following grandchild steps: Sun's step 2.1.1: Calculate the "upper limit of the search range" as the ratio of the total length of the signature waveform to the key length; calculate the "lower limit of the search range" as the ratio of the total length of the signature waveform to twice the key length; Sun Step 2.1.2: Initialize start_point to 0, and take the waveform from start_point to the "lower limit of search range" position in the signature waveform as the initial segment; Step 2.1.3: Determine the waveform segment within the search range of [start_point + lower limit of search range, start_point + upper limit of search range]; Sub-step 2.2 further includes the following grandchild steps: Step 2.2.1: Traverse each position index i between the "lower limit of the search range" and the "upper limit of the search range"; Step 2.2.2: Starting from index i, extract a waveform segment with the same length as the initial segment; Step 2.2.3: Calculate the correlation between the waveform segment and the initial segment, and record the current correlation value and its corresponding index i; Step 2.2.4: Among all the traversal results, select the waveform segment with the highest relevance, and its starting index i is the best matching position. Sub-step 2.3 further includes the following grandchild steps: Step 2.3.1: Extract the waveform between the starting position start_point of the initial segment and the best matching position i, and use it as waveform template A; Step 2.3.2: Update start_point to the index of the best matching position; Step 2.3.3: Add the current start_point to the preset split point array for subsequent split point recording and waveform division; Sub-step 2.4 further includes the following grandchild steps: Sun Step 2.4.1: Using waveform template A as a reference template, starting from the beginning of the waveform, slide backwards to extract waveform segments of the same length as template A, with the extraction range being one-tenth of the total waveform length; Step 2.4.2: Calculate the correlation between each extracted segment and template A, and record all the maximum correlation points; Step 2.4.3: Perform K-means cluster analysis on the above maximum points and divide them into three categories; Step 2.4.4: Select the category to which the maximum value belongs from the clustering results, and take the correlation value in the middle position of that category as the threshold for the final correlation judgment.

5. The automated waveform segmentation method for cryptographic side-channel based on template matching as described in claim 4, characterized in that, Step 3 includes the following sub-steps: Sub-step 3.1: Calculate the correlation between template A and subsequent waveforms, and compare the correlation between template A and subsequent waveforms with the calculated threshold; Sub-step 3.2: If template B does not exist, generate template B; Sub-step 3.3: If template B already exists, then use template B to continue relevance matching. The specific process is similar to sub-step 3.1, and determine whether it constitutes a split point based on the relevance.

6. The automated waveform segmentation method for cryptographic side-channels based on template matching as described in claim 5, characterized in that, Sub-step 3.1 further includes the following grandchild steps: Step 3.1.1: Starting from the current start_point, extract a waveform segment of the same length as waveform template A. Step 3.1.2: Calculate the correlation between the cut waveform segment and template A; Step 3.1.3: Compare the calculated correlation with the threshold obtained in step 2.4; Step 3.1.4: If the correlation is greater than or equal to the threshold, then the position is determined to be the cutting point; Sub-step 3.2 further includes the following grandchild steps: Step 3.2.1: Within the waveform interval corresponding to [start_point + lower limit of search range, start_point + upper limit of search range], using waveform template A as the reference template, traverse each position index i sequentially using a sliding window method; Step 3.2.2: Starting from index i, extract a waveform segment of the same length as waveform template A; Step 3.2.3: Calculate the correlation between the waveform segment and waveform template A, and record the correlation value and the corresponding index i; Step 3.2.4: Select the waveform segment with the highest correlation from all traversal results, and use its starting index i as the optimal matching point; Step 3.2.5: Extract the waveform interval between start_point and the optimal matching point, and use it as waveform template B.

7. The method for automated waveform segmentation of a cryptographic side channel based on template matching as described in claim 6, characterized in that, Step 4 includes the following sub-steps: Sub-step 4.1: If step 3 has determined the split point, then update start_point to that position and store it in the split point array; Sub-step 4.2: If the splitting point is not determined in step 3, then with template A and template B as references, continue to perform sliding matching operation in [start_point + lower limit of search range, start_point + upper limit of search range]. Traverse each i in the search range, take i as the starting point, take waveform segments of the same length as the template to calculate the correlation, find the starting point i of the waveform segment with the highest correlation, determine it as the new best matching position, and update start_point to this position. Sub-step 4.3: Repeat steps 3 and 4 until all waveform data has been processed.