A privacy-preserving matrix multiplication calculation method and device based on homomorphic encryption
Through the combination of homomorphic encryption and large step and small step algorithm, efficient privacy-preserving matrix multiplication calculation is realized, which solves the problems of low efficiency and insufficient security of matrix multiplication in the existing technology, improves computing performance and security, and is suitable for Multi-center data computing scenario.
Patent Information
- Application Number
- CN202410956185.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-17
AI Technical Summary
The existing matrix multiplication calculation efficiency under homomorphic encryption is low, the ciphertext size is expanded, and the types of operations are limited. Especially in multi-center data computing scenarios, it is difficult to meet the analysis efficiency requirements of machine learning and deep learning algorithms, and existing optimization solutions There are deficiencies in security and computing performance.
Using a privacy-preserving matrix multiplication calculation method based on homomorphic encryption, through a three-party secure matrix multiplication protocol, participating entities jointly generate encryption parameters and keys, and use the large step and small step algorithm to perform matrix transformation and rotation to achieve efficient ciphertext matrix multiplication. Ensure privacy protection of matrix multiplication results.
It significantly improves the efficiency and security of matrix multiplication, reduces the number of ciphertext rotations and multiplication depth, improves ciphertext space utilization, and ensures that private information cannot be leaked in actual secure computing scenarios. The overall performance is better than existing solutions.
Smart Images

