A fully homomorphic encryption method and device supporting block cipher SM4 algorithm
By homomorphic design of the SM4 algorithm, the domestic cryptographic algorithm SM4 is used to improve the homomorphic calculation efficiency of encrypted ciphertexts, solving the problems of complex calculation and slow calculation of the packet cipher SM4 algorithm in full homomorphic encryption, and achieving high efficiency and security encryption method.
Patent Information
- Application Number
- CN202410672932.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-05-28
AI Technical Summary
In the prior art, the packet cryptography SM4 algorithm has problems such as complex calculations and slow calculations in terms of total homomorphic encryption, and lacks an encryption method with high efficiency and strong security.
A fully homomorphic encryption method that supports the SM4 algorithm of packet ciphers is proposed. By obtaining the operating environment information, a fully homomorphic encryption key is generated, and a pseudo-random number is used to generate the SM4 shared key and round key, combined with the packet cipher The SM4 algorithm encrypts the ciphertext, and finally fully homomorphic encryption is performed on it. The domestic ciphertext is used to improve the homomorphic computing efficiency of encrypted ciphertexts.
Improve the homomorphic computing efficiency of SM4 encrypted ciphertexts, expand the application scope of SM4 algorithm, solve the problems of complex calculations of total homomorphic encryption and slow side operations, and provide a high efficiency and security for the SM4 algorithm for packet ciphers. A highly homomorphic encryption method.
Smart Images

