A feature point extraction method based on temporal template matching
Through the feature point extraction method based on time template matching, the problem of too many electromagnetic sampling points in the dual-interface smart card is solved, and efficient side channel analysis is achieved, with low time complexity, high accuracy and extremely high confidence level.
Patent Information
- Application Number
- CN202410584209.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-11
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-05-11
AI Technical Summary
In dual-interface smart cards, the prior art is difficult to effectively reduce the number of sampling points in the electromagnetic track, resulting in poor side channel analysis technology.
The feature point extraction method based on time template matching is adopted. Through block variance processing, digital-to-analog conversion, de-jitter processing, Gaussian fuzzing processing and other steps, POIs are extracted and clustered and time template matching is performed, which significantly reduces the number of sample points.
Under the premise of retaining POIs, the number of sampling points in the electromagnetic track is significantly reduced, and the effect of side channel analysis technology is improved. The time complexity is low, the extraction ratio is high, the accuracy is high, and the confidence level is more than 99.999%.
Smart Images

Figure CN118551233B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of information security, and in particular relates to a feature point extraction method based on time template matching. Background Art
[0002] Dual-interface smart card is a powerful and widely used smart card with standard specifications and micro integrated circuit chips such as microprocessor and memory. It has metal contacts and radio frequency interfaces, and has the communication functions of contact cards and contactless cards, and can interact with a variety of terminal devices. With its wide range of applications and excellent security performance, dual-interface smart cards have become an important part of today's smart card technology, providing a reliable solution for secure interaction in all walks of life.
[0003] ECDSA is based on the discrete logarithm problem on elliptic curves and uses point operations on elliptic curves to implement secure encryption and signature mechanisms. Miller proposed the use of elliptic curves in encryption in 1985, and the National Institute of Standards and Technology of the United States included ECDSA in the FIPS standard in 2000. It is widely used in the field of information security to verify data integrity and identity authentication. The advantage of ECDSA over the RSA algorithm is that the key can be smaller, thereby increasing speed and enhancing security.
[0004] Although the algorithm is theoretically secure enough, the implementation of the cryptographic algorithm in the actual cryptographic hardware unit may still be threatened by physical analysis. In actual applications, the cryptographic chip will have certain specific physical characteristics when running, and these characteristics will leak the internal state. Analysts can use this information to leak and decipher the secret information inside the cryptographic system, and even decipher some secret algorithms or cryptographic structures inside the cryptographic system, thus posing a great threat to the actual security of the cryptographic system.
[0005] In order to cope with this threat and improve the security of cryptographic hardware units, mainstream standardization organizations and cryptographic evaluation departments at home and abroad have put forward specific security requirements and side-channel analysis processes. For example, the US FIPS 140-3 standard and ISO / IEC 19790 international standard set the security of hardware units under side-channel attacks as an important requirement. The "Security Chip Cryptography Testing Guidelines" GM / T0008-2012, "Cryptographic Module Security Technical Requirements" MG / T 0028-2014, and "Cryptographic Module Non-Intrusive Attack Mitigation Technical Guidelines" GM / T 0083-2020 formulated by the China National Cryptography Administration clearly stipulate that cryptographic modules must have security protection capabilities against typical side-channel attacks (such as energy analysis attacks, electromagnetic analysis attacks, and timing attacks).
[0006] Preprocessing can improve the effectiveness of side channel analysis techniques by excluding information irrelevant to sensitive intermediate values and retaining POIs. After reducing the number of sampling points of the electromagnetic trace, analysts can use accurate but time-consuming tools to recover sensitive intermediate values. Preprocessing is particularly important before conducting side channel attacks on public key cryptographic algorithms such as ECDSA. Summary of the invention
[0007] The purpose of the present invention is to significantly reduce the number of sampling points in electromagnetic traces while retaining POIs and improve the technical effect of side channel analysis. The present invention proposes a feature point extraction method based on time template matching. The time complexity of the present application is low, the extraction ratio is high, and the algorithm has a very high probability of extracting POIs at locations where POIs theoretically exist; the accuracy is high, and the confidence level that the extracted sampling points contain leakage related to sensitive intermediate values exceeds 99.999%.
[0008] Technical solution: In order to solve the above technical problems, the technical solution adopted by the present invention is as follows:
[0009] A feature point extraction method based on time template matching includes performing block variance processing on collected electromagnetic traces; performing digital-to-analog conversion processing and de-jitter processing on the electromagnetic traces after the block variance processing; performing Gaussian blur processing on the electromagnetic traces after the de-jitter processing, and performing digital-to-analog conversion processing and de-jitter processing again after the Gaussian blur is completed; intercepting sampling points from the electromagnetic traces to mark POIs; clustering POIs using the marking results and performing extreme point processing; and performing time template matching processing according to the POI time template and the number of categories.
[0010] As a preferred embodiment, the specific contents of performing block variance processing on the collected electromagnetic traces are as follows:
[0011] S11: Select the public key cryptographic algorithm in the smart card and collect the electromagnetic traces during the operation process, determine the number of iterations D and the number of electromagnetic trace sampling points N1 collected containing sensitive information leakage, and select a reasonable block size wd based on the electromagnetic traces;
[0012] S12: considering the electromagnetic trace as a sequence SEQ1, and dividing the sequence SEQ1 into sampling points according to the block size wd;
[0013] Divide into multiple groups containing wd sampling points, and discard the remaining sampling points that are less than wd;
[0014] S13: Calculate the variance of each group of number sequences divided in S12, and arrange the variance of each group of number sequences in sequence to obtain the number sequence SEQ2.
[0015] As a preferred embodiment, the specific contents of performing digital-to-analog conversion and dithering processing on the electromagnetic trace after the block variance processing are as follows:
[0016] S21: Setting a reasonable analog-to-digital conversion threshold th1 to perform a first analog-to-digital conversion on the sequence SEQ2 to obtain a sequence SEQ3, and performing a first de-jittering on the sequence SEQ3 to obtain a sequence SEQ4;
[0017] Among them, assuming that the minimum values of the variance of the manually labeled blocks containing POIs and excluding POIs are m1 and m2 respectively, then the value of th1 is [m1+(m2-m1)*0.6,m1+(m2-m1)*0.9];
[0018] A reasonable de-jittering window size wa1 is set to de-jitter the sequence SEQ3.
[0019] As a preferred embodiment, Gaussian blur processing is performed on the electromagnetic trace after the de-jitter processing. After the Gaussian blur is completed, the specific contents of the digital-to-analog conversion processing and the de-jitter processing are performed again:
[0020] S31: Set a reasonable binomial distribution convolution kernel size, and generate a convolution kernel K based on the binomial distribution convolution kernel size;
[0021] S32: Calculate the convolution of the sequence SEQ4 and the convolution kernel K to obtain the sequence SEQ5;
[0022] S33: Setting a reasonable analog-to-digital conversion threshold th2 to perform a second analog-to-digital conversion on the number sequence SEQ5 to obtain the number sequence SEQ6, and performing a second de-jittering on the number sequence SEQ6 to obtain the number sequence SEQ7.
[0023] As a preferred embodiment, the specific contents of extracting sampling points from electromagnetic traces for POIs marking are as follows:
[0024] S41: Consider the sequence SEQ7 as a sampling signal of a square wave, calculate the coordinates of all falling edges, and fill these coordinates into the sequence SEQ8 in sequence;
[0025] S42: selecting a period f, a period offset phi, a sampling point coordinate offset off and a sampling point width N9 according to the number sequences SEQ1 and SEQ8;
[0026] S43: intercepting multiple sampling points in SEQ8 from the electromagnetic trace to generate an electromagnetic sub-trace, selecting the number of categories C of POIs abscissa clustering according to the electromagnetic sub-trace, manually selecting the electromagnetic sub-trace, and marking its POIs;
[0027] S44: Using the annotation results, generate a de-averaged POI electromagnetic template Tem that the POIs should match by an averaging method.
[0028] As a preferred method, the specific contents of clustering POIs using the annotation results and taking extreme points are as follows:
[0029] S51: clustering POIs using the annotation results, for the electromagnetic sub-traces that are not manually annotated, the electromagnetic sub-traces are regarded as the sequence SEQ9, and the convolution of SEQ9 and the POI electromagnetic template Tem is calculated to obtain the sequence SEQ10;
[0030] The convolution formula for calculating SEQ10 can be expressed as:
[0031]
[0032] Among them, hl represents half of the data dimension of the POI electromagnetic template Tem;
[0033] S52: Determine the number of extreme value points N11 to be extracted and the neighborhood range B, and extract N11 extreme value points from the sequence SEQ10 to obtain the sequence SEQ11;
[0034] SEQ11 is initialized to an empty set; the values in SEQ10 are enumerated in descending order of absolute value and the corresponding indexes are calculated. If the absolute value of the difference between the index and any element in SEQ10 is greater than the set neighborhood range B, the index is appended to SEQ11; if the number of elements in SEQ11 reaches the set N11 or the values in SEQ10 have been enumerated, the enumeration stops and the current SEQ11 is output.
[0035] As a preferred embodiment, the specific content of the time template matching process according to the POI time template and the number of categories is as follows:
[0036] S61: according to the POI time template Tt and the number of categories C, extract C extreme point combinations that best match the time template from the sequence SEQ11, and sort them from small to large to obtain the sequence SEQ12;
[0037] Enumerate all subsets of SEQ11 with C as the number of elements. Let the currently enumerated subset be A. Let the smallest element in subset A be a0, the second smallest element be a1, ... the largest element be a C-1 ; If for any 0≤i<j<C, a j -a i and the mean μ of the time template Tt i,j The absolute value of the difference is less than the standard deviation σ of the time template Tt i,j 3 times, then the template matches successfully, let SEQ12 = [a0, a1, a2, ..., a C-1 ] and stop subsequent enumeration; otherwise, enumerate the next subset with C elements to continue trying template matching; if all subsets are enumerated and still no match is successful, then set SEQ12 to an empty set.
[0038] Preferably, after extracting the feature points, the specific content of verifying the extracted sampling points is as follows: Verify using TVLA, and the TVLA calculation process is as follows:
[0039]
[0040] Among them, A and B respectively represent two groups of electromagnetic trace sampling points with the same corresponding median value. respectively represent the sample means of the sampling points. respectively represent the sample variances of the sampling points, n A , n B respectively represent the sample sizes of the sampling points.
[0041] Beneficial effects: Compared with the prior art, the present invention has the following advantages:
[0042] (1) The present invention has a low time complexity. After accurately setting the parameters, the algorithm has a linear time complexity. After obtaining reasonable parameters and pre-computing the template, the time complexity of extracting all POIs in an electromagnetic trace is O(N1), O(N1), O(N2), O(N3), O(N4*wg), O(N5), O(N6), O(D*N9), O(D*N9*logN9), O(D*N11 C ), and the time of other steps is either constant or linear time complexity, which does not affect the complexity analysis. In practice, only by ensuring D*N9*logN9 < N1, D*N11 C < N1 can make the time complexity of POIs extraction reach linear time complexity.
[0043] (2) The present invention has a high extraction ratio. Theoretically, an electromagnetic trace will process D electromagnetic sub-traces, and the POIs of each electromagnetic sub-trace are located in C non-overlapping intervals with a width of 2*hl. Each electromagnetic trace has a probability of less than 1% of still not finding all the intervals containing POIs after applying the feature point extraction technology based on time template matching.
[0044] (3) The present invention has a high accuracy. For a total of 1000 POIs with the same corresponding median values extracted in two groups, performing TVLA, and the extreme value exceeds 4.5, indicating that the confidence level that the extracted sampling points contain leakage related to the sensitive median value exceeds 99.999%.
[0045] (4) The extraction method of the present invention includes range determination based on block variance and extraction based on time template. Among them, the range determination technology based on block variance will narrow the possible range of POIs and reduce the data scale of subsequent operations while retaining POIs; the extraction method based on time template further determines the abscissa of POIs under the condition of reduced data scale, thereby completing the extraction of POIs. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a schematic diagram of manually annotated information leakage positions of a feature point extraction method based on time template matching of the present invention;
[0047] Figure 2 It is a schematic diagram of the electromagnetic template Tem after averaging of the feature point extraction method based on time template matching of the present invention;
[0048] Figure 3 It is a schematic diagram of calculating the cluster center coordinate difference of each electromagnetic sub-trace in the feature point extraction method based on time template matching of the present invention;
[0049] Figure 4 It is a schematic diagram of the verification results of the feature point extraction method based on time template matching of the present invention. DETAILED DESCRIPTION
[0050] The present invention is further illustrated below in conjunction with specific examples. The examples are implemented based on the technical solutions of the present invention. It should be understood that these examples are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0051] The feature point (POI) extraction method based on time template matching provided by this application can pre-process the electromagnetic traces collected during the operation of the dual-interface commercial smart chip card, and can significantly reduce the number of sampling points in the electromagnetic traces while retaining POIs. Researchers can use this application to efficiently pre-process the electromagnetic traces collected during the operation of the elliptic curve digital signature algorithm (ECDSA) of the NXP chip in the JCOP Card J3D081 dual-interface commercial smart card, reducing the amount of calculation required for the attack.
[0052] The present invention comprises the following steps: performing block variance processing on the collected electromagnetic traces; performing digital-to-analog conversion processing and de-jitter processing on the electromagnetic traces after the block variance processing; performing Gaussian blur processing on the electromagnetic traces after the de-jitter processing, and performing digital-to-analog conversion processing and de-jitter processing again after the Gaussian blur is completed; intercepting sampling points from the electromagnetic traces to mark POIs; clustering POIs using the marking results to perform extreme point processing; and performing time template matching processing according to the POI time template and the number of categories.
[0053] like Figure 1 As shown, the feature point extraction method based on time template matching provided by this application has the following specific implementation steps:
[0054] S1: Perform block variance processing on the collected electromagnetic traces, specifically:
[0055] S11: Select the public key cryptographic algorithm in the smart card and collect the electromagnetic traces during the operation process, determine the number of iterations D and the number of electromagnetic trace sampling points N1 collected containing sensitive information leakage, and select a reasonable block size wd based on the electromagnetic traces;
[0056] In this embodiment, the number of iterations D including sensitive information leakage is 30, the number of electromagnetic trace sampling points N1 is 50,000,000, and the block size wd is 360. The same block size is used in the preprocessing process of each electromagnetic trace.
[0057] S12: considering the electromagnetic trace as a sequence SEQ1, and dividing the sequence SEQ1 into sampling points according to the block size wd;
[0058] Divide into N2 groups containing wd sampling points, and discard the remaining sampling points that are less than wd;
[0059] Wherein, N2=N1 / wd, N1 represents the length of sequence SEQ1;
[0060] S13: Calculate the variance of each group of number sequences divided in S12, and arrange the variance of each group of number sequences in sequence to obtain a new number sequence SEQ2.
[0061] The length of SEQ2 is N2. The process of block division and variance calculation is shown in Table 1:
[0062] Table 1 Block variance processing
[0063]
[0064]
[0065] S2: The specific contents of the digital-to-analog conversion and dithering processing of the electromagnetic trace after the block variance processing are as follows:
[0066] S21: Setting a reasonable analog-to-digital conversion threshold th1 to perform a first analog-to-digital conversion on the sequence SEQ2 to obtain a sequence SEQ3, and performing a first de-jittering on the sequence SEQ3 to obtain a sequence SEQ4;
[0067] In this embodiment, the same threshold is used in the preprocessing process of each electromagnetic trace; the length of SEQ3 is recorded as N3, and N3=N2.
[0068] The analog-to-digital conversion threshold th1 needs to be determined based on the variance of the manually labeled blocks containing POIs and excluding POIs. Assuming that the minimum values of the variance of the manually labeled blocks containing POIs and excluding POIs are m1 and m2 respectively, then the value of th1 should be [m1+(m2-m1)*0.6, m1+(m2-m1)*0.9].
[0069] In this embodiment, the value of th1 is 50; the process of (first) analog-to-digital conversion is shown in Table 2:
[0070] Table 2 (First) analog-to-digital conversion processing
[0071]
[0072] The analog-to-digital conversion enumerates the numbers in SEQ2 in turn, checks the size relationship between it and th1, and fills 0 in the corresponding position of SEQ3 if it is less than 0, otherwise fills 1. For example, when the input sequence is SEQ2 = [0.0, 1.5, 1.0, 2.0, 1.5, 0.9], N2 = 6, and th1 = 1.3, the analog-to-digital conversion will output SEQ3 = [0, 1, 0, 1, 1, 0].
[0073] Set a reasonable de-jitter window size wa1 to de-jitter the sequence SEQ3;
[0074] In this embodiment, the same de-jitter window size is used in the pre-processing process of each electromagnetic trace; the length of SEQ4 is recorded as N4, and N4=N3.
[0075] The de-jittering process is shown in Table 3:
[0076] Table 3 (First time) de-jittering process
[0077]
[0078] The window is a sequence of length wa1, and the initial value is 0 (in the algorithm, the window is compressed into a number b for representation). When a number is added to the window, that number will be appended to the rightmost (last), and the window will delete the leftmost (front) number to maintain the length of wa1. De-jittering adds the numbers in SEQ3 to the window one by one. Each time a number in SEQ3 is taken out and added to the window, it checks whether all the numbers in the window are equal. If all the numbers in the window are 1, then the state s is set to 1; if all the numbers in the window are 0, then the state s is set to 0; if the numbers in the window are neither all 1 nor all 0, then the state s remains unchanged. Then, fill the value of state s into the corresponding position of SEQ4.
[0079] For example, when SEQ3=[0,1,0,1,1,0], N3=6, wa1=2. Then the contents of the window are [0,0] (this is the state after adding SEQ30), [0,1] (this is the state after adding SEQ31), [1,0], [0,1], [1,1], [1,0]. Therefore, the values of s are 0 (this is the state after adding SEQ30), 0 (this is the state after adding SEQ31), 0, 0, 1, 1. Therefore, the output result of de-jittering is SEQ4=[0,0,0,0,1,1].
[0080] S3: Gaussian blur processing is performed on the electromagnetic trace after the de-jitter processing. After the Gaussian blur is completed, the specific contents of the digital-to-analog conversion processing and de-jitter processing are performed again:
[0081] S31: Set and select a reasonable binomial distribution convolution kernel size, and generate the convolution kernel K according to the binomial distribution convolution kernel size (2wg+1);
[0082] S32: Calculate the convolution of the sequence SEQ4 and the convolution kernel K to obtain the sequence SEQ5;
[0083] The calculation formula of SEQ5 is:
[0084]
[0085] In this embodiment, the same binomial distribution convolution kernel size is used in the preprocessing process of each electromagnetic trace; the length of the sequence SEQ5 is N5, and the value of wg is 300; the binomial distribution convolution kernel size (2wg+1) is preferably set to not exceed wd.
[0086] The process of Gaussian blurring is shown in Table 4, and the convolution uses the same mode.
[0087] Table 4 Gaussian blur processing
[0088]
[0089] For example, when SEQ4 = [0,0,0,0,1,1], N4 = 6, wg = 1, the algorithm will calculate the number of combinations of 2 to 0, 2 to 1, and 2 to 2, that is, [c0, c1, c2] = [1, 2, 1]. The algorithm can then calculate the convolution kernel K = [0.25, 0.5, 0.25].
[0090] When the convolution uses the same mode, the fourth line of the algorithm will sequentially calculate the inner product of [0,0,0] and K (corresponding items are multiplied and summed), the inner product of [0,0,0] and K, the inner product of [0,0,0] and K, the inner product of [0,0,1] and K, the inner product of [0,1,1] and K, and the inner product of [1,1,0] and K. Therefore, the output is SEQ5 = [0,0,0,0.25,0.75,0.75].
[0091] In this embodiment, if the convolution uses the same mode, then N5=N4; if the convolution uses the valid mode, then N5=N4-wg; if the convolution uses the full mode, then N5=N4+wg.
[0092] S33: Setting a reasonable analog-to-digital conversion threshold th2 to perform a second analog-to-digital conversion on the number sequence SEQ5 to obtain the number sequence SEQ6, and performing a second de-jittering on the number sequence SEQ6 to obtain the number sequence SEQ7.
[0093] In this embodiment, the same threshold is used in the preprocessing process of each electromagnetic trace; the length of SEQ6 is recorded as N6, N6=N5, and the analog-to-digital conversion threshold th2 is preferably set in [0.5, 0.9].
[0094] In this embodiment, the value of th2 is 0.5, and the process of the second analog-to-digital conversion is shown in Table 5:
[0095] Table 5 (Second) analog-to-digital conversion processing
[0096]
[0097] The analog-to-digital conversion enumerates the numbers in SEQ5 in turn, checks its size relationship with th2, and if it is less than th2, fills 0 in the corresponding position of SEQ6, otherwise fills 1.
[0098] For example, when the input sequence is SEQ5 = [0.0, 1.5, 1.0, 2.0, 1.5, 0.9], N5 = 6, and th2 = 1.3, the analog-to-digital conversion will output SEQ6 = [0, 1, 0, 1, 1, 0].
[0099] Set a reasonable de-jitter window size wa2 to de-jitter the sequence SEQ6;
[0100] In this embodiment, the same de-jitter window size is used in the pre-processing process of each electromagnetic trace; the length of SEQ7 is recorded as N7, N7=N6, and wa2 is 25. The (second) de-jitter process is shown in Table 6:
[0101] Table 6 (Second) Debounce Processing
[0102]
[0103]
[0104] The window is a sequence of numbers with a length of wa2, and the initial value is 0 (in the algorithm, the window is compressed into a number b for representation). When a number is added to the window, that number will be appended to the rightmost (last), and the window will delete the leftmost (first) number to maintain the length of wa2. De-bounce adds the numbers in SEQ6 to the window one by one. Each time a number in SEQ6 is taken out and added to the window, it checks whether all the numbers in the window are equal. If all the numbers in the window are 1, then the state s is set to 1; if all the numbers in the window are 0, then the state s is set to 0; if the numbers in the window are neither all 1 nor all 0, then the state s remains unchanged. Then, fill the value of state s into the corresponding position of SEQ7. For example, when SEQ6 = [0,1,0,1,1,0], N6 = 6, wa2 = 2. Then the contents of the window are [0,0] (this is the state after adding SEQ60), [0,1] (this is the state after adding SEQ61), [1,0], [0,1], [1,1], [1,0]. Therefore, the values of s are 0 (this is the state after adding SEQ60), 0 (this is the state after adding SEQ61), 0, 0, 1, 1. Therefore, the output result of de-jittering is SEQ7 = [0,0,0,0,1,1].
[0105] S4: The specific contents of extracting sampling points from electromagnetic traces for POIs annotation are as follows:
[0106] S41: Consider the sequence SEQ7 as a sampling signal of a square wave, calculate the coordinates of all falling edges, and fill these coordinates into the sequence SEQ8 in sequence;
[0107] In this embodiment, SEQ8 is a sequence with a length of N8=242.
[0108] S42: selecting a period f, a period offset phi, a sampling point coordinate offset off, and a sampling point width N9 according to the number sequences SEQ1 and SEQ8;
[0109] The same period, period offset, sampling point coordinate offset and sampling point width are used in the preprocessing process of each electromagnetic trace. In this embodiment, the value of the period f is 8, the value of the period offset phi is 2, the value of the sampling point coordinate offset off is -98000, and the value of the sampling point width N9 is 18000.
[0110] In S52, the rationality of th1, wa1, (2wg+1), th2, and wa2 will be checked uniformly.
[0111] if:
[0112] If all values in SEQ7 are 1, resulting in N8 = 0, then it is necessary to increase th1 or th2, or decrease wa1;
[0113] If all values in SEQ7 are 0, resulting in N8 = 0, then it is necessary to decrease th1 or th2, or decrease wa1;
[0114] If SEQ8 has no obvious period f, then it is necessary to increase wa1;
[0115] If there is an obvious period f after excluding a small amount of data in SEQ8, then increase wa2 or increase th2;
[0116] If there is an obvious period f after adding a small amount of data to SEQ8, then decrease wa2 or decrease th2.
[0117] After the parameters th1, wa1, (2wg + 1), th2, and wa2 are reasonable, execute the steps after S52; otherwise, start over from the step where the parameters are adjusted.
[0118] S43: Intercept multiple sampling points in SEQ8 from the electromagnetic trace to generate an electromagnetic sub - trace. Select the number of categories C for clustering the abscissas of POIs based on the electromagnetic sub - trace. Manually select the electromagnetic sub - trace and label its POIs;
[0119] Intercept the sampling points from SEQ8[i*f + phi]*wd + off to SEQ8[i*f + phi]*wd + off + N9 (excluding) in sequence from the electromagnetic trace to generate an electromagnetic sub - trace.
[0120] Where SEQ8[x] represents the x - th number in the sequence SEQ8. When the parameters are reasonable, for any 0 <= i < D, the POIs must be within the interval [SEQ8[i*f + phi]*wd + off, SEQ8[i*f + phi]*wd + off + N9). Each electromagnetic trace can generate D electromagnetic sub - traces, and the number of sampling points for each electromagnetic sub - trace is N9. N electromagnetic traces can generate a total of N*D electromagnetic sub - traces, and i represents the order of the electromagnetic sub - trace in the electromagnetic trace.
[0121] Select the number of categories C for clustering the abscissas of POIs based on the electromagnetic sub - trace. Manually select (100) electromagnetic sub - traces and label their POIs.
[0122] The same number of categories is used in the pre - processing of each electromagnetic sub - trace. The number of categories C for clustering the abscissas of POIs needs to be determined according to the characteristics of the algorithm implementation itself. In actual applications, the POIs can be manually labeled and the value of C can be determined.
[0123] In this embodiment, the value of the number of categories C is 5.
[0124] In this embodiment, the manual annotation results are as follows: Figure 1 As shown, the yellow broken line represents the electromagnetic sub-trace, and the manually annotated POIs are all within the range represented by the blue strip.
[0125] S44: using the annotation results, generating a POI electromagnetic template Tem after removing the mean that the POIs should match by an averaging method;
[0126] For example, the coordinates of three POIs are manually marked, and the corresponding segments can be intercepted from the electromagnetic trace. Further assume that the waveforms corresponding to these three segments can be represented by the following series: [1,2,3,6,9], [5,4,3,3,3], [3,3,3,3,3]. The mean of these three series is [3,3,3,4,5]. The average value is further obtained to be 3.6, so the series after removing the mean becomes [-0.6,-0.6,-0.6,0.4,1.4]. In order to facilitate subsequent calculations, the series is reversed to obtain the electromagnetic template, and the electromagnetic template Tem = [1.4,0.4,-0.6,-0.6,-0.6].
[0127] Half (rounded down) of the data dimension of the POI electromagnetic template Tem is recorded as hl.
[0128] In this embodiment, the electromagnetic template Tem after de-averaging is as follows: Figure 2 As shown, the value of hl, which is half of the data dimension, is 15.
[0129] S5: Clustering POIs using the annotation results and taking extreme points are as follows:
[0130] S51: clustering POIs using the annotation results, for the electromagnetic sub-traces that are not manually annotated, the electromagnetic sub-traces are regarded as the sequence SEQ9, and the convolution of SEQ9 and the POI electromagnetic template Tem is calculated to obtain the sequence SEQ10;
[0131] The convolution formula for calculating SEQ10 can be expressed as:
[0132]
[0133] Among them, hl represents half of the data dimension of the POI electromagnetic template Tem;
[0134] For example, SEQ9 = [1,2,3,4,5,6,7], Tem = [1.4,0.4,-0.6,-0.6,-0.6]. In the same mode, the convolution will calculate the inner product of [0,0,1,2,3] and Tem after reverse order, the inner product of [0,1,2,3,4] and Tem after reverse order, the inner product of [1,2,3,4,5] and Tem after reverse order, the inner product of [2,3,4,5,6] and Tem after reverse order, the inner product of [3,4,5,6,7] and Tem after reverse order, the inner product of [4,5,6,7,0] and Tem after reverse order, and the inner product of [5,6,7,0,0] and Tem after reverse order. The calculation results are 4.4, 5, 5, 5, 5, -6.2, -10.8 respectively, so SEQ10 = [4.4, 5, 5, 5, 5, -6.2, -10.8].
[0135] The length of SEQ10 is recorded as N10.
[0136] The result of clustering POIs for the i-th (0<=i<100) electromagnetic sub-trace is:
[0137] [c (i) 0,c (i) 1,…,c (i) C-1 ], we can calculate C*(C-1) values:
[0138]
[0139] For all 0≤j,k<C, calculate λ j,k The sample mean and sample standard deviation are recorded as POI time template Tt;
[0140] The sample mean difference calculation formula is:
[0141]
[0142] The sample standard deviation is calculated as:
[0143]
[0144] In this embodiment, the clustering results are as follows: Figure 1 As shown, Figure 1 The horizontal coordinates of the centers of the five blue strips from left to right correspond to a set of [c (i) 0,c (i) 1,...,c (i) C-1 ].
[0145] In this embodiment S6, if the convolution uses the same mode, then N10=N9; if the convolution uses the valid mode, then N10=N9-hl; if the convolution uses the full mode, then N10=N9+hl.
[0146] In this embodiment, the method for calculating the cluster center coordinate difference for each electromagnetic sub-trace is as follows: Figure 3 As shown. In this embodiment, 10 sample means and sample variances can be calculated. In this embodiment, the convolution uses the same mode, and the length N9 of the sequence SEQ9 is 18000.
[0147] S52: Determine the number of extreme value points N11 to be extracted and the neighborhood range B, and extract N11 extreme value points from the sequence SEQ10 to obtain the sequence SEQ11;
[0148] The number of extreme points N11 extracted should preferably be in the range [C, 2*C], and the value of the neighborhood range B can be hl. The larger N11 is, the smaller the false negative rate is, but the amount of calculation will increase polynomially.
[0149] In this embodiment, the number of extreme value points N11 is set to 9, and the neighborhood range B is set to 15. The same number of extreme value points and neighborhood range are used in the preprocessing process of each electromagnetic sub-trace. These N11 extreme value points are arranged from small to large to obtain a sequence SEQ11.
[0150] In this embodiment, the process of extracting the first N11 extreme value points is shown in Table 7:
[0151] Table 7 Extreme point processing
[0152]
[0153]
[0154] SEQ11 is initialized to an empty set. The values in SEQ10 are enumerated in descending order of absolute value and the corresponding index is calculated. If the absolute value of the difference between the index and any element in SEQ10 is greater than the set neighborhood range B, then the index is appended to SEQ11. If the number of elements in SEQ11 reaches the set N11, or the number in SEQ10 has been enumerated, the enumeration stops and the current SEQ11 is output.
[0155] S6: The specific contents of the time template matching process according to the POI time template and the number of categories are as follows:
[0156] S61: according to the POI time template Tt and the number of categories C, extract C extreme point combinations that best match the time template from the sequence SEQ11, and sort them from small to large to obtain the sequence SEQ12;
[0157] The POIs of an electromagnetic sub-trace are contained in these intervals: [SEQ120-hl, SEQ120+hl],
[0158] [SEQ121-hl,SEQ121+hl],…,[SEQ12 C-1 -hl,SEQ12 C-1 +hl].
[0159] In this embodiment, the process of calculating the extreme point combination that best matches the time template is shown in Table 8:
[0160] Table 8 Time template matching processing
[0161]
[0162]
[0163] Enumerate all subsets of SEQ11 with C elements. Let the currently enumerated subset be A. Let the smallest element in subset A be a0, the second smallest element be a1, ... the largest element (the Cth smallest element) be a C-1 If for any 0≤i<j<C, a j -a i and the mean μ of the time template Tt i,j The absolute value of the difference is less than the standard deviation σ of the time template Tt i,j 3 times, then the template matches successfully, let SEQ12 = [a0, a1, a2, ..., a C-1 ] and stop the subsequent enumeration; otherwise, enumerate the next subset with C elements and continue to try template matching. If all subsets are enumerated and still cannot be matched successfully, then let SEQ12 = [] be an empty set.
[0164] S7: After extracting the feature points, use TVLA to verify the extracted sampling points;
[0165] In this embodiment, the verification result is as follows: Figure 4 If the calculated t-statistic value exceeds 4.5, then the confidence level of the extracted sampling points is more than 99.999%. The TVLA calculation process is as follows:
[0166]
[0167] Among them, A and B represent two groups of electromagnetic trace sampling points with the same corresponding intermediate values. Represent the sample means of the sampling points, Represents the sample variance of the sampling points, n A ,n BRepresent the sample capacity of the sampling points respectively.
[0168] From the perspective of improving efficiency, the present invention designs a feature point extraction technology based on time template matching while ensuring accuracy, which can achieve linear time complexity. In this embodiment, it only takes 20 seconds to complete the feature point extraction of an electromagnetic track. Existing technologies with lower time complexity have extremely high false alarm rates, such as static alignment. When using static alignment, more than 99% of the sampling points are falsely reported as POIs. Existing more accurate technologies have extremely high time complexity, such as elastic alignment, which has a quadratic time complexity, and the time overhead is unacceptable when preprocessing electromagnetic tracks of 50,000,000 sampling points.
[0169] The implementation method of the present invention is applicable to a variety of public key cryptographic algorithms that iteratively use private key bits for calculation, such as RSA and ECDSA, and is applicable to smart card hardware platforms.
[0170] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A feature point extraction method based on time template matching, characterized in that: The method includes performing block variance processing on the collected electromagnetic traces; performing analog-to-digital conversion and de-jittering on the electromagnetic traces after the block variance processing; performing Gaussian blur processing on the electromagnetic traces after the de-jittering processing, and performing analog-to-digital conversion and de-jittering again after the Gaussian blurring is completed; extracting sampling points from the electromagnetic traces to mark POIs; clustering POIs using the marking results and performing extreme point processing; and performing time template matching processing based on the POI time template and the number of categories.
2. The feature point extraction method based on time template matching according to claim 1 is characterized in that: The specific contents of block variance processing of collected electromagnetic traces are as follows: S11: Select the public key cryptographic algorithm in the smart card and collect the electromagnetic traces during the operation process, determine the number of iterations D and the number of electromagnetic trace sampling points N1 collected containing sensitive information leakage, and select a reasonable block size wd based on the electromagnetic traces; S12: considering the electromagnetic trace as a sequence SEQ1, and dividing the sequence SEQ1 into sampling points according to the block size wd; Divide into multiple groups containing wd sampling points, and discard the remaining sampling points that are less than wd; S13: Calculate the variance of each group of number sequences divided in S12, and arrange the variance of each group of number sequences in sequence to obtain the number sequence SEQ2.
3. The feature point extraction method based on time template matching according to claim 2 is characterized in that: The specific contents of analog-to-digital conversion and dithering processing of the electromagnetic trace after block variance processing are as follows: S21: Setting a reasonable analog-to-digital conversion threshold th1 to perform a first analog-to-digital conversion on the sequence SEQ2 to obtain a sequence SEQ3, and performing a first de-jittering on the sequence SEQ3 to obtain a sequence SEQ4; Among them, assuming that the minimum values of the variance of the manually labeled blocks containing POIs and excluding POIs are m1 and m2 respectively, then the value of th1 is [m1+(m2-m1)*0.6,m1+(m2-m1)*0.9]; A reasonable de-jittering window size wa1 is set to de-jitter the sequence SEQ3.
4. The feature point extraction method based on time template matching according to claim 3 is characterized in that: The electromagnetic trace after de-jittering is subjected to Gaussian blurring. After the Gaussian blurring is completed, analog-to-digital conversion and de-jittering are performed again. The specific contents are as follows: S31: Set a reasonable binomial distribution convolution kernel size, and generate a convolution kernel K based on the binomial distribution convolution kernel size; S32: Calculate the convolution of the sequence SEQ4 and the convolution kernel K to obtain the sequence SEQ5; S33: Setting a reasonable analog-to-digital conversion threshold th2 to perform a second analog-to-digital conversion on the number sequence SEQ5 to obtain the number sequence SEQ6, and performing a second de-jittering on the number sequence SEQ6 to obtain the number sequence SEQ7.
5. The feature point extraction method based on time template matching according to claim 4 is characterized in that: The specific contents of intercepting sampling points from electromagnetic traces for POIs annotation are as follows: S41: Consider the sequence SEQ7 as a sampling signal of a square wave, calculate the coordinates of all falling edges, and fill these coordinates into the sequence SEQ8 in sequence; S42: selecting a period f, a period offset phi, a sampling point coordinate offset off and a sampling point width N9 according to the number sequences SEQ1 and SEQ8; S43: intercepting multiple sampling points in SEQ8 from the electromagnetic trace to generate an electromagnetic sub-trace, selecting the number of categories C of POIs abscissa clustering according to the electromagnetic sub-trace, manually selecting the electromagnetic sub-trace, and marking its POIs; S44: Using the annotation results, generate a de-averaged POI electromagnetic template Tem that the POIs should match by an averaging method.
6. The feature point extraction method based on time template matching according to claim 5 is characterized in that: The specific contents of clustering POIs using the annotation results and taking extreme points are as follows: S51: clustering POIs using the annotation results, for the electromagnetic sub-traces that are not manually annotated, the electromagnetic sub-traces are regarded as the sequence SEQ9, and the convolution of SEQ9 and the POI electromagnetic template Tem is calculated to obtain the sequence SEQ10; The convolution formula for calculating SEQ10 can be expressed as: Among them, hl represents half of the data dimension of the POI electromagnetic template Tem; S52: Determine the number of extreme value points N11 to be extracted and the neighborhood range B, and extract N11 extreme value points from the sequence SEQ10 to obtain the sequence SEQ11; SEQ11 is initialized to an empty set; the values in SEQ10 are enumerated in descending order of absolute value and the corresponding indexes are calculated. If the absolute value of the difference between the index and any element in SEQ10 is greater than the set neighborhood range B, the index is appended to SEQ11; if the number of elements in SEQ11 reaches the set N11 or the values in SEQ10 have been enumerated, the enumeration stops and the current SEQ11 is output.
7. The feature point extraction method based on time template matching according to claim 6 is characterized in that: The specific contents of the time template matching process based on the POI time template and the number of categories are as follows: S61: according to the POI time template Tt and the number of categories C, extract C extreme point combinations that best match the time template from the sequence SEQ11, and sort them from small to large to obtain the sequence SEQ12; Enumerate all subsets of SEQ11 with C as the number of elements. Let the currently enumerated subset be A. Let the smallest element in subset A be a0, the second smallest element be a1, ..., and the largest element be a. C-1 ; If for any 0≤i<j<C, a j -a i and the mean μ of the time template Tt i,j The absolute value of the difference is less than the standard deviation σ of the time template Tt i,j 3 times, then the template matches successfully, let SEQ12 = [a0, a1, a2, ..., a C-1 ] and stop subsequent enumeration; otherwise, enumerate the next subset with C elements to continue trying template matching; if all subsets are enumerated and still no match is successful, then set SEQ12 to an empty set.
8. The feature point extraction method based on time template matching according to claim 1, characterized in that: After the sampling points are extracted, the specific content of verifying the extracted sampling points is: using TVLA for verification, and the TVLA calculation process is as follows: Among them, A and B represent two groups of electromagnetic trace sampling points with the same corresponding intermediate values. Represent the sample means of the sampling points, Represents the sample variance of the sampling points, n A ,n B Represent the sample capacity of the sampling points respectively.
Citation Information
Patent Citations
Side channel security assessment method based on distribution prediction
CN117650878A
Fast side channel attack method and system for NTT polynomial multiplication
CN117728933A