Power network data encryption method and system based on national secret algorithm
By using pseudo-random functions to parallel encryption in the power network to process the symmetric key generated by the national secret algorithm, and derive the export key with a length L, the security challenges of key management and algorithm configuration in the power network are solved, and diversified Sub-key derivation enhances the security of power network data.
Patent Information
- Application Number
- CN202411278263.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-03
AI Technical Summary
In the prior art, there are security challenges in the original key management and algorithm configuration generated by the Guoxin algorithm in the power network, especially when the number of terminals increases, it is difficult to effectively enhance the security of data.
Through pseudo-random function parallel encryption processing, the export key of length L is derived from the symmetric key generated by the National Secretariat algorithm, and the pseudo-random function and the generated symmetric key are used for parallel encryption to determine the number of blocks required for parallel encryption n. , and merge the encryption results to generate the export key to achieve the isolation and diversification of the keys.
This method can derive multiple different subkeys from one master key, enhance the security of power network data, reduce the burden of key management and algorithm configuration, and avoid security threats from subkey leakage to other scenarios.
Smart Images

Figure CN119071076A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power information security, and in particular to a power network data encryption method and system based on a national secret algorithm. Background Art
[0002] With the upgrade of communication technology, the number of terminal accesses to the power network is increasing, showing the characteristics of diversified functions and open channel networks. The information security challenges faced by power services in the communication process are becoming increasingly greater. In order to ensure the secure transmission of power data in communication and the safe conduct of power services, a secure power network data encryption technology is needed.
[0003] In the prior art, the hash function SM3 and block cipher SM4 of the national secret algorithm are encryption algorithms widely used in wireless communication networks. These algorithms have undergone extensive security assessments and certifications, but due to the increasing number of terminals on the power network, if the network and each terminal always only use the original key generated by the national secret algorithm for communication, key management, algorithm configuration and other aspects will face great security challenges.
[0004] Therefore, a new power network data encryption method and system is needed, which can derive different sub-keys from the original key generated by the national secret algorithm to enhance the security of power network data. Summary of the invention
[0005] In view of this, the purpose of the present invention is to overcome the defects in the prior art and provide an electric power network data encryption method and system based on the national secret algorithm, which can derive different sub-keys from the original key generated by the national secret algorithm, thereby enhancing the security of the electric power network data.
[0006] The power network data encryption method based on the national secret algorithm of the present invention comprises:
[0007] Using pseudo-random functions and generated symmetric keys to perform parallel encryption processing, several encryption results are obtained;
[0008] Combine several of the encryption results to obtain a derived key of length L.
[0009] Further, the pseudo-random function and the generated symmetric key are used to perform parallel encryption processing, specifically including:
[0010] Determine the number of blocks n required for parallel encryption;
[0011] For each counter i from 1 to n, the i-th encryption result K[i] is determined according to the following formula:
[0012]
[0013] Among them, PRF 1 and PRF 2 All are pseudo-random functions; con 1 and con 2 are all agreed fixed constants; K IN It is the symmetric key generated by the national encryption algorithm; Indicates bitwise XOR operation; parameter w i '=([i] 2 ||w);[i] 2 is the binary representation of i; || represents concatenation; parameter w = (Label||0x00||Context||[L] 2 ); Label is the encrypted unique label value; Context is the background parameter; [L] 2 is the binary big-endian representation of L, where L is the expected derived key length.
[0014] Furthermore, the number of blocks n required for parallel encryption is determined according to the following formula:
[0015]
[0016] Where h is the block length output by the pseudo-random function during parallel encryption; is the ceiling function.
[0017] Furthermore, after determining the parameter n, if n>2 r -1, an error message is displayed and the system exits; otherwise, the system continues to perform parallel encryption processing; where r represents the length of the binary code of counter i, and its value range is 1 to 32.
[0018] Furthermore, when merging several of the encryption results, if nh>L, then for K[n], only the first [L-(n-1)h] bits thereof are involved in the merging.
[0019] A power network data encryption system based on a national secret algorithm, comprising a parallel encryption unit and a key merging unit;
[0020] The parallel encryption unit is used to perform parallel encryption processing using a pseudo-random function and a generated symmetric key to obtain a number of encryption results;
[0021] The key merging unit is used to merge several of the encryption results to obtain a derived key with a length of L.
[0022] Further, the pseudo-random function and the generated symmetric key are used to perform parallel encryption processing, specifically including:
[0023] Determine the number of blocks n required for parallel encryption;
[0024] For each counter i from 1 to n, the i-th encryption result K[i] is determined according to the following formula:
[0025]
[0026] Among them, PRF 1 and PRF 2 All are pseudo-random functions; con 1 and con 2 are all agreed fixed constants; K IN It is the symmetric key generated by the national encryption algorithm; Indicates bitwise XOR operation; parameter w i '=([i] 2 ||w);[i] 2 is the binary representation of i; || represents concatenation; parameter w = (Label||0x00||Context||[L] 2 ); Label is the encrypted unique label value; Context is the background parameter; [L] 2 is the binary big-endian representation of L, where L is the expected derived key length.
[0027] Furthermore, the number of blocks n required for parallel encryption is determined according to the following formula:
[0028]
[0029] Where h is the block length output by the pseudo-random function during parallel encryption; is the ceiling function.
[0030] Furthermore, after determining the parameter n, if n>2 r -1, an error message is displayed and the system exits; otherwise, the system continues to perform parallel encryption processing; where r represents the length of the binary code of counter i, and its value range is 1 to 32.
[0031] Furthermore, when merging several of the encryption results, if nh>L, then for K[n], only the first [L-(n-1)h] bits thereof are involved in the merging.
[0032] The beneficial effects of the present invention are as follows: the present invention discloses a method and system for encrypting power network data based on a national secret algorithm, which utilizes an improved key derivation function to derive a subkey from an original key (as a master key) generated by the national secret algorithm. By using different key derivation function parameters for different application scenarios, multiple different subkeys can be derived from a master key. Even if a subkey is leaked, it will not pose a security threat to communication scenarios using other subkeys, thereby enhancing the security of power network data. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:
[0034] Figure 1 The figure is a schematic diagram of the process of calculating a derived key based on an original key according to the present invention. DETAILED DESCRIPTION
[0035] The present invention is further described below in conjunction with the accompanying drawings, as shown in the drawings:
[0036] This embodiment discloses a method for encrypting power network data based on a national secret algorithm, comprising the following steps:
[0037] Using pseudo-random functions and generated symmetric keys to perform parallel encryption processing, several encryption results are obtained;
[0038] Combine several of the encryption results to obtain a derived key of length L.
[0039] In this embodiment, the pseudo-random function and the generated symmetric key are used to perform parallel encryption processing, which specifically includes:
[0040] Determine the number of blocks n required for parallel encryption;
[0041] For each counter i from 1 to n, the i-th encryption result K[i] is determined according to the following formula:
[0042]
[0043] Among them, PRF 1 and PRF 2 All are pseudo-random functions; con 1 and con 2 They are all agreed fixed constants, which play a protective role on the input and can be set according to the actual working conditions; K IN It is the symmetric key generated by the national encryption algorithm; Indicates bitwise XOR operation; parameter w i '=([i] 2 ||w);[i] 2 is the binary representation of i, the encoding length is r bits; || represents concatenation; parameter w = (Label||0x00||Context||[L] 2 ); Label is the encrypted unique label value; Context is the background parameter, which is generally related to the encryption scenario of this derived key, such as the identity information of the parties using the key derivation function; [L] 2 It is the binary big-endian representation of L, and its maximum value is the logarithm with base 2 of the product of the actual number of counter i and the output length of the selected pseudo-random function PRF; L is the expected derived key length.
[0044] In addition, different pseudo-random functions can be selected; for example, the pseudo-random functions PRF1 and PRF2 can be HMAC (message authentication code based on hash function), corresponding to the hash function encryption method of the national secret algorithm SM3; the pseudo-random functions PRF1 and PRF2 can also be CMAC (message authentication code based on block cipher), corresponding to the symmetric encryption method of the national secret algorithm SM4. It can also be compatible with other types of national secret algorithms, using the corresponding pseudo-random functions to obtain the corresponding derived keys.
[0045] In this embodiment, the number of blocks n required for parallel encryption is determined according to the following formula:
[0046]
[0047] Wherein, h is the block length of the pseudo-random function output during parallel encryption, which is determined by the properties of the pseudo-random functions PRF1 and PRF2; is the ceiling function.
[0048] After determining the parameter n, if n>2 r -1, an error message is displayed and the system exits; otherwise, the system continues to perform parallel encryption processing; where r represents the length of the binary code of counter i, and its value range is 1 to 32, corresponding to the value range of counter i is [1,2 r -1].
[0049] In this embodiment, the outputs K[1] to K[n] after parallel encryption are merged. If nh>L, for K[n], only the first [L-(n-1)h] bits are involved in the merger. The merger results in a derived key of length L. At this point, the operation ends, and the final output is an L-bit derived key.
[0050] Through the above-mentioned power network data encryption method, different parameters of the key derivation function can be used for different application scenarios to derive multiple different subkeys from a master key. When the same original key generated by the national secret algorithm is applied to different scenarios, different subkeys are used to isolate different application scenarios; therefore, the burden of key management and algorithm configuration in the power network is reduced, and the security of data in the power network is improved.
[0051] The present invention also relates to a power network data encryption system based on a national secret algorithm. The encryption system corresponds to the encryption method of the above embodiment and can be understood as a system for implementing the above encryption method. The encryption system includes a parallel encryption unit and a key merging unit.
[0052] The parallel encryption unit is used to perform parallel encryption processing using a pseudo-random function and a generated symmetric key to obtain a number of encryption results;
[0053] The key merging unit is used to merge several of the encryption results to obtain a derived key with a length of L.
[0054] In order to better understand the encryption method and system of the present invention, the following examples are further described:
[0055] Example 1: The original key generated by the national encryption algorithm SM3 is used to obtain a derived key with a length of 1024 bits:
[0056] 1. Run the SM3 national encryption algorithm to obtain the original key. According to the GB / T 32905-2016 national standard, the 256-bit original key is obtained through four steps: message filling, message expansion, iterative compression, and output results.
[0057] 2. Calculate the input value into the system / method of the present invention, K IN Input the 256-bit original key of the encryption result of SM3, the input value of x is 3, the input value of L is 1024, and the input value of r is 7.
[0058] 3. Parameter processing, calculate n = 1024 / 128 = 8, after verification n < 2 r -1, the algorithm is executed normally. Calculate w = (Label||0x00||Context||[L] 2 ), if the system / method is run for the first time, the value of Label can be 0, that is, the method of "initial 0, increasing in sequence" is adopted, or a random value that can be guaranteed not to be repeated is adopted.
[0059] 4. Parallel encryption. In this example, the pseudo-random function is the HMAC-SM3 algorithm that uses SM3 to generate the hash value, so the value of h is 128. For each i from 1 to 8, calculate wi' = ([i] 2 ||w), || indicates concatenation. For example, in this example, there are 4 HMAC-SM3 parallel modules, so a total of 4 rounds of parallel encryption are performed:
[0060] Round 1:
[0061]
[0062] Round 2:
[0063]
[0064] Round 3:
[0065]
[0066] Round 4:
[0067]
[0068] 5. Key merging: merge the outputs K[1] to K[8] of the parallel encryption process. Since nh = L, merge all K[1] to K[8] to obtain a derived key with a length of 1024 bits.
[0069] Example 2: The original key generated by the national encryption algorithm SM4 is used to obtain a derived key with a length of 600 bits:
[0070] 1. Run the SM4 national encryption algorithm to obtain the original key. According to the GM / T 0002-2012 national standard, the 128-bit original key is obtained through five steps: key expansion, round key addition, nonlinear transformation, repeated round operation, and output result.
[0071] 2. Calculate the input value into the system / method of the present invention, K IN Input the 128-bit original key of the encryption result of SM4, the input value of x is 4, the input value of L is 600, and the input value of r is 7.
[0072] 3. Parameter processing and calculation After testing, n<2 r -1, the algorithm is executed normally. Calculate w = (Label||0x00||Context||[L] 2 ), if the system / method is run for the first time, the value of Label can be 0, that is, the method of "initial 0, increasing in sequence" is adopted, or a random value that can be guaranteed not to be repeated is adopted.
[0073] 4. Parallel encryption. In this example, the pseudo-random function is the CMAC-SM4 algorithm using SM4 for block encryption, so the value of h is 128. For each i from 1 to 5, calculate wi' = ([i] 2 ||w). For example, in this example, there are 8 CMAC-SM4 parallel modules, so a total of 2 rounds of parallel encryption are performed:
[0074] Round 1:
[0075]
[0076] Round 2:
[0077]
[0078] 5. Key merging: Merge the outputs of the parallel encryption process K[1] to K[5]. Since nh>L, for K[5], only the first 88 bits are involved in the merging, resulting in a 600-bit derived key.
[0079] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.
Claims
1. A method for encrypting power network data based on a national secret algorithm, characterized in that: include: Using pseudo-random functions and generated symmetric keys to perform parallel encryption processing, several encryption results are obtained; Combine several of the encryption results to obtain a derived key of length L.
2. The method for encrypting power network data based on the national secret algorithm according to claim 1 is characterized in that: Parallel encryption processing is performed using pseudo-random functions and generated symmetric keys, including: Determine the number of blocks n required for parallel encryption; For each counter i from 1 to n, the i-th encryption result K[i] is determined according to the following formula: Among them, PRF1 and PRF2 are both pseudo-random functions; con1 and con2 are both agreed fixed constants; K IN It is the symmetric key generated by the national encryption algorithm; Indicates bitwise XOR operation; parameter w i '=([i]2||w); [i]2 is the binary representation of i; || represents concatenation; parameter w=(Label||0x00||Context||[L]2); Label is the encrypted unique label value; Context is the background parameter; [L]2 is the binary big-endian representation of L, and L is the expected derived key length.
3. The method for encrypting power network data based on the national secret algorithm according to claim 2 is characterized in that: The number of blocks n required for parallel encryption is determined according to the following formula: Where h is the block length output by the pseudo-random function during parallel encryption; is the ceiling function.
4. The method for encrypting power network data based on the national secret algorithm according to claim 2 is characterized in that: After determining the parameter n, if n>2 r -1, an error message is displayed and the system exits; otherwise, the system continues to perform parallel encryption processing; where r represents the length of the binary code of the counter i, and its value range is 1 to 32.
5. The power network data encryption method based on the national secret algorithm according to claim 2 is characterized in that: When merging several of the encryption results, if nh>L, then for K[n], only the first [L-(n-1)h] bits thereof are involved in the merging.
6. A power network data encryption system based on a national secret algorithm, characterized by: It includes a parallel encryption unit and a key merging unit; The parallel encryption unit is used to perform parallel encryption processing using a pseudo-random function and a generated symmetric key to obtain a number of encryption results; The key merging unit is used to merge several of the encryption results to obtain a derived key with a length of L.
7. The power network data encryption system based on the national secret algorithm according to claim 6 is characterized in that: Parallel encryption processing is performed using pseudo-random functions and generated symmetric keys, including: Determine the number of blocks n required for parallel encryption; For each counter i from 1 to n, the i-th encryption result K[i] is determined according to the following formula: Among them, PRF1 and PRF2 are both pseudo-random functions; con1 and con2 are both agreed fixed constants; K IN It is the symmetric key generated by the national encryption algorithm; Indicates bitwise XOR operation; parameter w i '=([i]2||w); [i]2 is the binary representation of i; || represents concatenation; parameter w=(Label||0x00||Context||[L]2); Label is the encrypted unique label value; Context is the background parameter; [L]2 is the binary big-endian representation of L, and L is the expected derived key length.
8. The power network data encryption system based on the national secret algorithm according to claim 7 is characterized in that: The number of blocks n required for parallel encryption is determined according to the following formula: Where h is the block length output by the pseudo-random function during parallel encryption; is the ceiling function.
9. The power network data encryption system based on the national secret algorithm according to claim 7 is characterized in that: After determining the parameter n, if n>2 r -1, an error message is displayed and the system exits; otherwise, the system continues to perform parallel encryption processing; where r represents the length of the binary code of the counter i, and its value range is 1 to 32.
10. The power network data encryption system based on the national secret algorithm according to claim 7 is characterized in that: When merging several of the encryption results, if nh>L, then for K[n], only the first [L-(n-1)h] bits thereof are involved in the merging.