Figure CN118509156B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of privacy protection technology, and in particular relates to a privacy protection matrix multiplication calculation method and device based on homomorphic encryption. Background Art
[0002] With the advent of the big data era, in order to obtain more convincing analysis and research results, cross-institutional and multi-center data computing models are gradually emerging, which also brings great challenges to the security issues in the use of data. In this regard, homomorphic encryption, as a special form of encryption, allows various basic computing operations to be performed directly on encrypted information. The results are basically consistent with the corresponding calculations in plaintext, which can greatly improve the confidentiality and reliability of the calculation. However, due to problems such as the expansion of ciphertext size and limited types of operations, the efficiency of ciphertext operations under homomorphic encryption is still very insufficient, especially for matrix multiplication under ciphertext. The original scheme will repeatedly multiply, add, and rotate each matrix element, which requires a lot of storage space and computing resources. Given two matrices of size The matrix to be multiplied, each matrix needs to be multiplied by The complexity of the number of ciphertext rotations is , which is difficult to meet the needs of practical applications and has a great negative impact on the overall analysis efficiency of various machine learning and deep learning algorithms under ciphertext.
[0003] In response to this, data security experts have also proposed various optimized ciphertext matrix multiplications. The two existing schemes that are closest to the scheme proposed in this patent are: (1) the conventional scheme proposed by Jiang et al. in "Secure Outsourced Matrix Computation and Application to Neural Networks" published in 2018. In this scheme, each matrix only needs one ciphertext expression, and the number of ciphertext rotations is reduced to (2) A scheme for small matrix multiplication proposed by Rizomiliotis et al. in On Matrix Multiplication with Homomorphic Encryption (2022). In this scheme, each matrix also requires only one ciphertext expression, and the number of ciphertext rotations is reduced to .
[0004] The scheme proposed by Jiang et al. consumes 3 layers of multiplication depth. Compared with the original scheme (which consumes only 1 layer), it often needs to choose a larger polynomial degree and polynomial coefficient modulus in terms of encryption parameters (which also means a larger ciphertext size expansion), resulting in poor computational performance and flexibility. And compared with the original scheme, although the number of ciphertext rotations is greatly reduced, there is still room for optimization.
[0005] Another scheme proposed by Rizomiliotis et al. has improved the number of ciphertext rotations compared to the previous scheme, and the multiplication depth consumption has also been reduced from 3 to 2, but the ciphertext space utilization is very limited, with only (In contrast, the scheme proposed by Jiang et al. has a ciphertext space utilization rate of 100%), which is only suitable for small-size matrix multiplication scenarios.
[0006] In addition, in scenarios where security protection is actually required, there are often multiple participants, and the two matrices to be multiplied often come from different providers, and the recipient of the matrix multiplication result is likely to be a third party. In this case, the provider usually does not want to expose its private matrix information, and the recipient of the result does not want to expose his or her result to other entities in many cases. Since both schemes only use a single private key homomorphic encryption method, in the above scenario, the generator of the private key can decrypt all information, which poses a great security risk. Summary of the invention
[0007] The purpose of the present invention is to provide a privacy-preserving matrix multiplication calculation method and device based on homomorphic encryption to address the deficiencies in the prior art.
[0008] According to a first aspect of the present invention, a privacy-preserving matrix multiplication calculation method based on homomorphic encryption is provided. In this method, the participating entities include two data providing institutions and one data using institution. The two data providing institutions are matrix provider 1 and matrix provider 2 respectively. The matrix size provided by matrix provider 1 is , the matrix size provided by the matrix provider 2 is ,and , the data user is a matrix multiplication result obtainer, and the method includes:
[0009] All participating entities generate an encryption environment, jointly determine encryption parameters, and jointly generate a public key, a private key, and a calculation key, wherein the calculation key includes a multiplication key and a rotation key;
[0010] Each matrix provider encodes the matrix to be multiplied that it owns into a one-dimensional array, and then encodes the one-dimensional array into a plaintext polynomial and encrypts it before sending it to the result obtainer;
[0011] The result obtainer performs ciphertext matrix multiplication, and uses the big-step small-step algorithm to shift each row of the ciphertext matrix from matrix provider 1 to the left by multiple bits. Transform The transformed ciphertext matrix is rotated left several times to obtain The ciphertext matrix is completed Transformation: The ciphertext matrix from matrix provider 2 is shifted up multiple positions per column using the big-step small-step algorithm. Transform The transformed ciphertext matrix is rotated left several times to obtain The ciphertext matrix is completed transform The transformed ciphertext matrix is The ciphertext matrix obtained by the transformation is multiplied and added ciphertext by ciphertext to obtain the ciphertext matrix multiplication result;
[0012] All participating entities jointly participate in the decryption, and the result obtainer finally obtains the plaintext of the matrix multiplication result.
[0013] Furthermore, the encryption parameters include the ciphertext capacity n, the ciphertext polynomial coefficient range , Private Key Distribution , Noise Distribution and magnification ,in ,yes The product of different prime numbers, is the value of the i-th prime number.
[0014] Furthermore, the rotation key is used for ciphertext rotation, and the generation process includes:
[0015] Any participant in the range 0 to The range is uniformly sampled to obtain a polynomial group;
[0016] All participating entities generate their own partial rotation keys based on the polynomial group, their own private keys, and the transformed private keys calculated according to the rotation step length;
[0017] All participating entities disclose their partial rotating keys to generate a total rotating key.
[0018] Furthermore, the multiplication key is used for ciphertext multiplication, and the generation process includes:
[0019] The result is obtained by passing the value from 0 to Uniformly sample the range to obtain a polynomial group, generate a multiplication key based on the polynomial group and its private key, and send it to the matrix provider 1;
[0020] All participating entities encrypt their own private keys through part of the public key of the result obtainer, and the matrix provider 2 and the result obtainer send their own private key ciphertexts to the matrix provider 1, and the matrix provider 1 generates ciphertexts through ciphertext addition and ciphertext multiplication;
[0021] The result obtainer combines the polynomial Public, the matrix provider 1 generates its partial multiplication key ciphertext and sends it to the result obtainer, and the matrix provider 2 generates its partial multiplication key and sends it to the result obtainer;
[0022] The result obtainer decrypts the multiplication key ciphertext of the matrix provider 1 and calculates the total multiplication key.
[0023] Furthermore, the matrix provider 1 has a size of The matrix The columns and rows start counting from 0 and repeat for each row times, encoded into a plaintext polynomial ; The matrix provider 2 will be of size The matrix The columns and rows are counted starting from 0, and each row is encoded into 1 in sequence. , and add a blank line at the end, encoded into a plaintext polynomial .
[0024] Furthermore, the result obtainer uses the ciphertext matrix from matrix provider 1 conduct Transformation, using the big step small step algorithm to make Each line of Move Left Bits, specifically:
[0025] Calculate the original matrix of The auxiliary matrix is encoded into auxiliary plaintext, and the auxiliary plaintext is right-rotated according to the large step number i corresponding to each rotation step. bit, get Transformed dedicated auxiliary plaintext;
[0026] The ciphertext matrix Left Rotate 1 times, together with the original matrix A total of A ciphertext matrix is available for backup;
[0027] Calculate the large step number i and small step number j corresponding to each rotation step length, and compare the dedicated auxiliary plaintext with the After multiplying the ciphertext matrices element by element, we get the optimized transformation intermediate result ; For each large step number i, calculate the ciphertext matrix corresponding to each small step The sum of the ciphertext matrix and the left rotation of the sum of the ciphertext matrix The sum of all rotated ciphertext matrices is then summed up to obtain the final transformed ciphertext matrix .
[0028] Furthermore, the result obtainer uses the ciphertext matrix from matrix provider 2 conduct Transformation, using the big step small step algorithm to make Each column of Move up Bits, specifically:
[0029] Calculate the ciphertext matrix of An auxiliary matrix is directly encoded into auxiliary plaintext;
[0030] The ciphertext matrix Left-handed Bit times, together with the original matrix A total of A ciphertext matrix is available for backup;
[0031] Calculate the number of large steps i and small steps j corresponding to each rotation step length, and compare the auxiliary plaintext with the After multiplying the ciphertext matrices element by element, we get the optimized transformation intermediate result ; For each large step number , calculate the ciphertext matrix corresponding to each small step The sum of the ciphertext matrix and the left rotation of the sum of the ciphertext matrix The sum of all rotated ciphertext matrices is then summed up to obtain the final transformed ciphertext matrix .
[0032] Furthermore, the result obtainer performs a ciphertext matrix multiplication calculation, specifically:
[0033] Will The transformed ciphertext matrix Left Rotate 1 times, together with the original matrix A total of Ciphertext matrix Finish Transformation;
[0034] Will The transformed ciphertext matrix Left-handed Bit times, together with the original matrix A total of Ciphertext matrix Finish Transformation;
[0035] Calculate the result of ciphertext matrix multiplication , and The second polynomial is sent to both matrix providers.
[0036] Furthermore, the decryption of the ciphertext matrix multiplication result is specifically as follows:
[0037] The matrix provider 1 is based on The second polynomial and its private key are used to decrypt the result. Sent to the result recipient; the matrix provider 2 is based on The second polynomial and its private key are used to decrypt the result. Send to the result recipient;
[0038] The result obtainer obtains the plaintext of the matrix multiplication result based on the partial decryption results and private keys of the two matrix providers.
[0039] According to a second aspect of the present invention, a privacy-preserving matrix multiplication calculation device based on homomorphic encryption is provided, comprising a memory and one or more processors, wherein the memory stores executable code, and when the processor executes the executable code, it is used to implement the above-mentioned privacy-preserving matrix multiplication calculation method based on homomorphic encryption.
[0040] The beneficial effects of the present invention are as follows: the present invention proposes a ciphertext matrix multiplication suitable for batch or small batch gradient descent, which improves the efficiency of matrix multiplication without wasting ciphertext space through a special matrix encoding method and a corresponding high-performance ciphertext matrix transformation method, and its comprehensive performance (multiplication depth, ciphertext space utilization, number of ciphertext rotations) is significantly better than existing similar domestic and foreign solutions. For actual security computing scenarios, the present invention proposes a privacy-preserving matrix multiplication framework including two matrix providers and one matrix multiplication result obtainer, so that a passive adversary cannot obtain any private information of the other two parties under the premise of controlling any one party. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. 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 paying creative work.
[0042] Figure 1 An overall flow chart of a privacy-preserving matrix multiplication computation protocol provided for an exemplary embodiment;
[0043] Figure 2 An overall flow chart of ciphertext matrix multiplication provided for an exemplary embodiment;
[0044] Figure 3 Matrix encoding and encryption provided for an exemplary embodiment, Transformation, Transformation, Transformation, Transformation diagram;
[0045] Figure 4 An exemplary embodiment is provided Schematic diagram of transformation process;
[0046] Figure 5 A structural diagram of a privacy-preserving matrix multiplication computing device based on homomorphic encryption is provided as an exemplary embodiment. DETAILED DESCRIPTION
[0047] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0048] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0049] The present invention proposes a privacy-preserving matrix multiplication calculation method and device based on homomorphic encryption, which adopts a three-party secure matrix multiplication calculation protocol and is suitable for various machine learning and deep learning model training and usage scenarios. A three-party framework is adopted for the actual secure computing protection scenario. The participating entities include two data providing institutions and one data using institution. The two data providing institutions serve as two matrix providers, and the one data using institution serves as the matrix multiplication result obtainer. The two matrix providers hold large matrices (such as data) and small matrices (such as model parameters) respectively. For example, the size of the matrix to be multiplied provided by a matrix provider is , that is, the matrix width and length are , the size of the matrix to be multiplied provided by another matrix provider is , that is, the matrix width is , the matrix length is ,and , let the ciphertext capacity be , and assuming Can be Divisible.
[0050] The overall matrix multiplication calculation process based on the tripartite framework is as follows Figure 1 As shown, including:
[0051] (1) All participating entities generate an encryption environment;
[0052] (2) The matrix providers encrypt their own matrices and send them to the ones who obtain the matrix multiplication results;
[0053] (3) The matrix multiplication result obtainer performs ciphertext matrix multiplication to generate the matrix multiplication result ciphertext, such as Figure 2 As shown;
[0054] (4) All participants jointly participate in the decryption, and the person who obtains the matrix multiplication result finally obtains the plaintext of the matrix multiplication result.
[0055] 1. Applicable encryption scheme
[0056] The encryption schemes applicable to the present invention include BFV (Brakerski-Fan-Vercauteren), CKKS (Cheon-Kim-Kim-Song) and other schemes based on the ring fault-tolerant learning problem, which are also the homomorphic encryption schemes with the best comprehensive performance at present. They have the following characteristics:
[0057] (1) Its ciphertext domain is a polynomial ring, and the ciphertext is expressed as a pair of polynomials. For simplicity, the present invention uses the suffix and To represent; the maximum degree of each polynomial shall not exceed the pre-selected polynomial degree, which is generally a positive integer power of 2. For the BFV homomorphic encryption scheme, the maximum degree is n, and for the CKKS homomorphic encryption scheme, the maximum degree is 2n; the coefficients of the polynomial are natural numbers and are less than the pre-selected polynomial coefficient modulus, which is generally a large prime number or the product of several coprime small prime numbers.
[0058] (2) A ciphertext, i.e., a pair of polynomials, contains a one-dimensional array, and the length of the array is proportional to the degree of the pre-selected polynomial, that is, the length of the array is equal to the ciphertext capacity n.
[0059] (3) The only basic ciphertext operations supported are: element-by-element addition. ", element-wise multiplication" " and array rotation " ”, where element-by-element multiplication requires the multiplication key and array rotation requires the rotation key.
[0060] 2. Encryption environment generation
[0061] At the beginning of the entire protocol, all participating entities jointly decide on the encryption parameters and jointly generate public keys, private keys, and calculation keys, where the calculation keys include multiplication keys and rotation keys.
[0062] The encryption parameters mainly include:
[0063] (1) Ciphertext capacity n;
[0064] (2) Ciphertext polynomial coefficient range ,yes The product of different prime numbers, is the value of the i-th prime number, and the number of q bits can be obtained by looking up the table according to the security level, ciphertext capacity and prime number distribution, as shown in Table 1;
[0065] Table 1 Relationship between homomorphic encryption parameters and security level based on ring error learning
[0066]
[0067] (4) Noise distribution , used to generate random noise, is a discrete bounded Gaussian distribution with a standard deviation of 3.2;
[0068] (5) Magnification , which is used when encoding a matrix into a plaintext polynomial.
[0069] The generation process of various keys includes:
[0070] (1) All participants are distributed through private keys Generate their own private keys, denoted as , , respectively represent matrix provider 1, matrix provider 2, and matrix multiplication result obtainer;
[0071] (2) One of the participants is between 0 and The range is uniformly sampled to obtain the polynomial And send it to other participants; for example, the matrix provider 1 can sample and obtain the polynomial Then it is sent to the matrix provider 2 and the result obtainer, or the result obtainer samples it to obtain the polynomial Then send it to matrix provider 1 and matrix provider 2;
[0072] (3) All participating entities generate their own partial public keys. The generation formula is as follows:
[0073] (1)
[0074] in, Through Sampling obtained, Express Divide the content in by q and take the remainder;
[0075] (4) All participating entities disclose their partial public keys to generate a total public key for encrypting data , the generation formula is as follows:
[0076]
[0077] (5) Generate a rotation key for ciphertext rotation ,include:
[0078] First, one of the participants is selected from 0 to The range is uniformly sampled to obtain the polynomial group ;
[0079] Then, all participating entities generate their own partial rotation keys using the following formula:
[0080] (3)
[0081] in, Through Sampling obtained, is the transformed private key, , and The calculation formula is as follows ( Take the CKKS solution as an example):
[0082] (4)
[0083] in, It means to find the remainder. represents the unit step function, is the rotation step size; for the BFV scheme, n is replaced by n / 2 in formula (4);
[0084] Finally, all participating entities disclose their partial rotating keys and generate the total rotating key. The generation formula is as follows:
[0085]
[0086] Thus, a method for left-rotating the ciphertext The rotation key of the bit is generated, and the ciphertext is rotated using this key. Indicates that Indicates the ciphertext to be operated (subsequent ciphertexts are also represented by this symbol, where the plaintext contained in the ciphertext is in brackets). Depending on the subsequent algorithm, different value( ), repeat the above steps multiple times to obtain multiple sets of rotation keys to satisfy all rotation step sizes.
[0087] (6) Generate a multiplication key for ciphertext multiplication Since the multiplication of the key involves the square of the private key and the sum, the process is significantly slower than and The generation process is complex. Specifically:
[0088] First, the result obtainer generates its own multiplication key And send it to matrix provider 1, the generation formula is as follows:
[0089] (6)
[0090] in, By 0 to The range is uniformly sampled. Through Sampling obtained;
[0091] Then, all participants use part of the public key of the result winner to encrypt their own private keys. The encryption formula is as follows: (7)
[0092] in, Through Sampling obtained, and Through After encryption is completed, matrix provider 2 and the result recipient send their private key ciphertexts to matrix provider 1, and matrix provider 1 generates ciphertext by ciphertext addition and ciphertext multiplication. ;
[0093] Then, the result obtainer converts the Public, matrix provider 1 generates its own partial multiplication key ciphertext and sends it to the result recipient, and matrix provider 2 generates its own partial multiplication key and sends it to the result recipient. The generation formula is as follows:
[0094] (8)
[0095] in, and Through Sampling obtained;
[0096] After receiving the information, the recipient will first Decryption, the formula is as follows:
[0097] (9)
[0098] in, express The first polynomial of express The second polynomial of ;
[0099] Finally, the total multiplication key is calculated, and the formula is as follows:
[0100] (10)
[0101] in, express The first polynomial of .
[0102] 3. Matrix Coding and Encryption
[0103] After the encryption environment is generated, for the size and (in ), the present invention proposes a new ciphertext matrix multiplication method, which reduces the multiplication depth and the number of rotations while maintaining the ciphertext space utilization as much as possible, such as Figure 3 As shown, in Figure 3 In the example, , , .
[0104] At the beginning of the ciphertext matrix multiplication, the two matrix providers need to encode, encrypt and upload the matrices they hold, and finally the result obtainer finally obtains the ciphertext matrix. For the convenience of explanation, the present invention will subsequently express the one-dimensional array contained in the matrix ciphertext and plaintext as a matrix form. Represents the row index of the ciphertext matrix, starting from 0. Represents the column index of the ciphertext matrix, starting from 0, and the index of each element in the ciphertext matrix in the 1-dimensional array .
[0105] (1) The matrix providers first encode their matrices into a one-dimensional array, and then encode the one-dimensional array into a plaintext polynomial. This step is mainly achieved through the Chinese Remainder Theorem.
[0106] For sizes The square matrix , let the matrix elements In Represents the column index, represents the row index, and the count starts from 0. The present invention converts each row of the matrix, i.e. to , repeated times, and finally encoded into the plaintext polynomial , and its mapping relationship is , ,in Indicates rounding down.
[0107] For sizes ( ) , let the matrix elements In Represents the column index, represents the row index, which also starts counting from 0. The present invention converts each row of the matrix, i.e. to , encoded in sequence into 1 , and adds a blank line at the end, which is finally encoded into the plaintext polynomial , and its mapping relationship is , ,in Indicates rounding down.
[0108] (2) The matrix providers encrypt their plaintext polynomials and send them to the result recipients. The formula is as follows:
[0109] (11)
[0110] in, Through Sampling obtained, and Through Sampling obtained, Represents the public key The first polynomial of Represents the public key The second polynomial of .
[0111] 4. The results are obtained by Transform
[0112] The specific effect of the transformation is to transform the ciphertext matrix Each line of Move Left Since the ciphertext rotation can only be performed in units of the entire 1-dimensional array, the implementation of this transformation effect requires the use of the baby stepgiant step (BSGS) algorithm, as shown below:
[0113] (12)
[0114] Among them, i is the number of large steps, j is the number of small steps, is a very small positive number, and the step length is ,in It means rounding up, the small step length is 1, and the number of large and small steps together represents all possible rotation steps of each element in the ciphertext matrix. ; It represents the auxiliary plaintext corresponding to each rotation step, which is used to remove the elements that do not need to be rotated in each rotation step; is the intermediate result of the optimized transformation, as shown below:
[0115]
[0116] entire The specific process of transformation is shown as follows: Figure 4 shown.
[0117] First, calculate the original matrix of Auxiliary Matrix ,make Represents the column index, Represents the row index, and the calculation formula is as follows:
[0118] (14)
[0119] In the original matrix The auxiliary matrix Afterwards, they are encoded into a ciphertext matrix Auxiliary plaintext , and its mapping method is the same as above arrive At the same time, according to the number of large steps corresponding to each rotation step, it is right-rotated according to formula (13) You can get The transformed dedicated auxiliary plaintext, such as Figure 4 As shown in the first line of;
[0120] Next, the ciphertext matrix Left Rotate 1 times, together with the original matrix, we get A ciphertext matrix is available, such as Figure 4 As shown in the second row;
[0121] Then, the number of large steps i and small steps j corresponding to each rotation step length is calculated, and the formula (13) is used to calculate ; For each large step number i, calculate the ciphertext matrix corresponding to each small step The sum of the ciphertext matrix and the left rotation of the sum of the ciphertext matrix Finally, the sum of all rotated ciphertext matrices is summed up again using formula (12) to obtain the final transformed ciphertext matrix ,like Figure 4As shown in the third row.
[0122] The optimized whole The transformation requires 1 multiplication depth, Sub-ciphertext addition, The multiplication between the plaintext and the ciphertext, and Secondary ciphertext rotation.
[0123] 5. The winner of the result Transform
[0124] The specific effect of the transformation is to transform the ciphertext matrix Each column of Move up The implementation of this transformation effect also uses the big-step small-step algorithm, as shown below:
[0125] (15)
[0126] Among them, i is the number of large steps, j is the number of small steps, is a very small positive number; given the number of large and small steps, all possible rotation step lengths ; It represents the auxiliary plaintext corresponding to each rotation step; is the intermediate result of the optimized transformation, as shown below:
[0127]
[0128] entire The specific process of transformation The transformation is similar, but simpler.
[0129] First, calculate the ciphertext matrix of Auxiliary Matrix , without any transformation, it is directly encoded into auxiliary plaintext ,make Represents the column index, Represents the row index, and the calculation formula is as follows:
[0130] (17)
[0131] Next, the ciphertext matrix Left-handed Bit times, together with the original matrix, we get A ciphertext matrix is available for backup;
[0132] Then, the number of large steps i and small steps j corresponding to each rotation step length are calculated, and the formula (16) is used to calculate ; For each large step number , calculate the ciphertext matrix corresponding to each small step The sum of the ciphertext matrix and the left rotation of the sum of the ciphertext matrix Finally, the sum of all rotated ciphertext matrices is calculated again using formula (15) to obtain the final transformed ciphertext matrix .
[0133] The optimized whole The transformation requires 1 multiplication depth, Sub-ciphertext addition, The multiplication between the plaintext and the ciphertext, and Secondary ciphertext rotation.
[0134] because Transformation and The transformations are performed in parallel without interfering with each other, so the total multiplication depth they consume is .
[0135] 6. Ciphertext matrix multiplication calculation and result decryption
[0136] After getting the ciphertext matrix and After that, the winner first conducts Transformation, the ciphertext matrix Left Rotate 1 times, together with the original matrix, we get Ciphertext matrix ;
[0137] Continue Transformation, the ciphertext matrix Left-handed Bit times, together with the original matrix, we get Ciphertext matrix ;
[0138] Then, the final ciphertext matrix multiplication result can be calculated , this step requires 1 layer of multiplication depth, so the multiplication depth consumption of the entire ciphertext matrix multiplication is ;
[0139] Finally, the winner will Right now The second polynomial of is sent to two matrix providers and partially decrypted by the two matrix providers. The decryption formula of matrix provider 1 is , the decryption formula of matrix provider 2 is ,in, and Generated randomly through 26~74-bit Gaussian distribution, used for: ① Protection and ;② For the CKKS scheme, the Q-IND-CPAD security level is achieved. The specific number of noise bits and security level can be found in the paper "Securing Approximate Homomorphic Encryption Using Differential Privacy", as shown in Table 2. Matrix provider 1 will Sent to the result recipient, matrix provider 2 will Sent to the recipient of the result.
[0140] Table 2 The amount of differential noise (in bits) that needs to be added during decryption under different conditions to achieve different Q-IND-CPAD security levels with different statistical security, where Q refers to the maximum number of decryption queries that can be tolerated. The corresponding ciphertext capacity of this table is 32,768 (BFV) or 16,384 (CKKS)
[0141]
[0142] The result recipient performs the final decryption and obtains the plaintext result. The formula is as follows:
[0143] (18)
[0144] in, for The first polynomial of .
[0145] It can be seen that because the final decryption requires the joint efforts of all participating entities, even if the attacker colludes with one party, the private information of the other participating entities cannot be obtained.
[0146] Compared with the solution proposed by Jiang et al., the advantages of the present invention are less multiplication depth and fewer ciphertext rotation times, reducing the number of ciphertext rotations from Reduced to , the occupied multiplication depth is reduced from 3 layers to 2 layers. Compared with the solution proposed by Rizomiliotis et al., the advantage of the present invention is that the ciphertext space utilization rate is significantly improved. Under the premise of ensuring that the multiplication depth remains unchanged and the number of ciphertext rotations is slightly increased, the ciphertext space utilization rate is reduced from Improved to .because Usually very large (not less than 4096), so the actual ciphertext space utilization of the present invention is usually only slightly lower than the scheme proposed by Jiang et al., which can greatly improve the computational efficiency of the entire scheme. In addition, by using threshold homomorphic encryption, the present invention also achieves effective protection of all information. Under a few dishonest passive adversary models, the attacker cannot obtain any private information of the non-controlling party, which is impossible for the two existing schemes.
[0147] The comparison of comprehensive performance is shown in Table 3, where the ciphertext capacity and the matrix width All are selected from common real-world application scenarios. , When a single ciphertext of the Rizomiliotis scheme is The maximum value is only 16, which means that under this condition, 4 ciphertexts are needed to represent one , so the number of ciphertext selections also increases dramatically.
[0148] Table 3 Comprehensive performance comparison of the scheme of the present invention, Jiang scheme and Rizomiliotis scheme
[0149]
[0150] Corresponding to the aforementioned embodiment of the privacy-preserving matrix multiplication calculation method based on homomorphic encryption, the present invention also provides an embodiment of a privacy-preserving matrix multiplication calculation device based on homomorphic encryption.
[0151] See also Figure 5 The privacy-preserving matrix multiplication calculation device based on homomorphic encryption provided in an embodiment of the present invention includes a memory and one or more processors, wherein the memory stores executable code, and when the processor executes the executable code, it is used to implement the privacy-preserving matrix multiplication calculation method based on homomorphic encryption in the above embodiment.
[0152] The embodiments of the privacy-preserving matrix multiplication computing device based on homomorphic encryption of the present invention can be applied to any device with data processing capabilities, and the device with data processing capabilities can be a device or apparatus such as a computer. The device embodiment can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capabilities in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory for execution. From the hardware level, if Figure 5 As shown, it is a hardware structure diagram of any device with data processing capability where the privacy-preserving matrix multiplication computing device based on homomorphic encryption of the present invention is located, except Figure 5In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiments is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.
[0153] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0154] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.
[0155] An embodiment of the present invention also provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the privacy-preserving matrix multiplication calculation method based on homomorphic encryption in the above embodiment is implemented.
[0156] The computer-readable storage medium may be an internal storage unit of any device with data processing capability described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be an external storage device of any device with data processing capability, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit and an external storage device of any device with data processing capability. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.
[0157] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.
Claims
1. A privacy-preserving matrix multiplication calculation method based on homomorphic encryption, characterized in that: The participating entities include two data providing institutions and one data using institution. The two data providing institutions are matrix provider 1 and matrix provider 2 respectively. The matrix size provided by matrix provider 1 is d×d, and the matrix size provided by matrix provider 2 is d×v, and v≥d. The data using institution is the one that obtains the matrix multiplication result. The method includes: All participating entities generate an encryption environment, jointly determine encryption parameters, and jointly generate public keys, private keys, and calculation keys. The calculation keys include multiplication keys and rotation keys. The encryption parameters include ciphertext capacity n, ciphertext polynomial coefficient range q, and private key distribution D. s , noise distribution D e and magnification Δ, where is the product of k different prime numbers, q i is the value of the i-th prime number; Each matrix provider encodes the matrix to be multiplied into a 1-dimensional array, and then encodes the 1-dimensional array into a plaintext polynomial and encrypts it and sends it to the result obtainer; the matrix provider 1 counts the columns and rows of the matrix β of size d×d from 0, and repeats each row n / d times. 2 times, encoded into a plaintext polynomial B; the matrix provider 2 counts the columns and rows of the matrix x of size d×v from 0, and encodes each row in sequence into a d×(n / d 2 -1), and add a blank row at the end, encoding it into the plaintext polynomial X; The result obtainer performs ciphertext matrix multiplication, uses a large-step small-step algorithm to shift the ciphertext matrix from matrix provider 1 left by multiple bits per row to complete σ transformation, performs multiple left rotations on the ciphertext matrix obtained by σ transformation to obtain d ciphertext matrices to complete Φ1 transformation; uses a large-step small-step algorithm to shift the ciphertext matrix from matrix provider 2 up by multiple bits per column to complete τ transformation, performs multiple left rotations on the ciphertext matrix obtained by τ transformation to obtain d ciphertext matrices to complete ψ1 transformation; performs ciphertext-by-ciphertext multiplication and ciphertext-by-ciphertext addition on the ciphertext matrix obtained by Φ1 transformation and the ciphertext matrix obtained by ψ1 transformation to obtain a ciphertext matrix multiplication result; The result obtainer performs σ transformation on the ciphertext matrix c(B) from matrix provider 1, and uses the big-step small-step algorithm to move each row y of c(B) to the left. Bits, specifically: Calculate the 2d-1 auxiliary matrices of the original matrix β, encode the auxiliary matrices into auxiliary plaintext, and right-rotate the auxiliary plaintext according to the large step number i corresponding to each rotation step. bits, and obtain the dedicated auxiliary plaintext of σ transformation; Rotate the ciphertext matrix c(B) left by 1 bit times, together with the original matrix β, we get A ciphertext matrix is available for backup; Calculate the large step number i and small step number j corresponding to each rotation step length, and compare the dedicated auxiliary plaintext with the After multiplying the ciphertext matrices element by element, we get the optimized transformation intermediate result c(B i,j ); For each large step number i, calculate the ciphertext matrix c(B i,j ) and left-rotate the sum of the ciphertext matrix The sum of all rotated ciphertext matrices is then summed up to obtain the final transformed ciphertext matrix c(B σ ); The result obtainer performs τ transformation on the ciphertext matrix c(X) from the matrix provider 2, and uses the big-step small-step algorithm to move each column z of c(X) upward by z×d positions, specifically: Calculate d auxiliary matrices of the ciphertext matrix c(X), and directly encode the auxiliary matrices into auxiliary plaintext; Rotate the ciphertext matrix c(X) left by d 2 Bit times, together with the original matrix x, we get A ciphertext matrix is available for backup; Calculate the number of large steps i and small steps j corresponding to each rotation step length, and compare the auxiliary plaintext with the After multiplying the ciphertext matrices element by element, we get the optimized transformation intermediate result c(X i,j ); For each large step number i, calculate the ciphertext matrix c(X i,j ) and left-rotate the sum of the ciphertext matrix The sum of all rotated ciphertext matrices is then summed up to obtain the final transformed ciphertext matrix c(X τ ); All participating entities jointly participate in the decryption, and the result obtainer finally obtains the plaintext of the matrix multiplication result.
2. The privacy-preserving matrix multiplication calculation method based on homomorphic encryption according to claim 1, characterized in that: The rotation key is used for ciphertext rotation, and the generation process includes: Any participating subject uniformly samples in the range of 0 to q-1 to obtain a polynomial group; All participating entities generate their own partial rotation keys based on the polynomial group, their own private keys, and the transformed private keys calculated according to the rotation step length; All participating entities disclose their partial rotating keys to generate a total rotating key.
3. The privacy-preserving matrix multiplication calculation method based on homomorphic encryption according to claim 1, characterized in that: The multiplication key is used for ciphertext multiplication, and the generation process includes: The result obtainer obtains a polynomial group by uniformly sampling in the range of 0 to q-1, generates a multiplication key based on the polynomial group and its private key, and sends it to the matrix provider 1; All participating entities encrypt their own private keys through part of the public key of the result obtainer, and the matrix provider 2 and the result obtainer send their own private key ciphertexts to the matrix provider 1, and the matrix provider 1 generates ciphertexts through ciphertext addition and ciphertext multiplication; The result obtainer converts the polynomial group a1 to a k Public, the matrix provider 1 generates its partial multiplication key ciphertext and sends it to the result obtainer, and the matrix provider 2 generates its partial multiplication key and sends it to the result obtainer; The result obtainer decrypts the multiplication key ciphertext of the matrix provider 1 and calculates the total multiplication key.
4. The privacy-preserving matrix multiplication calculation method based on homomorphic encryption according to claim 1, characterized in that: The result obtainer performs a ciphertext matrix multiplication calculation, specifically: The ciphertext matrix c(B σ ) Rotate left by 1 bit d-1 times, and get a total of d ciphertext matrices together with the original matrix β Complete Φ1 transformation; The ciphertext matrix c(X τ )Left-handed 2 d-1 times, together with the original matrix x, a total of d ciphertext matrices are obtained Complete ψ1 transformation; Calculate the result of ciphertext matrix multiplication And send the second polynomial of c(β·x) to both matrix providers.
5. The privacy-preserving matrix multiplication calculation method based on homomorphic encryption according to claim 4 is characterized in that: The decryption of the ciphertext matrix multiplication result is specifically: The matrix provider 1 performs decryption based on the second polynomial of c(β·x) and its private key and sends the decryption result PD1 to the result obtainer; the matrix provider 2 performs decryption based on the second polynomial of c(β·x) and its private key and sends the decryption result PD2 to the result obtainer; The result obtainer obtains the plaintext of the matrix multiplication result based on the partial decryption results and private keys of the two matrix providers.
6. A privacy-preserving matrix multiplication computing device based on homomorphic encryption, comprising a memory and one or more processors, wherein the memory stores executable code, characterized in that: When the processor executes the executable code, it is used to implement the privacy-preserving matrix multiplication calculation method based on homomorphic encryption as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Plaintext and ciphertext matrix multiplication calculation method based on homomorphic encryption
CN117200972A
Systems, devices, and processes for homomorphic encryption
US10075288B1
