Optimized encryption and decryption method and system based on improved Paillier algorithm
By improving the Paillier algorithm and combining it with the pre-calculated noise pool and Montgomery modular multiplication technology, the encryption and decryption process of the Paillier algorithm is optimized, the low efficiency problem in the existing technology is solved, and efficient calculation of the encryption and decryption process is achieved.
Patent Information
- Application Number
- CN202211639661.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-12-20
Smart Images

Figure CN115996117B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a technology in the field of information security, specifically an optimized encryption and decryption method and system based on an improved Paillier algorithm for large integer modular exponentiation operations. Background Art
[0002] The Paillier algorithm, a semi-homomorphic encryption algorithm proposed by Pascal Paillier in 1999, has been successfully deployed on various security platforms. However, the Paillier algorithm's encryption and decryption processes involve large-scale and time-consuming modular exponentiation operations, which significantly impacts operational efficiency. Improving the Paillier algorithm's operational efficiency across various security platforms while ensuring the security of ciphertext data remains an unresolved issue. Summary of the Invention
[0003] In response to the problems of low efficiency of existing Paillier algorithm encryption implementation and security issues of existing Paillier algorithm hardware acceleration solutions, the present invention proposes an optimized encryption and decryption method and system based on an improved Paillier algorithm. The method adopts provably secure noise technology to generate a pre-calculated Paillier security noise pool and accelerates the encryption algorithm based on an improved Paillier encryption scheme, accelerates the Paillier encryption and decryption algorithm based on the Chinese remainder theorem, and accelerates the Paillier ciphertext modular multiplication algorithm based on an improved Montgomery modular multiplication algorithm implemented by assembly and packing technology, thereby significantly improving computational efficiency.
[0004] The present invention is achieved through the following technical solutions:
[0005] The present invention relates to an optimized encryption and decryption method based on an improved Paillier algorithm. The method comprises the following steps: initializing parameters according to an improved Paillier encryption scheme, initializing a security noise pool using selected parameters and a provably secure noise technology, reading plaintext and packing the plaintext, encrypting the packed plaintext using the selected parameters, the security noise pool, the improved Paillier encryption scheme and the improved Montgomery modular multiplication algorithm, mapping the packed plaintext to a Montgomery remainder domain, and then performing modular multiplication acceleration calculation, finally mapping the Montgomery remainder back to a ciphertext domain to obtain ciphertext, decrypting the ciphertext using a Paillier decryption function to obtain packed plaintext, and performing unpacking processing to obtain the original plaintext.
[0006] The present invention relates to a system for implementing the above method, comprising: a management module, a security noise module, a Montgomery module, an encryption module, a decryption module and a ciphertext modular multiplication module, wherein: the management module initializes and obtains a key according to the improved Paillier encryption scheme according to system requirements, outputs the public key to all other modules, outputs the private key to the decryption module, and generates a security factor and outputs it to the security noise module; the security noise module pre-obtains a security noise pool according to the public key parameters and the security factor required by the system, and obtains the actual security factor of the noise pool; the Montgomery module obtains initialization Montgomery parameters R and n′ through the improved Montgomery algorithm according to the number of bits of the computer system and the public key parameters, obtains a modular multiplication result through the improved Montgomery fast modular multiplication, and maps the ciphertext to the Montgomery remainder field or converts the Montgomery remainder to the ciphertext field to obtain a mapping result; the encryption The module packs the plaintext according to the packing length, public key parameters, Montgomery parameters and security noise pool to obtain the packed plaintext, calls the security noise module to obtain security noise, obtains the encrypted ciphertext through the improved Paillier encryption scheme, and calls the Montgomery module to map the ciphertext to the Montgomery remainder field to obtain the Montgomery remainder of the ciphertext; the decryption module calls the Montgomery module according to the public and private key parameters, Montgomery parameters and packing length to map the Montgomery remainder of the ciphertext back to the ciphertext field, and obtains the packed plaintext through the Chinese remainder theorem twice, and unpacks the packed plaintext to obtain the unpacked plaintext; the ciphertext modular multiplication module calls the Montgomery module according to the public key parameters and Montgomery parameters to perform fast modular multiplication to obtain the Montgomery remainder of the ciphertext modular multiplication result, and maps the Montgomery remainder of the ciphertext modular multiplication result to the ciphertext field to obtain the ciphertext modular multiplication result.
[0007] Technical Effects
[0008] The present invention is based on the secure noise pool technology of the improved Paillier encryption scheme, which significantly improves the security of the system. At the same time, it reduces one large number multiplication operation by improving Montgomery modular multiplication and adds four large number addition operations, thereby improving computational efficiency. The pre-calculated secure noise pool technology is adopted to improve the encryption computation efficiency under the condition of the same pre-calculation overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 This is a system structure diagram of the present invention;
[0010] Figure 2 This is an embodiment of the encryption module of the present invention;
[0011] Figure 3 This is an embodiment of the safety noise module of the present invention;
[0012] Figure 4 This is an embodiment of the Montgomery module of the present invention;
[0013] Figure 5 This is a flow chart of the system of the present invention. DETAILED DESCRIPTION
[0014] like Figure 1 As shown, this embodiment relates to an optimized encryption and decryption system based on an improved Paillier algorithm, including: a management module, a security noise module, a Montgomery module, an encryption module, a decryption module and a ciphertext modular multiplication module, wherein: the management module initializes and obtains a key according to the improved Paillier encryption scheme according to system requirements, outputs the public key to all other modules, outputs the private key to the decryption module, and generates a security factor and outputs it to the security noise module; the security noise module pre-obtains a security noise pool according to the public key parameters and the security factor required by the system, and obtains the actual security factor of the noise pool; the Montgomery module obtains the initialization Montgomery parameters R and n′ through the improved Montgomery algorithm according to the number of bits of the computer system and the public key parameters, obtains the modular multiplication result through the improved Montgomery fast modular multiplication, and maps the ciphertext to the Montgomery remainder field or the Montgomery remainder to the ciphertext field Obtain the mapping result; the encryption module packs the plaintext according to the packing length, public key parameters, Montgomery parameters and security noise pool to obtain packed plaintext, calls the security noise module to obtain security noise, obtains the encrypted ciphertext through the improved Paillier encryption scheme, and calls the Montgomery module to map the ciphertext to the Montgomery remainder field to obtain the Montgomery remainder of the ciphertext; the decryption module calls the Montgomery module according to the public and private key parameters, Montgomery parameters and packing length to map the Montgomery remainder of the ciphertext back to the ciphertext field, and obtains the packed plaintext through the Chinese remainder theorem twice, and unpacks the packed plaintext to obtain the unpacked plaintext; the ciphertext modular multiplication module calls the Montgomery module according to the public key parameters and Montgomery parameters to perform fast modular multiplication to obtain the Montgomery remainder of the ciphertext modular multiplication result, and maps the Montgomery remainder of the ciphertext modular multiplication result to the ciphertext field to obtain the ciphertext modular multiplication result.
[0015] The management module includes: a key generation unit and a security factor unit, wherein: the key generation unit initializes the key according to the improved Paillier encryption scheme according to system requirements, outputs the public key to all other modules, and outputs the private key to the decryption module, while the security factor unit generates a security factor according to system requirements and outputs it to the security noise module.
[0016] The security noise module pre-obtains a security noise pool based on the public key parameters received from the management module and the security factor required by the system, and obtains the actual security factor of the noise pool.
[0017] The Montgomery module includes: a Montgomery initialization unit, a Montgomery fast modular multiplication unit and a Montgomery mapping unit, wherein: the Montgomery initialization unit obtains Montgomery parameters R and n′ by initializing the improved Montgomery algorithm according to the number of bits of the computer system and the public key parameters; the Montgomery fast modular multiplication unit performs Montgomery fast modular multiplication by the improved Montgomery algorithm according to the public key parameters and the Montgomery parameters to obtain a modular multiplication result; the Montgomery mapping unit maps the ciphertext to the Montgomery remainder field or the Montgomery remainder to the ciphertext field according to the public key parameters and the Montgomery parameters to obtain a mapping result.
[0018] The encryption module includes: a packing unit, a noise calculation unit and an encryption unit, wherein: the packing unit packs the plaintext according to the packing length to obtain the packed plaintext; the noise calculation unit calls the security noise module according to the public key parameter to obtain the security noise; the encryption unit obtains the encrypted ciphertext through the improved Paillier encryption scheme according to the public key parameter, the Montgomery parameter and the security noise pool, and calls the Montgomery module to map the ciphertext to the Montgomery remainder field to obtain the Montgomery remainder of the ciphertext.
[0019] The decryption module includes: a decryption unit and an unpacking unit, wherein: the decryption unit calls the Montgomery module to map the Montgomery remainder of the ciphertext back to the ciphertext domain according to the public and private key parameters and the Montgomery parameters, and decrypts the ciphertext twice to obtain the packaged plaintext; the unpacking unit unpacks the packaged plaintext according to the package length to obtain the unpacked plaintext.
[0020] The ciphertext modular multiplication module includes: a fast modular multiplication operation unit and a ciphertext modular multiplication return unit, wherein: the fast modular multiplication operation unit calls the Montgomery module to perform fast modular multiplication according to the public key parameters and the Montgomery parameters to obtain the Montgomery remainder of the ciphertext modular multiplication result; the ciphertext modular multiplication return unit calls the Montgomery module according to the Montgomery parameters to map the Montgomery remainder of the ciphertext modular multiplication result to the ciphertext domain to obtain the ciphertext modular multiplication result.
[0021] This embodiment is based on the optimization method of the above system, including the following steps:
[0022] In the first step, the management module generates the public key (n, h) and private key λ required by Paillier, specifically:
[0023] 1.1) Select large prime numbers p and q: The key generation unit randomly selects two large prime numbers p and q. The two prime numbers must satisfy the following conditions: p and q have the same number of bits and are multiples of 256. The specific number of bits is determined according to system requirements, and gcd(p-1,q-1)=2, p≡q≡3(mod 4), where gcd represents the greatest common divisor.
[0024] 1.2) Calculate the values of n and λ: The key generation unit calculates n=pq, λ=(p-1)(q-1) / 2;
[0025] 1.3) Calculate the value of h: The key generation unit randomly selects Calculate h = -x 2n (mod n 2 );
[0026] 1.4) The key generation unit outputs the public key to all other modules and the private key to the decryption module;
[0027] 1.5) Generate safety factor SEC_IND: The safety factor unit of the management module generates a safety factor SEC_IND according to system requirements and outputs it to the safety noise module, where SEC_IND is a positive integer, generally greater than 100;
[0028] In the second step, the Montgomery initialization unit of the Montgomery module obtains the Montgomery parameters R and n′ by initializing the improved Montgomery algorithm according to the number of bits of the computer system and the public key parameters. Specifically,
[0029] 2.1) Calculate R: Montgomery initialization unit calculates R = 2 N , where: N is the modulus n 2 The number of bits is a multiple of 1024;
[0030] 2.2) Calculate n': For a 64-bit system, the Montgomery initialization unit will calculate n'=-(n 2 ) -1 (mod 2 64 ), where: n 2 The calculation process is realized by assembly. Unlike the original Montgomery algorithm, the modulus of the n′ formula of the present invention is 2 64 Instead of R; to improve the compilation efficiency, the present invention will calculate according to the following steps:
[0031] 2.2.1) Calculate (n 2 ) -1 (mod 16): Montgomery initialization unit calculation (n 2 ) -1 (mod 16) = n4 + ((n4 + 2) & 4) < < 1, where n4 is n 2 The calculation involves two addition operations, one AND operation, and one shift operation, and the assembly implementation is highly efficient.
[0032] 2.2.2) Calculate (n 2 ) -1 (mod 2 64 ):make set up If \(i\) is a positive integer, then There is a recurrence formula Then the Montgomery initialization unit obtains according to the recurrence formula and 2.2.1) the value of, and further obtains the value of is \((n 2 ) -1 (mod 2 64 )
[0033] 2.2.3) Calculate \(n'=-(n 2 ) -1 (mod 2 64 ): The Montgomery initialization unit takes the negative of the result of 2.2.2), that is, takes the complement of the result of 2.2.2) and then adds 1 to get \(n'\), which has high efficiency through assembly implementation;
[0034] Third step, the secure noise module pre - calculates the secure noise pool, specifically:
[0035] 3.1) Initialize parameters \(k\) and \(L\): The secure noise module selects parameters \(k\) and \(L\) according to the system security coefficient \(SEC\_iND\) received from the management module in 1.5), satisfying the actual security coefficient of the noise pool
[0036] 3.2) Pre - calculate the secure noise pool \(Pool\): The secure noise module pre - calculates \(k\) pseudo - random numbers \(r i and noise where: \(0 < r i < n / 2, 1\leq i\leq k\). Store the \(k\) noises in the secure noise pool to form the secure noise pool \(Pool\), numbered from 1 to \(k\); When encrypting, \(L\) noises will be selected from the secure noise pool for modular multiplication calculation, and the modular multiplication result will be used as the noise for encryption;
[0037] Fourth step, for a 64 - bit system, the system obtains a total of \(NUM\) plaintexts \(m1,\ldots,m NUM , and the plaintext satisfies that the bit length of the plaintext and is \(B1 = 64\).
[0038] Fifth step, the encryption module selects the packing length \(W\): For a 64 - bit system, the packing unit of the encryption module selects the maximum packing length \(W\) that satisfies the bit length of a single plaintext after packing where: \(N\) is the number of bits of the public key parameter \(n 2 in the first step.
[0039] Sixth step, the encryption module packs the plaintext to obtain the packed plaintext \(M j , specifically including:
[0040] 6.1) Plaintext grouping and zero padding: The packing unit is based on the plaintext m1, ..., m obtained in step 3. NUM , use zero padding to fill all plaintexts to B' bits, group NUM plaintexts into groups of W, and when a group is less than W plaintexts, add all-zero plaintext to complete it, so the total plaintext groups;
[0041] 6.2) Plaintext Packaging: For example Figure 2 As shown, for the jth group of plaintext m jW+1 ,…m jW+W ,in: The packing unit packs the plaintext group to obtain a plaintext of fixed length in: is the bit string concatenation operator;
[0042] Step 7: The encryption module encodes the plaintext M j Encrypt to obtain ciphertext c j , and the ciphertext c j Mapping to the Montgomery remainder field to obtain the Montgomery remainder C of the ciphertext j , specifically including:
[0043] 7.1) Obtaining security noise: The noise calculation unit generates L pseudo-random numbers k based on the Paillier encryption public key (n, h) obtained in the first step, the parameters k and L obtained in 3.1) and the security noise pool Pool obtained in 3.2). i , satisfying 1≤k i ≤k, take out L security noises from the security noise pool Pool
[0044] 7.2) Calculate the noise r: The noise calculation unit is based on the L safety noises in 7.1) calculate
[0045] 7.3) Calculate the Montgomery remainder C of the ciphertext j :The encryption unit obtains the packed plaintext M based on the Paillier encryption public key (n, h), the Montgomery algorithm parameter R, the noise r calculated in 7.2) and 6.2) j , calculate the ciphertext c j =r(1+M j n)(modn 2 )
[0046] And calculate the Montgomery remainder C j =c j *R(mod n 2 ),in:
[0047] Step 8. The ciphertext modular multiplication module performs fast modular multiplication on the Montgomery remainders C1, … of the ciphertext according to the improved Montgomery modular multiplication algorithm, and maps the modular multiplication result of the Montgomery remainder to the ciphertext domain to obtain the ciphertext modular multiplication result, specifically including: 8.1) Initialization settings: The fast modular multiplication operation unit sets A = C1, j = 2, and pre - calculates tmp = n′*n
[0048] (mod R) according to the public key parameters (n, h) obtained in Step 1 and the Montgomery parameters n′ and R obtained in 2.2); 2 (mod R);
[0049] 8.2) Start of the modular multiplication calculation loop: The fast modular multiplication operation unit sets B = C j ;
[0050] 8.3) Modular multiplication calculation: The fast modular multiplication operation unit of the ciphertext modular multiplication module calls the Montgomery module to calculate A = A*B*R -1 (mod n 2 ), specifically including:
[0051] 8.3.1) Initialization parameters: The Montgomery module stores A and B into 64 - bit integer arrays A[] and B[] respectively, the array size is and takes i = 0, remainder r = 0; sets l = 0, cadd = 0, and pre - calculates tmp = n′*n 2 ;
[0052] 8.3.2) One multiplication and two additions: The Montgomery module calculates tmpl = A[i]*B[i]+r[l]+cadd, r[l] = tmpl(mod 2 64 ), cadd = (tmpl - r[l]) >> 64; calculates l = l + 1, if l < SIZE, then go back to the start of 8.3.2), otherwise set r[l] = cadd, l = 0, d = r[0], cadd = 0;
[0053] 8.3.3) One multiplication and two additions: Calculate tmpl = d*tmp[l]+r[l]+cadd, r[l] = tmpl(mod 2 64 ), cadd = (tmpl - r[l]) >> 64; calculates l = l + 1, if l < SIZE + 1, then go back to the start of 8.3.3), otherwise set r[l] = cadd, l = 0, cadd = 0, and shift the large integer r to the right by 64 bits; calculates i = i + 1, when i < SIZE, go back to 8.3.2); set cadd = r[SIZE];
[0054] 8.3.4) Calculate the modular multiplication result A: Calculate tmpl = r[l] + cadd, r[l] = tmpl (mod 2 64 ), cadd = (tmpl - r[l]) >> 64; Calculate l = l + 1, if l < SIZE, then go back to 3.5) to start, otherwise set l = 0; Output A = r as the modular multiplication result;
[0055] 8.4) Next loop: The ciphertext modular multiplication module calculates j = j + 1, if j ≤ NUM, then return to 8.2);
[0056] 8.5) Map the modular multiplication calculation result to the ciphertext domain: The ciphertext modular multiplication module calls the Montgomery mapping unit to calculate the ciphertext c = A * R -1 (mod n 2 ), c is the ciphertext modular multiplication result.
[0057] In the ninth step, the decryption module decrypts the ciphertext c using the Paillier decryption function according to the public and private key parameters in the first step to obtain the plaintext M, and unpacks it to obtain the plaintext and SUM. Specifically, it includes:
[0058] 9.1) Calculate M′ = c λ (mod n 2 ): The decryption unit calculates hp = c λ [[ID=2〕](mod p 2 ) and hq = c λ (mod q 2 ), so there are congruence relations M′ ≡ hp (mod p 2 ), M′ ≡
[0059] hq (mod q 2 ), and M′ is obtained according to the congruence relation using the Chinese Remainder Theorem.
[0060] [[ID=4〔〕9.2) Decrypt to obtain the plaintext M: The decryption unit calculates [[ID=〔〕2]] and 」 [[ID=〔〕5]] so there are congruence relations M ≡ mp (mod p), M ≡ mq (mod q), and M is obtained according to the congruence relation using the Chinese Remainder Theorem.
[0061] 9.3) Unpack the plaintext M: The unpacking unit calculates according to [[ID=5〔〕]] to obtain m′₁,..., m′ W , where: W is the packing length in the fifth step;
[0062] 」9.4) Calculate the plaintext sum SUM: The unpacking unit finally obtains the plaintext sum
[0063] After specific actual experiments, the above system was run with different parameters under the specific environment settings of Linux Ubuntu 18.04 operating system, 32-core Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz, 64GB of memory and 500GB of disk. The experimental data that can be obtained are shown in the following table, where: the duration is the duration of the present invention / the duration of the existing algorithm.
[0064]
[0065] Compared with existing technologies, the performance indicators of this system are improved in the following aspects:
[0066] The first aspect is the improvement of encryption efficiency. Specifically, compared with the existing encryption technology, the encryption algorithm of the present invention is different in that the pre-calculation technology adopted is different. The present invention adopts the pre-calculation security noise pool technology. Each time encryption is performed, L security noises will be taken out from the security noise pool. Calculating noise And calculate the ciphertext c j =r(1+M j n)(mod n 2 ), so each encryption requires L modular multiplication operations and a pre-calculation overhead of size k; the existing pre-calculation technology is exponential window pre-calculation, which performs exponential operation on the result h i Pre-calculation, where: i is 2 lw *1, 2 lw *2,2 lw *3, ..., 2 lw *(2 w -1), w is the window size, Each encryption requires an average of The sum of the modular multiplication operations is The pre-calculation overhead of the existing technology is The number of modular multiplication operations is significantly greater than the L modular multiplication operations of the present invention, so the present invention can improve the efficiency of encryption calculations;
[0067] Secondly, the efficiency of ciphertext modular multiplication is improved. Specifically, the Montgomery parameter initialization based on the recursive formula is used. In terms of the efficiency of calculating the Montgomery parameters, 2.2.1) requires two addition operations, one AND operation, and one shift operation, 2.2.2) requires four addition operations and eight multiplication operations, and 2.2.3) requires one addition operation and one inversion operation, while the original Montgomery algorithm requires the formula n′=-(n 2 ) -1 (mod 2 N) performs a large number inverse operation. According to Fermat's little theorem, the original Montgomery algorithm needs to perform N-1 modular multiplication operations and N large number addition operations, which is much more than the amount of calculation required by the present invention. Therefore, the present invention can significantly improve the calculation efficiency when initializing n'; the improved Montgomery modular multiplication algorithm based on array calculation is compared with the calculation efficiency of the original Montgomery algorithm. The original algorithm needs to follow the formula t = A * B, t' = t * n' (mod R), Calculation is performed, where R and n' are Montgomery parameters, a total of three large number multiplication operations and one large number addition operation (modulus operation and division operation due to R = 2 N It can be regarded as a shift operation, and the computational overhead is negligible). The improved algorithm of the present invention mainly has computational overhead in 8.3.2) to 8.3.4), where: 8.3.2) corresponds to one large number multiplication operation and two large number addition operations, 8.3.3) corresponds to one large number multiplication operation and two large number addition operations, and 8.3.4) corresponds to one large number addition operation. Therefore, 8.3.2) to 8.3.4) involve a total of two large number multiplication operations and five large number addition operations. Therefore, the improved Montgomery modular multiplication can reduce one large number multiplication operation, increase four large number addition operations, and improve computational efficiency.
[0068] The above-mentioned specific implementation can be partially adjusted in different ways by those skilled in the art without departing from the principles and purpose of the present invention. The scope of protection of the present invention shall be based on the claims and shall not be limited by the above-mentioned specific implementation. All implementation schemes within its scope shall be subject to the constraints of the present invention.
Claims
1. An optimized encryption and decryption method based on an improved Paillier algorithm, characterized in that: include: Initialize the parameters and use the selected parameters and provably secure noise technology to initialize the secure noise pool. Read the plaintext and pack it. Use the selected parameters, secure noise pool, improved Paillier encryption scheme, and improved Montgomery modular multiplication algorithm to encrypt the packed plaintext and map it to the Montgomery remainder domain, then perform modular multiplication acceleration calculation. Finally, map the Montgomery remainder back to the ciphertext domain to obtain the ciphertext. Decrypt the ciphertext using the Paillier decryption function to obtain the packed plaintext, and then unpack it to obtain the original plaintext. The improved Paillier encryption scheme is used to generate the public key and private key , specifically including: choosing a large prime number and : Randomly select two large prime numbers and and satisfy and The number of bits is the same and is a multiple of 256, and there is , ,in: Indicates finding the greatest common divisor; calculation and Value of: Calculate ;calculate Value: Randomly selected ,calculate ; Generate safety factor according to system requirements Output to the safety noise module, where: is a positive integer; The improved Montgomery modular multiplication algorithm is used to generate Montgomery parameters and , specifically including: calculation ,in: is the modulus The number of bits is a multiple of 1024; for a 64-bit system, the modulus is calculated as Parameters ,in: is the modulus.
2. The optimized encryption and decryption method based on the improved Paillier algorithm according to claim 1 is characterized in that: The improved Montgomery modular multiplication algorithm is implemented by assembly, specifically including: 1) Calculation :set up The lowest four digits are , since the only ones that are coprime with 16 are 1, 3, 5, 7, 9, 11, 13, and 15, we have or , and then get ,Involves two addition operations, one AND operation and one shift operation, and the assembly implementation is efficient; 2) Calculation :make ,set up , is a positive integer, then ; Then there is a recursive formula ; According to the recursive formula and step 1) we get The value of ; 3) Calculation : Negate the result of step 2), that is, negate the result of step 2) and add 1 to get , high efficiency is achieved through assembly.
3. The optimized encryption and decryption method based on the improved Paillier algorithm according to claim 1 is characterized in that: The initialization of the safety noise pool is to select the parameters and ; Precompute before encryption pseudo-random numbers and noise ,in: , ,Will The noise is stored in the safe noise pool to form a safe noise pool ,serial number arrive ; When encrypting, it will be selected from the security noise pool The noise is multiplied modularly, and the result of the modular multiplication is used as the noise used for encryption; at the same time, the security noise pool also calculates the actual safety factor of the noise pool To ensure safety Should take more than 100,000, Take 8 or more, where: safety refers to and When it is large enough, even if the attacker obtains the value of all noises through hardware attacks, the probability of the attacker guessing the noise used for encryption is still negligible.
4. The optimized encryption and decryption method based on the improved Paillier algorithm according to claim 1 is characterized in that: The plaintext packaging mentioned above refers to: let the Paillier algorithm modulus The bit length is , select the maximum packing length as ,satisfy ; Use zero padding to total plaintext bits to fill bits, get the plaintext after bit filling ; will total plaintext by Group them into a group, , when a set of plaintext is insufficient For the first Group Plaintext , , , pack the plaintext group into bits of length Plaintext ,in: It is a bit string concatenation operator; the bit length of a single plaintext after packaging , the bit length of the plaintext group .
5. The optimized encryption and decryption method based on the improved Paillier algorithm according to claim 3 is characterized in that: The encryption and mapping to the Montgomery remainder field refers to: using Paillier encryption public key , Montgomery parameters and safety noise pools Packed plaintext Encrypt to get the ciphertext, and map the ciphertext to the Montgomery remainder field to get the Montgomery remainder of the ciphertext , specifically: generate pseudo-random numbers ,satisfy ,from Take out Safety noise , calculate the noise ; Calculate ciphertext and calculate the Montgomery remainder .
6. The optimized encryption and decryption method based on the improved Paillier algorithm according to claim 1 is characterized in that: The modular multiplication acceleration calculation and mapping to the ciphertext domain refers to: The first step is to accelerate the calculation of modular multiplication: calculation , where A and B are ciphertexts in the Montgomery remainder field, specifically including: 1) Initialization: and Treated as an array of 64-bit integers and , the array size is , and take , remainder ;set up , , precomputed ; 2) Calculation , , ;calculate ,like , then return to step 2) and start, otherwise set , , , ; 3) Calculation , , ;calculate ,like , then return to step 3) and start, otherwise set , , , large integer Shift right 64 bits; calculate ,when , return to step 2); set ; 4) Calculation , , ; Output is the modular multiplication result; The second step is to map the Montgomery modular multiplication result back to the original ciphertext domain: calculate the ciphertext That’s what you want.
7. The optimized encryption and decryption method based on the improved Paillier algorithm according to claim 1 is characterized in that: The decryption operation specifically includes: The first step is to calculate :set up For ciphertext, according to the private key calculate and , so there is a congruence relationship ,in: , is the large prime number in 1.1), and according to the congruence relation, we can use the Chinese remainder theorem to get ; The second step is to decrypt the plaintext by a modular exponentiation calculation. :According to the private key calculate and , so there is a congruence relationship , according to the congruence relation, we can use the Chinese remainder theorem to get .
8. The optimized encryption and decryption method based on the improved Paillier algorithm according to claim 1 is characterized in that: The unpacking process is to To unpack, ,get , , and plaintext and ,in: is the bit string concatenation operator, is the packing length.
9. A system for implementing the optimized encryption and decryption method based on the improved Paillier algorithm as described in any one of claims 1 to 8, characterized in that: include: Management module, security noise module, Montgomery module, encryption module, decryption module and ciphertext modular multiplication module, wherein: the management module initializes the key according to the improved Paillier encryption scheme according to system requirements, outputs the public key to all other modules, outputs the private key to the decryption module, and generates a security factor and outputs it to the security noise module; the security noise module pre-obtains the security noise pool according to the public key parameters and the security factor required by the system, and obtains the actual security factor of the noise pool; the Montgomery module obtains the initialization Montgomery parameters through the improved Montgomery algorithm according to the number of bits of the computer system and the public key parameters and , obtain the modular multiplication result through the improved Montgomery fast modular multiplication, and map the ciphertext to the Montgomery remainder field or the Montgomery remainder to the ciphertext field to obtain the mapping result; the encryption module packs the plaintext according to the packing length, public key parameters, Montgomery parameters and security noise pool to obtain packed plaintext, calls the security noise module to obtain security noise, obtains the encrypted ciphertext through the improved Paillier encryption scheme, and calls the Montgomery module to map the ciphertext to the Montgomery remainder field to obtain the Montgomery remainder of the ciphertext The decryption module calls the Montgomery module according to the public and private key parameters, the Montgomery parameters and the packing length to map the Montgomery remainder of the ciphertext back to the ciphertext domain, and obtains the packed plaintext through the Chinese remainder theorem twice, and unpacks the packed plaintext to obtain the unpacked plaintext; the ciphertext modular multiplication module calls the Montgomery module according to the public key parameters and the Montgomery parameters to perform fast modular multiplication to obtain the Montgomery remainder of the ciphertext modular multiplication result, and maps the Montgomery remainder of the ciphertext modular multiplication result to the ciphertext domain to obtain the ciphertext modular multiplication result.
Citation Information
Patent Citations
Paillier decryption system, chip and method
CN112988237A
Multi-party secure computing method and device
CN114793155A