Methods and apparatuses for jointly processing data by two parties for data privacy protection
Embodiments of this specification provide methods and apparatuses for data privacy protection. An embodiment of the methods comprises receiving, by a first party from a second party, an encrypted integrated vector, determining an encrypted result vector based on the original matrix and the encrypted integrated vector, determining a data processing result based on the encrypted result vector, and sending the data processing result to the second party for the second party to obtain a multiplication calculation result of the original matrix and the n original vectors based on the data processing result.
1 . A computer-implemented method for data privacy protection, comprising:
receiving, by a first party from a second party, an encrypted integrated vector, wherein the first party owns an original matrix formed by privacy data and the second party owns n original vectors formed by privacy data, wherein the encrypted integrated vector is obtained by encrypting an integrated vector based on a public key of the second party and a homomorphic encryption algorithm, the integrated vector is a combination of mapping results of the n original vectors in n computing spaces obtained by mapping the n original vectors to the n computing spaces, and each of the n computing spaces are different and isolated from each other, wherein n is an integer greater than 1, wherein the first party owns the original matrix comprising model parameter data of a data processing model, and wherein the n original vectors comprise feature data of one or more service objects for joint service processing using the data processing model, and wherein the n computing spaces are modulo spaces corresponding to n modulus values that are coprime numbers and wherein the integrated vector is an integrated result obtained by performing an encoding operation CRTEncode according to a Chinese remainder theorem;
determining an encrypted result vector based on performing a row-column homomorphic addition operation on plaintext elements in the original matrix and ciphertext elements in the encrypted integrated vector;
determining a data processing result based on homomorphically superimposing an integrated random vector onto the encrypted result vector; and
sending the data processing result to the second party for the second party to obtain a multiplication calculation result of the original matrix and the n original vectors based on decomposing the data processing result into the n computing spaces to obtain the multiplication calculation result, wherein decomposing comprises decrypting the data processing result and performing a decoding operation CRTDecode according to the Chinese remainder theorem, and wherein the second party uses the multiplication calculation result to process the feature data using the data processing model.
2 . The method according to claim 1 , wherein space sizes of the n computing spaces are determined based on maximum effective bit widths of element products of the original matrix and the n original vectors.
3 . The method according to claim 1 , wherein the determining a data processing result comprises:
generating n random vectors;
using opposite vectors of the n random vectors as n first-party fragments of the multiplication calculation result;
combining mapping results of the n random vectors in the n computing spaces to obtain an integrated random vector; and
determining the data processing result based on the integrated random vector and the encrypted result vector for the second party to obtain n second-party fragments of the multiplication calculation result.
4 . The method according to claim 3 , wherein the first party owns one original matrix, and the n computing spaces are n spaces with different quantities of bits in a current numeral system, and wherein the combining mapping results of the n random vectors in the n computing spaces comprises:
extending elements in an ith random vector in the n random vectors by a quantity of bits corresponding to an ith space to obtain an ith random mapping result; and
determining the integrated random vector based on a sum of random mapping results.
5 . The method according to claim 4 , wherein a difference between quantities of bits of the ith space and an (i−1)th space is determined based on excess mask bit widths predetermined for the n random vectors and a maximum effective bit width of an element product of the original matrix and an (i−1)th original vector.
6 . The method according to claim 1 , wherein the first party owns n original matrices, and wherein the determining an encrypted result vector comprises:
determining an integrated matrix by using a Chinese remainder theorem, wherein the integrated matrix satisfies that a remainder result of performing a modulo operation on an ith modulus value corresponding to an ith space is an ith original matrix; and
obtaining the encrypted result vector based on a homomorphic operation on the integrated matrix and the encrypted integrated vector.
7 . The method according to claim 3 , wherein the first party owns n original matrices, wherein
the determining an encrypted result vector comprises:
determining an integrated matrix by using the Chinese remainder theorem, wherein the integrated matrix satisfies that a remainder result of performing a modulo operation on an ith modulus value corresponding to an ith space is an ith original matrix; and
obtaining the encrypted result vector based on a homomorphic operation on the integrated matrix and the encrypted integrated vector; and wherein
the obtaining an integrated random vector comprises:
determining the integrated random vector by using the Chinese remainder theorem, so that the integrated random vector satisfies that a remainder result of performing a modulo operation on the ith modulus value corresponding to the ith space is an ith random vector.
8 . The method according to claim 7 , wherein a bit width of the ith modulus value is determined based on excess mask bit widths predetermined for the n random vectors and a maximum effective bit width of an element product of the ith original matrix and an ith original vector.
9 . The method according to claim 8 , wherein the determining the data processing result based on the integrated random vector and the encrypted result vector comprises:
generating a target random vector, wherein bit widths of elements in the target random vector are determined based on maximum effective bit widths, excess mask bit widths, and a quantity of original matrices;
multiplying the target random vector by the n modulus values;
superimposing the multiplication calculation result onto the integrated random vector to obtain an extended random vector; and
homomorphically superimposing the extended random vector onto the encrypted result vector to obtain the data processing result.
10 . A non-transitory, computer-readable medium storing one or more instructions executable by at least one processor to perform operations comprising:
receiving, by a first party from a second party, an encrypted integrated vector, wherein the first party owns an original matrix formed by privacy data and the second party owns n original vectors formed by privacy data, wherein the encrypted integrated vector is obtained by encrypting an integrated vector based on a public key of the second party and a homomorphic encryption algorithm, the integrated vector is a combination of mapping results of the n original vectors in n computing spaces obtained by mapping the n original vectors to the n computing spaces, and each of the n computing spaces are different and isolated from each other, wherein n is an integer greater than 1, wherein the first party owns the original matrix comprising model parameter data of a data processing model, and wherein the n original vectors comprise feature data of one or more service objects for joint service processing using the data processing model, wherein the n computing spaces are modulo spaces corresponding to n modulus values that are coprime numbers and wherein the integrated vector is an integrated result obtained by performing an encoding operation CRTEncode according to a Chinese remainder theorem;
determining an encrypted result vector based on performing a row-column homomorphic addition operation on plaintext elements in the original matrix and ciphertext elements in the encrypted integrated vector;
determining a data processing result based on homomorphically superimposing an integrated random vector onto the encrypted result vector; and
sending the data processing result to the second party for the second party to obtain a multiplication calculation result of the original matrix and the n original vectors based on decomposing the data processing result into the n computing spaces to obtain the multiplication calculation result, wherein decomposing comprises decrypting the data processing result and performing a decoding operation CRTDecode according to the Chinese remainder theorem, and wherein the second party uses the multiplication calculation result to process the feature data using the data processing model.
11 . The non-transitory, computer-readable medium according to claim 10 , wherein space sizes of the n computing spaces are determined based on maximum effective bit widths of element products of the original matrix and the n original vectors.
12 . The non-transitory, computer-readable medium according to claim 10 , wherein the determining a data processing result comprises:
generating n random vectors;
using opposite vectors of the n random vectors as n first-party fragments of the multiplication calculation result;
combining mapping results of the n random vectors in the n computing spaces to obtain an integrated random vector; and
determining the data processing result based on the integrated random vector and the encrypted result vector for the second party to obtain n second-party fragments of the multiplication calculation result.
13 . The non-transitory, computer-readable medium according to claim 12 , wherein the first party owns one original matrix, and the n computing spaces are n spaces with different quantities of bits in a current numeral system, and wherein the combining mapping results of the n random vectors in the n computing spaces comprises:
extending elements in an ith random vector in the n random vectors by a quantity of bits corresponding to an ith space to obtain an ith random mapping result; and
determining the integrated random vector based on a sum of random mapping results.
14 . The non-transitory, computer-readable medium according to claim 13 , wherein a difference between quantities of bits of the ith space and an (i−1)th space is determined based on excess mask bit widths predetermined for the n random vectors and a maximum effective bit width of an element product of the original matrix and an (i−1)th original vector.
15 . The non-transitory, computer-readable medium according to claim 10 , wherein the first party owns n original matrices, wherein the determining an encrypted result vector comprises:
determining an integrated matrix by using a Chinese remainder theorem, wherein the integrated matrix satisfies that a remainder result of performing a modulo operation on an ith modulus value corresponding to an ith space is an ith original matrix; and
obtaining the encrypted result vector based on a homomorphic operation on the integrated matrix and the encrypted integrated vector.
16 . The non-transitory, computer-readable medium according to claim 12 , wherein the first party owns n original matrices,
the determining an encrypted result vector comprises:
determining an integrated matrix by using the Chinese remainder theorem, wherein the integrated matrix satisfies that a remainder result of performing a modulo operation on an ith modulus value corresponding to an ith space is an ith original matrix; and
obtaining the encrypted result vector based on a homomorphic operation on the integrated matrix and the encrypted integrated vector; and wherein
the obtaining an integrated random vector comprises:
determining the integrated random vector by using the Chinese remainder theorem, so that the integrated random vector satisfies that a remainder result of performing a modulo operation on the ith modulus value corresponding to the ith space is an ith random vector.
17 . The non-transitory, computer-readable medium according to claim 16 , wherein a bit width of the ith modulus value is determined based on excess mask bit widths predetermined for the n random vectors and a maximum effective bit width of an element product of the ith original matrix and an ith original vector.
18 . The non-transitory, computer-readable medium according to claim 17 , wherein the determining the data processing result based on the integrated random vector and the encrypted result vector comprises:
generating a target random vector, wherein bit widths of elements in the target random vector are determined based on maximum effective bit widths, excess mask bit widths, and a quantity of original matrices;
multiplying the target random vector by the n modulus values;
superimposing the multiplication calculation result onto the integrated random vector to obtain an extended random vector; and
homomorphically superimposing the extended random vector onto the encrypted result vector to obtain the data processing result.
19 . A computing device comprising:
at least one processor; and
one or more memories storing programming instructions for execution by the at least one processor to perform one or more operations comprising:
receiving, by a first party from a second party, an encrypted integrated vector, wherein the first party owns an original matrix formed by privacy data and the second party owns n original vectors formed by privacy data, wherein the encrypted integrated vector is obtained by encrypting an integrated vector based on a public key of the second party and a homomorphic encryption algorithm, the integrated vector is a combination of mapping results of the n original vectors in n computing spaces obtained by mapping the n original vectors to the n computing spaces, and each of the n computing spaces are different and isolated from each other, wherein n is an integer greater than 1, wherein the first party owns the original matrix comprising model parameter data of a data processing model, and wherein the n original vectors comprise feature data of one or more service objects for joint service processing using the data processing model, and wherein the n computing spaces are modulo spaces corresponding to n modulus values that are coprime numbers and wherein the integrated vector is an integrated result obtained by performing an encoding operation CRTEncode according to a Chinese remainder theorem;
determining an encrypted result vector based on performing a row-column homomorphic addition operation on plaintext elements in the original matrix and ciphertext elements in the encrypted integrated vector;
determining a data processing result based on homomorphically superimposing an integrated random vector onto the encrypted result vector; and
sending the data processing result to the second party for the second party to obtain a multiplication calculation result of the original matrix and the n original vectors based on decomposing the data processing result into the n computing spaces to obtain the multiplication calculation result, wherein decomposing comprises decrypting the data processing result and performing a decoding operation CRTDecode according to the Chinese remainder theorem, and wherein the second party uses the multiplication calculation result to process the feature data using the data processing model.
20 . The computing device according to claim 19 , wherein space sizes of the n computing spaces are determined based on maximum effective bit widths of element products of the original matrix and the n original vectors.