Figure CN118473636B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data encryption technology, and in particular to a fully homomorphic encryption method and device supporting a block cipher SM4 algorithm. Background Art
[0002] The SM4 block cipher algorithm is a symmetric encryption algorithm released by the China National Cryptography Administration, also known as a commercial encryption algorithm. The SM4 algorithm is a block cipher that uses a block cipher structure with a block length of 128 bits and a key length of 128 bits. It has good security and efficiency and is suitable for data encryption and secure communications in a variety of scenarios.
[0003] With the continuous development and improvement of the SM4 block cipher algorithm in the field of information security technology, various encryption methods based on the SM4 block cipher algorithm have emerged. Among them, a pipeline-structured SM4 algorithm encryption system uses nonlinear S-box permutation operations and a pseudo-random mask addition technology, which has the advantages of small area, high security, fast operation and low power consumption. However, the scope of application is still data encryption and decryption of symmetric cryptography. Although the SM4 block cipher algorithm has good performance and security in general, the inherent defects of the method are exposed, such as fixed key length, potential risk of quantum computing attacks, insufficient ecosystem support, and relatively low performance. The inherent defects of the SM4 block cipher algorithm still pose certain risks to its application in the field of information security technology.
[0004] Fully homomorphic encryption is an excellent encryption technology that can perform arbitrary calculations on encrypted data and obtain the correct plaintext information after decryption. When an attacker obtains the encrypted ciphertext information, he cannot obtain the decrypted plaintext information, which greatly reduces the risk of encrypted data being maliciously attacked. Fully homomorphic encryption has very high flexibility and can perform various complex analyses and processing on encrypted data without decryption. However, because fully homomorphic encryption uses complex mathematical tools and algorithms, it has a high computing resource utilization rate, making the encryption and decryption processes very time-consuming, affecting the overall real-time response performance of the algorithm and user experience. Although fully homomorphic encryption has many potential application scenarios in theory, there are also many problems to be solved when it is applied to specific problems.
[0005] In the prior art, there is a lack of a fully homomorphic encryption method with high efficiency and strong security for the block cipher SM4 algorithm. Summary of the invention
[0006] In order to solve the technical problems of complex and slow calculation of fully homomorphic encryption in the prior art, an embodiment of the present invention provides a fully homomorphic encryption method and device supporting the block cipher SM4 algorithm. The technical solution is as follows:
[0007] On the one hand, a fully homomorphic encryption method supporting a block cipher SM4 algorithm is provided, the method being implemented by a fully homomorphic encryption device, the method comprising:
[0008] S1. Obtaining operating environment information; based on the technical standards in the field of cryptography, generating parameters through a preset parameter algorithm according to the operating environment information to obtain security parameters;
[0009] S2. According to the security parameters, a key is generated by a preset fully homomorphic encryption key generation algorithm to obtain a fully homomorphic encryption key;
[0010] S3, using a preset pseudo-random generator to generate a pseudo-random number; according to the pseudo-random number, a key is generated by a preset SM4 key expansion algorithm to obtain an SM4 shared key and a round key;
[0011] S4, obtaining the plaintext to be encrypted; encrypting the plaintext using the block cipher SM4 algorithm according to the SM4 shared key and the round key to obtain the SM4 ciphertext;
[0012] S5. Perform fully homomorphic encryption on the SM4 ciphertext according to the fully homomorphic encryption key to obtain a fully homomorphic encrypted ciphertext.
[0013] On the other hand, a fully homomorphic encryption device supporting a block cipher SM4 algorithm is provided, the device is applied to a fully homomorphic encryption method supporting a block cipher SM4 algorithm, the device comprising:
[0014] A security parameter generation module is used to obtain operating environment information; based on the technical standards in the field of cryptography, parameters are generated according to the operating environment information through a preset parameter algorithm to obtain security parameters;
[0015] A fully homomorphic key generation module, used to generate a key according to the security parameters through a preset fully homomorphic encryption key generation algorithm to obtain a fully homomorphic encryption key;
[0016] The SM4 key generation module is used to generate a pseudo-random number using a preset pseudo-random generator; according to the pseudo-random number, a key is generated by a preset SM4 key expansion algorithm to obtain an SM4 shared key and a round key;
[0017] The SM4 encryption module is used to obtain the plaintext to be encrypted; according to the SM4 shared key and the round key, the block cipher SM4 algorithm is used to encrypt the plaintext to obtain the SM4 ciphertext;
[0018] The fully homomorphic encryption module is used to perform fully homomorphic encryption on the SM4 ciphertext according to the fully homomorphic encryption key to obtain a fully homomorphic encrypted ciphertext.
[0019] On the other hand, a fully homomorphic encryption device is provided, comprising: a processor; a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, any one of the fully homomorphic encryption methods supporting the block cipher SM4 algorithm described above is implemented.
[0020] On the other hand, a computer-readable storage medium is provided, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement any one of the above-mentioned fully homomorphic encryption methods supporting the block cipher SM4 algorithm.
[0021] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0022] The present invention proposes a fully homomorphic encryption method supporting the block cipher SM4 algorithm, by homomorphically designing the classic domestic block cipher algorithm SM4. The domestic cryptographic algorithm SM4 is applied in the homomorphic encryption algorithm to improve the homomorphic computing efficiency of the SM4 encrypted ciphertext. A fully homomorphic encryption scheme supporting the block cipher SM4 is expanded, the application scope of the SM4 algorithm is expanded, and the shortcomings of complex fully homomorphic encryption calculations and slow end-side operations are solved. The present invention is a fully homomorphic encryption method with high efficiency and strong security for the block cipher SM4 algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 It is a flow chart of a fully homomorphic encryption method supporting a block cipher SM4 algorithm provided by an embodiment of the present invention;
[0025] Figure 2 It is a block diagram of a fully homomorphic encryption device supporting the block cipher SM4 algorithm provided by an embodiment of the present invention;
[0026] Figure 3 It is a structural diagram of a fully homomorphic encryption device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The technical solution of the present invention is described below in conjunction with the accompanying drawings.
[0028] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "example" is intended to present the concept in a specific way. In addition, in the embodiments of the present invention, the meaning expressed by "and / or" can be both, or it can be either of the two.
[0029] In the embodiments of the present invention, "image" and "picture" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same. "of", "corresponding, relevant" and "corresponding" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same.
[0030] In the embodiments of the present invention, sometimes a subscript such as W1 may be written as a non-subscript such as W1. When the difference is not emphasized, the meanings to be expressed are the same.
[0031] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0032] The embodiment of the present invention provides a fully homomorphic encryption method supporting the block cipher SM4 algorithm, which can be implemented by a fully homomorphic encryption device, which can be a terminal or a server. Figure 1 The flowchart of the fully homomorphic encryption method supporting the block cipher SM4 algorithm is shown. The processing flow of the method may include the following steps:
[0033] S1. Obtaining operating environment information; based on the technical standards in the field of cryptography, according to the operating environment information, parameters are generated through a preset parameter algorithm to obtain security parameters.
[0034] Among them, the safety parameters include TRGSW safety parameters, TRLWE safety parameters and TLWE safety parameters.
[0035] In a feasible implementation manner, the present invention uses a parameter generation algorithm according to the current usage scenario and software and hardware environment and in accordance with relevant cryptographic standards to set the various security parameters of fully homomorphic encryption required for the Learning With Errors over the Torus (TLWE), the Learning With Errors over the Rings Torus (TRLWE), and the GSW over the Ring Torus (TRGSW) problem, and completes the initialization of the parameters.
[0036] In the field of cryptography, parameter generation algorithms are widely used to generate security parameters, which belongs to the prior art and will not be described in detail here.
[0037] S2. According to the security parameters, a key is generated through a preset fully homomorphic encryption key generation algorithm to obtain a fully homomorphic encryption key.
[0038] Optionally, according to the security parameters, a key is generated by using a preset fully homomorphic encryption key generation algorithm to obtain a fully homomorphic encryption key, including:
[0039] S21. According to the TRGSW security parameters, a preset fully homomorphic encryption key generation algorithm is used to calculate and obtain a TRGSW key;
[0040] S22. According to the TRLWE security parameters, a preset fully homomorphic encryption key generation algorithm is used to calculate and obtain a TRLWE key;
[0041] S23. According to the TLWE security parameters, use the preset fully homomorphic encryption key generation algorithm to calculate and obtain the TLWE key.
[0042] In a feasible implementation, based on the set security parameters, a key generation algorithm corresponding to the fully homomorphic encryption algorithm is used to generate a key used by the homomorphic encryption algorithm corresponding to the security parameters.
[0043] According to the security parameters generated in the above steps, use the preset key encryption algorithm to calculate and obtain the key space corresponding to the TRGSW security parameters, TRLWE security parameters and TLWE security parameters, uniformly sample and generate vectors in the key space, and obtain the corresponding keys of the security parameters.
[0044] S3. Generate a pseudo-random number using a preset pseudo-random generator; generate a key based on the pseudo-random number using a preset SM4 key expansion algorithm to obtain an SM4 shared key and a round key.
[0045] Optionally, according to the pseudo-random number, a key is generated by a preset SM4 key expansion algorithm to obtain an SM4 shared key and a round key, including:
[0046] S31, determining the pseudo-random number as the SM4 shared key;
[0047] S32. According to the SM4 shared key, a preset key expansion algorithm is used to generate a key to obtain a round key.
[0048] In a feasible implementation, a preset pseudo-random number generator is used to generate a qualified pseudo-random number, and the qualified pseudo-random number is used as the shared key of the Information security technology—SM4 block cipher algorithm (SM4). Based on the shared key of SM4, a commonly used key expansion algorithm is used to calculate and generate a round key.
[0049] The round key generation algorithm of the SM4 algorithm is to divide the 128-bit key into 4 32-bit words and use a series of nonlinear and linear transformations to generate 32 round keys. The initial key is assigned to the first 4 round keys, and then the subsequent round keys are generated by recursive relationship, where each round key is XORed with the previous round key, and then the next round key is obtained through nonlinear and linear transformation.
[0050] S4. Obtain the plaintext to be encrypted; encrypt the plaintext using the block cipher SM4 algorithm according to the SM4 shared key and the round key to obtain the SM4 ciphertext.
[0051] In a feasible implementation, the input plaintext string is processed and converted into binary based on the string encoding rule. The binary plaintext is encrypted using the block cipher SM4 algorithm according to the SM4 shared key and the round key to obtain the SM4 ciphertext.
[0052] The ciphertext generation process of the SM4 algorithm includes initial round key addition, round function operation, and final round key addition. The plaintext is XORed with the first round key, and then goes through 32 rounds of round function operations, each of which includes nonlinear and linear transformations. After the last round of round function operations, it is XORed with the last round key to obtain the final ciphertext.
[0053] S5. Perform fully homomorphic encryption on the SM4 ciphertext according to the fully homomorphic encryption key to obtain a fully homomorphic encrypted ciphertext.
[0054] Optionally, the first TRGSW ciphertext is fully homomorphically encrypted according to the fully homomorphic encryption key to obtain a fully homomorphic encrypted ciphertext, and step S5 may further include the following steps S51-S510:
[0055] S51. Encrypt the SM4 ciphertext according to the TRGSW key to obtain a first TRGSW ciphertext.
[0056] S52. Set the total number of rounds to N, the current round number to i, and let i=1.
[0057] S53. Determine whether i is greater than N. If i is greater than N, go to step S510; if i is less than or equal to N, go to step S54.
[0058] S54. Based on the S-box after the hybrid packing in the lookup table, perform nonlinear mapping on the first TRGSW ciphertext to obtain a second TRGSW ciphertext.
[0059] In a feasible implementation, an S-box is used to perform nonlinear transformation on the ciphertext, and the S-box used also needs to be packaged. A lookup table hybrid packaging component is used to change the input ciphertext into the correct ciphertext form. For an 8-to-8-bit S-box lookup table, the output table size is 256×8.
[0060] Let the order of the ring polynomial be 1024, and all input ciphertexts be in the ciphertext form of the matrix ciphertext fully homomorphic encryption algorithm on the torus. Using hybrid packaging, all output results can be packaged into two ciphertexts of the difficult problem fully homomorphic encryption algorithm on the torus by combining horizontal and vertical packaging. The last matrix ciphertext fully homomorphic encryption algorithm ciphertext on the torus is used to select the target torus difficult problem fully homomorphic encryption algorithm ciphertext through a signal selection gate.
[0061] Use the remaining ciphertext samples of the matrix ciphertext fully homomorphic encryption algorithm on the torus to blindly rotate the ciphertext of the difficult problem fully homomorphic encryption algorithm on the target torus, and the expected value will be located in the first 8 positions of the difficult problem fully homomorphic encryption algorithm ciphertext on the result torus.
[0062] S55. According to the TRLWE key, the second TRGSW ciphertext is bootstrapped and encrypted to obtain the TRLWE ciphertext.
[0063] In a feasible implementation, circuit bootstrapping is used to convert the ciphertext of the ring hard problem fully homomorphic encryption algorithm into the ciphertext of the torus hard problem fully homomorphic encryption algorithm to ensure the operation of the entire circuit, solving the problem that the selector ciphertext requires the torus matrix ciphertext fully homomorphic encryption algorithm ciphertext, while the output ciphertext form of the external multiplication is incompatible with the torus hard problem fully homomorphic encryption algorithm.
[0064] S56. Split and encrypt the TRLWE ciphertext according to the TLWE key to obtain a first TLWE ciphertext.
[0065] In a feasible implementation, the TRLWE ciphertext is grouped and extracted based on the TLWE key, and split into multiple groups of ciphertexts, and the split ciphertexts are in the form of TLWE ciphertexts.
[0066] S57. Perform a linear transformation on the first TLWE ciphertext to obtain a third TLWE ciphertext.
[0067] Optionally, performing a linear transformation on the first TLWE ciphertext to obtain a third TLWE ciphertext includes:
[0068] S571, performing row shift processing on the first TLWE ciphertext to obtain a second TLWE ciphertext;
[0069] S572. Perform column obfuscation processing on the second TLWE ciphertext to obtain a third TLWE ciphertext.
[0070] In one feasible implementation, the third TLWE ciphertext is linearly transformed using a row shift and column confusion operation on the ciphertext. In the row shift operation of the ciphertext, for a 4×4 ciphertext state matrix, the first row remains unchanged, while the second row undergoes a one-byte left circular shift. Similarly, the third row is circularly shifted by two bytes, and the fourth row is circularly shifted to the left by three bytes.
[0071] Column confusion is used for the second TLWE ciphertext. The column confusion is a multiplication operation of the 4×4 matrix and an operation modulo (x8+x4+x3+x+1) on the constant term {x+1,x,1}.
[0072] S58. Based on the PBSmanyLUT algorithm and the TRGSW key, encrypt the third TLWE ciphertext to obtain a third TRGSW ciphertext.
[0073] Optionally, encrypting the third TLWE ciphertext to obtain a third TRGSW ciphertext includes:
[0074] S581, using the PBSmanyLUT algorithm, performing noise reduction processing on the third TLWE ciphertext to obtain a fourth TLWE ciphertext;
[0075] S582. Encrypt the fourth TLWE ciphertext according to the TRGSW key to obtain a third TRGSW ciphertext.
[0076] In a feasible implementation, the present invention realizes cross-level ciphertext switching. In order to suppress the increase of noise during homomorphic computing, a bootstrapping function and a key switching function are added to the algorithm, so that the circuit bootstrapping can span three levels, each level has a different ciphertext type and its own parameter settings and related keys.
[0077] The main difference between the three encryption levels is the amount of noise supported, with higher levels resulting in lower noise, and level 0 corresponding to small parameters, large noise, instantaneous computation, but only very limited linear operations can be tolerated. This allows the ciphertext to remain in a form that is most suitable for the current homomorphic computation.
[0078] After completing the encryption and forming the homomorphic ciphertext, other homomorphic calculations can be performed on the ciphertext, such as homomorphic addition, homomorphic multiplication, etc. During homomorphic calculations, the noise of the ciphertext will continue to increase with the increase of the multiplication depth. At this time, the fully homomorphic encryption bootstrap algorithm can be used to bootstrap the ciphertext to reduce the ciphertext noise and form an infinite level of homomorphic ciphertext.
[0079] The PBS many LUT algorithm is based on a series of pre-generated lookup tables and uses key information (such as key length and security parameters) for encryption processing. The lookup table contains the results of various encryption and decryption operations, such as addition, multiplication, and exponential operations. The encryption operation involves the query and combination of multiple lookup tables. For the encrypted ciphertext data, the pre-generated lookup table is also used for decryption operations. The decryption process is a reverse operation similar to the encryption operation to obtain the original plaintext data. The PBS many LUT algorithm can pre-calculate a large number of lookup tables, avoiding complex mathematical operations during the encryption and decryption process, and improving the efficiency of encryption and decryption.
[0080] S59. Determine the third TRGSW ciphertext as the first TRGSW ciphertext; set i=i+1; and execute step S52.
[0081] S510. Determine the first TRGSW ciphertext as a fully homomorphic encrypted ciphertext; and output the fully homomorphic encrypted ciphertext.
[0082] In a feasible implementation, after performing the fully homomorphic encryption of the SM4 algorithm, the encrypted ciphertext can be decrypted using the key used by the fully homomorphic encryption algorithm for the difficult problem on a ring, the fully homomorphic encryption algorithm for the difficult problem on a torus, the fully homomorphic encryption algorithm for the matrix ciphertext on a torus, etc., and the shared key of the SM4 algorithm to restore the original plaintext.
[0083] The present invention proposes a fully homomorphic encryption method supporting the block cipher SM4 algorithm, by homomorphically designing the classic domestic block cipher algorithm SM4. The domestic cryptographic algorithm SM4 is applied in the homomorphic encryption algorithm to improve the homomorphic computing efficiency of the SM4 encrypted ciphertext. A fully homomorphic encryption scheme supporting the block cipher SM4 is expanded, the application scope of the SM4 algorithm is expanded, and the shortcomings of complex fully homomorphic encryption calculations and slow end-side operations are solved. The present invention is a fully homomorphic encryption method with high efficiency and strong security for the block cipher SM4 algorithm.
[0084] Figure 21 is a block diagram of a fully homomorphic encryption device supporting the block cipher SM4 algorithm according to an exemplary embodiment, wherein the device is used to support the fully homomorphic encryption method of the block cipher SM4 algorithm. Figure 2 The device includes a security parameter generation module 210, a fully homomorphic key generation module 220, an SM4 key generation module 230, an SM4 encryption module 240 and a fully homomorphic encryption module 250. Among them:
[0085] The security parameter generation module 210 is used to obtain the operating environment information; based on the technical standards in the field of cryptography, according to the operating environment information, the parameters are generated by a preset parameter algorithm to obtain security parameters;
[0086] A fully homomorphic key generation module 220 is used to generate a key according to security parameters by using a preset fully homomorphic encryption key generation algorithm to obtain a fully homomorphic encryption key;
[0087] The SM4 key generation module 230 is used to generate a pseudo-random number using a preset pseudo-random generator; according to the pseudo-random number, a key is generated by using a preset SM4 key expansion algorithm to obtain an SM4 shared key and a round key;
[0088] The SM4 encryption module 240 is used to obtain the plaintext to be encrypted; according to the SM4 shared key and the round key, the block cipher SM4 algorithm is used to encrypt the plaintext to obtain the SM4 ciphertext;
[0089] The fully homomorphic encryption module 250 is used to perform fully homomorphic encryption on the SM4 ciphertext according to the fully homomorphic encryption key to obtain the fully homomorphic encrypted ciphertext.
[0090] Among them, the safety parameters include TRGSW safety parameters, TRLWE safety parameters and TLWE safety parameters.
[0091] Optionally, the fully homomorphic key generation module 220 is further used to:
[0092] S21. According to the TRGSW security parameters, a preset fully homomorphic encryption key generation algorithm is used to calculate and obtain a TRGSW key;
[0093] S22. According to the TRLWE security parameters, a preset fully homomorphic encryption key generation algorithm is used to calculate and obtain a TRLWE key;
[0094] S23. According to the TLWE security parameters, use the preset fully homomorphic encryption key generation algorithm to calculate and obtain the TLWE key.
[0095] Optionally, the SM4 key generation module 230 is further configured to:
[0096] S31, determining the pseudo-random number as the SM4 shared key;
[0097] S32. According to the SM4 shared key, a preset key expansion algorithm is used to generate a key to obtain a round key.
[0098] Optionally, the fully homomorphic encryption module 250 is further used to:
[0099] S51. Encrypt the SM4 ciphertext according to the TRGSW key to obtain a first TRGSW ciphertext;
[0100] S52, set the total number of rounds to N, the current round number to i, and set i=1;
[0101] S53, determine whether i is greater than N, if i is greater than N, then go to step S510, if i is less than or equal to N, then go to step S54;
[0102] S54, performing nonlinear mapping on the first TRGSW ciphertext based on the S-box after hybrid packing in the lookup table to obtain a second TRGSW ciphertext;
[0103] S55. Bootstrap the second TRGSW ciphertext according to the TRLWE key to obtain the TRLWE ciphertext.
[0104] S56. Split and encrypt the TRLWE ciphertext according to the TLWE key to obtain a first TLWE ciphertext.
[0105] S57, performing a linear transformation on the first TLWE ciphertext to obtain a third TLWE ciphertext;
[0106] S58. Based on the PBSmanyLUT algorithm and the TRGSW key, encrypt the third TLWE ciphertext to obtain a third TRGSW ciphertext.
[0107] S59, determine the third TRGSW ciphertext as the first TRGSW ciphertext; let i=i+1; execute step S52;
[0108] S510. Determine the first TRGSW ciphertext as a fully homomorphic encrypted ciphertext; and output the fully homomorphic encrypted ciphertext.
[0109] Optionally, the fully homomorphic encryption module 250 is further used to:
[0110] S571, performing row shift processing on the first TLWE ciphertext to obtain a second TLWE ciphertext;
[0111] S572. Perform column obfuscation processing on the second TLWE ciphertext to obtain a third TLWE ciphertext.
[0112] Optionally, the fully homomorphic encryption module 250 is further used to:
[0113] S581, using the PBSmanyLUT algorithm, performing noise reduction processing on the third TLWE ciphertext to obtain a fourth TLWE ciphertext;
[0114] S582. Encrypt the fourth TLWE ciphertext according to the TRGSW key to obtain a third TRGSW ciphertext.
[0115] The present invention proposes a fully homomorphic encryption method supporting the block cipher SM4 algorithm, by homomorphically designing the classic domestic block cipher algorithm SM4. The domestic cryptographic algorithm SM4 is applied in the homomorphic encryption algorithm to improve the homomorphic computing efficiency of the SM4 encrypted ciphertext. A fully homomorphic encryption scheme supporting the block cipher SM4 is expanded, the application scope of the SM4 algorithm is expanded, and the shortcomings of complex fully homomorphic encryption calculations and slow end-side operations are solved. The present invention is a fully homomorphic encryption method with high efficiency and strong security for the block cipher SM4 algorithm.
[0116] Figure 3 is a schematic diagram of the structure of a fully homomorphic encryption device provided by an embodiment of the present invention, such as Figure 3 As shown, the fully homomorphic encryption device may include the above Figure 2 The fully homomorphic encryption device supporting the block cipher SM4 algorithm is shown. Optionally, the fully homomorphic encryption device 310 may include a first processor 2001.
[0117] Optionally, the fully homomorphic encryption device 310 may also include a memory 2002 and a transceiver 2003 .
[0118] The first processor 2001, the memory 2002 and the transceiver 2003 may be connected via a communication bus.
[0119] Combine the following Figure 3 The components of the fully homomorphic encryption device 310 are specifically introduced:
[0120] The first processor 2001 is the control center of the fully homomorphic encryption device 310, and may be a processor or a general term for multiple processing elements. For example, the first processor 2001 is one or more central processing units (CPUs), or may be application specific integrated circuits (ASICs), or may be one or more integrated circuits configured to implement the embodiments of the present invention, such as one or more microprocessors (digital signal processors, DSPs), or one or more field programmable gate arrays (field programmable gate arrays, FPGAs).
[0121] Optionally, the first processor 2001 can perform various functions of the fully homomorphic encryption device 310 by running or executing a software program stored in the memory 2002 and calling data stored in the memory 2002.
[0122] In a specific implementation, as an embodiment, the first processor 2001 may include one or more CPUs, such as Figure 3 CPU0 and CPU1 are shown in FIG.
[0123] In a specific implementation, as an embodiment, the fully homomorphic encryption device 310 may also include multiple processors, such as Figure 3 The first processor 2001 and the second processor 2004 are shown in FIG. Each of these processors may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0124] The memory 2002 is used to store the software program for executing the solution of the present invention, and is controlled to be executed by the first processor 2001. The specific implementation method can refer to the above method embodiment, which will not be repeated here.
[0125] Optionally, the memory 2002 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 2002 may be integrated with the first processor 2001, or may exist independently, and may be accessed through the interface circuit ( Figure 3 (not shown) is coupled to the first processor 2001, which is not specifically limited in this embodiment of the present invention.
[0126] The transceiver 2003 is used to communicate with a network device or a terminal device.
[0127] Optionally, the transceiver 2003 may include a receiver and a transmitter ( Figure 3 The receiver is used to implement a receiving function, and the transmitter is used to implement a sending function.
[0128] Optionally, the transceiver 2003 may be integrated with the first processor 2001, or may exist independently and communicate with the first processor 2001 through the interface circuit ( Figure 3 (not shown) is coupled to the first processor 2001, which is not specifically limited in this embodiment of the present invention.
[0129] It should be noted that Figure 3 The structure of the fully homomorphic encryption device 310 shown in the figure does not constitute a limitation on the router. The actual knowledge structure identification device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0130] In addition, the technical effects of the fully homomorphic encryption device 310 can refer to the technical effects of the fully homomorphic encryption method supporting the block cipher SM4 algorithm described in the above method embodiment, and will not be repeated here.
[0131] It should be understood that the first processor 2001 in the embodiment of the present invention may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0132] It should also be understood that the memory in the embodiments of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0133] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.
[0134] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship, but it may also indicate an "and / or" relationship. Please refer to the context for specific understanding.
[0135] In the present invention, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0136] It should be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0137] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0138] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0139] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0140] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0141] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0142] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0143] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A fully homomorphic encryption method supporting block cipher SM4 algorithm, characterized in that: The method comprises: S1. Obtaining operating environment information; generating parameters through a preset parameter algorithm according to the operating environment information to obtain security parameters; Wherein, the safety parameters include TRGSW safety parameters, TRLWE safety parameters and TLWE safety parameters; S2. According to the security parameters, a key is generated by a preset fully homomorphic encryption key generation algorithm to obtain a fully homomorphic encryption key; The step of generating a key by using a preset fully homomorphic encryption key generation algorithm according to the security parameter to obtain a fully homomorphic encryption key includes: S21. According to the TRGSW security parameters, a preset fully homomorphic encryption key generation algorithm is used to calculate to obtain a TRGSW key; S22. According to the TRLWE security parameters, a preset fully homomorphic encryption key generation algorithm is used to calculate and obtain a TRLWE key; S23. Calculate the TLWE key using a preset fully homomorphic encryption key generation algorithm according to the TLWE security parameters; S3, using a preset pseudo-random generator to generate a pseudo-random number; according to the pseudo-random number, a key is generated by a preset SM4 key expansion algorithm to obtain an SM4 shared key and a round key; S4, obtaining the plaintext to be encrypted; encrypting the plaintext using the block cipher SM4 algorithm according to the SM4 shared key and the round key to obtain the SM4 ciphertext; S5. Perform fully homomorphic encryption on the SM4 ciphertext according to the fully homomorphic encryption key to obtain a fully homomorphic encrypted ciphertext; The step of performing fully homomorphic encryption on the SM4 ciphertext according to the fully homomorphic encryption key to obtain the fully homomorphic encrypted ciphertext includes: S51, encrypting the SM4 ciphertext according to the TRGSW key to obtain a first TRGSW ciphertext; S52, set the total number of rounds to N, the current number of rounds to i, and set i=1; S53, determine whether i is greater than N, if i is greater than N, then go to step S510, if i is less than or equal to N, then go to step S54; S54, performing nonlinear mapping on the first TRGSW ciphertext based on the S-box after hybrid packing in the lookup table to obtain a second TRGSW ciphertext; S55. Bootstrap the second TRGSW ciphertext according to the TRLWE key to obtain a TRLWE ciphertext. S56. Split and encrypt the TRLWE ciphertext according to the TLWE key to obtain a first TLWE ciphertext. S57, performing a linear transformation on the first TLWE ciphertext to obtain a third TLWE ciphertext; The performing of linear transformation on the first TLWE ciphertext to obtain a third TLWE ciphertext includes: S571, performing row shift processing on the first TLWE ciphertext to obtain a second TLWE ciphertext; S572, performing column obfuscation processing on the second TLWE ciphertext to obtain a third TLWE ciphertext; S58. Based on the PBSmanyLUT algorithm and the TRGSW key, encrypt the third TLWE ciphertext to obtain a third TRGSW ciphertext. The encrypting process of the third TLWE ciphertext based on the PBSmanyLUT algorithm and according to the TRGSW key to obtain the third TRGSW ciphertext includes: S581, using the PBSmanyLUT algorithm to perform noise reduction processing on the third TLWE ciphertext to obtain a fourth TLWE ciphertext; S582. Encrypt the fourth TLWE ciphertext according to the TRGSW key to obtain a third TRGSW ciphertext. S59, determine the third TRGSW ciphertext as the first TRGSW ciphertext; let i=i+1; execute step S52; S510. Determine the first TRGSW ciphertext as a fully homomorphic encrypted ciphertext; and output the fully homomorphic encrypted ciphertext.
2. The fully homomorphic encryption method supporting the block cipher SM4 algorithm according to claim 1, characterized in that: The method of generating a key according to the pseudo-random number by using a preset SM4 key expansion algorithm to obtain an SM4 shared key and a round key includes: S31, determining the pseudo-random number as the SM4 shared key; S32. According to the SM4 shared key, a preset key expansion algorithm is used to generate a key to obtain a round key.
3. A fully homomorphic encryption device supporting a block cipher SM4 algorithm, the fully homomorphic encryption device supporting a block cipher SM4 algorithm is used to implement the fully homomorphic encryption method supporting a block cipher SM4 algorithm as claimed in any one of claims 1-2, characterized in that: The device comprises: A security parameter generation module is used to obtain operating environment information; based on the operating environment information, parameters are generated through a preset parameter algorithm to obtain security parameters; Wherein, the safety parameters include TRGSW safety parameters, TRLWE safety parameters and TLWE safety parameters; A fully homomorphic key generation module, used to generate a key according to the security parameters through a preset fully homomorphic encryption key generation algorithm to obtain a fully homomorphic encryption key; The step of generating a key by using a preset fully homomorphic encryption key generation algorithm according to the security parameter to obtain a fully homomorphic encryption key includes: S21. According to the TRGSW security parameters, a preset fully homomorphic encryption key generation algorithm is used to calculate to obtain a TRGSW key; S22. According to the TRLWE security parameters, a preset fully homomorphic encryption key generation algorithm is used to calculate and obtain a TRLWE key; S23. Calculate the TLWE key using a preset fully homomorphic encryption key generation algorithm according to the TLWE security parameters; The SM4 key generation module is used to generate a pseudo-random number using a preset pseudo-random generator; according to the pseudo-random number, a key is generated by a preset SM4 key expansion algorithm to obtain an SM4 shared key and a round key; The SM4 encryption module is used to obtain the plaintext to be encrypted; according to the SM4 shared key and the round key, the block cipher SM4 algorithm is used to encrypt the plaintext to obtain the SM4 ciphertext; A fully homomorphic encryption module, used to perform fully homomorphic encryption on the SM4 ciphertext according to the fully homomorphic encryption key to obtain a fully homomorphic encrypted ciphertext; The step of performing fully homomorphic encryption on the SM4 ciphertext according to the fully homomorphic encryption key to obtain the fully homomorphic encrypted ciphertext includes: S51, encrypting the SM4 ciphertext according to the TRGSW key to obtain a first TRGSW ciphertext; S52, set the total number of rounds to N, the current number of rounds to i, and set i=1; S53, determine whether i is greater than N, if i is greater than N, then go to step S510, if i is less than or equal to N, then go to step S54; S54, performing nonlinear mapping on the first TRGSW ciphertext based on the S-box after hybrid packing in the lookup table to obtain a second TRGSW ciphertext; S55. Bootstrap the second TRGSW ciphertext according to the TRLWE key to obtain a TRLWE ciphertext. S56. Split and encrypt the TRLWE ciphertext according to the TLWE key to obtain a first TLWE ciphertext. S57, performing a linear transformation on the first TLWE ciphertext to obtain a third TLWE ciphertext; The performing of linear transformation on the first TLWE ciphertext to obtain a third TLWE ciphertext includes: S571, performing row shift processing on the first TLWE ciphertext to obtain a second TLWE ciphertext; S572, performing column obfuscation processing on the second TLWE ciphertext to obtain a third TLWE ciphertext; S58. Based on the PBSmanyLUT algorithm and the TRGSW key, encrypt the third TLWE ciphertext to obtain a third TRGSW ciphertext. The encrypting process of the third TLWE ciphertext based on the PBSmanyLUT algorithm and according to the TRGSW key to obtain the third TRGSW ciphertext includes: S581, using the PBSmanyLUT algorithm to perform noise reduction processing on the third TLWE ciphertext to obtain a fourth TLWE ciphertext; S582. Encrypt the fourth TLWE ciphertext according to the TRGSW key to obtain a third TRGSW ciphertext. S59, determine the third TRGSW ciphertext as the first TRGSW ciphertext; let i=i+1; execute step S52; S510. Determine the first TRGSW ciphertext as a fully homomorphic encrypted ciphertext; and output the fully homomorphic encrypted ciphertext.
4. A fully homomorphic encryption device, characterized in that: The fully homomorphic encryption device comprises: processor; A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 2 is implemented.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 2.
Citation Information
Patent Citations
Symmetric fully-homomorphic encryption method based on plaintext similarity matrix
CN107294697A
Authorizable financial data privacy processing and sharing method on block chain
CN112685760A
Homomorphic decryption method and device, nonvolatile storage medium and computer equipment
CN116192361A
System and method for user-controllable sharing of authorization for private data
US20230351035A1
