Disclosure of Invention
Aiming at the problems of low efficiency, high calculation cost and the like of the existing torus homomorphic encryption scheme, the invention provides a data processing method of a torus homomorphic encryption algorithm based on integer bootstrapping, which expands the support data type from Boolean level to integer level, realizes the high-efficiency bootstrapping algorithm for the integer level data, reduces the complexity of the method, simplifies the operation process and greatly improves the calculation efficiency.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
in one aspect, a data processing method of a torus homomorphic encryption algorithm based on integer bootstrapping is provided, wherein the torus homomorphic encryption algorithm of the integer bootstrapping comprises a key generation algorithm, an encryption algorithm, an evaluation algorithm and a decryption algorithm; the plaintext space of the integer bootstrapping torus full homomorphic encryption algorithm is The accuracy of the data is determined by the data,Is a natural number set; the ciphertext space isA. b is two components of the ciphertext, n represents the dimension of a,Torus of real numbers between 0 and 1;
The data processing method comprises the following steps:
The client calls a key generation algorithm KeyGen (1 λ) according to the security parameters, generates a self key sk, a bootstrap key bk and a conversion key ks, and sends the bootstrap key bk and the conversion key ks to the cloud server, and the self key sk is stored locally; the dimensions of the self key sk, the bootstrap key bk and the conversion key ks are all n;
The client calls an encryption algorithm Enc (m, sk) and uses a self secret key sk to encrypt plaintext data m E { B, & gt, B-1} to obtain ciphertext c and transmit the ciphertext c to the cloud server; the plaintext data comprises Boolean-level plaintext data and integer-level plaintext data;
The cloud server executes an evaluation algorithm Eval (c, bk, ks, f) on the ciphertext c according to an evaluation function f, a bootstrap key bk and a conversion key ks provided by the client, and an evaluation result c' in the ciphertext state is obtained and sent back to the client; the evaluation algorithm comprises an integer bootstrapping algorithm and a key conversion algorithm; the evaluation function f provided by the client comprises a nonlinear evaluation function and a linear evaluation function; and the client calls a decryption algorithm Dec (c ', sk) according to the self secret key sk to decrypt the evaluation result c' in the ciphertext state, so as to obtain an evaluation result of plaintext data.
As a preferable technical solution, the encryption operation specifically includes:
Taking a random noise e and a random mask from a gaussian distribution Returning ciphertext c= (a, b) satisfying b=sk·a+m/2b+e;
The decryption operation is specifically as follows:
obtaining 2Be+f (m) through 2B (B-sk.a), and obtaining corresponding plaintext f (m) through up-and-down rounding and decryption, namely
As an optimal technical scheme, the evaluation algorithm Eval (c, bk, ks, f) firstly transmits a large-noise ciphertext c of plaintext data m, a bootstrap key bk, a dimension parameter N and an evaluation function f into an integer bootstrap algorithm to obtain a small-noise ciphertext c'; and then, executing a conversion algorithm on the small-noise ciphertext c 'according to the conversion key, and converting the key of the small-noise ciphertext c' into sk.
As a preferable technical solution, the specific implementation of the integer bootstrapping algorithm is as follows:
Initializing a polynomial testv=μ0+μ1X-1+μ2X-2+…+μN-1X-(N-1)=μ0-μN-1X-μN-2X2-…-μ1XN-1∈TN[X],N in a 2N space as a polynomial dimension parameter according to an evaluation function f; { μ 0,…,μN-1 } is the coefficient set of the initialization polynomial, satisfying μ j×i =f (i), j= {0, …, N/B }, i= {0, …, B-1};
Taking the 2N space as 2N grooves which are connected end to end and dividing the 2N grooves into 2B parts;
Placing all slots in k into f (k), and placing all slots in k+b into-f (k), wherein k= {0, B-1}, f (k) is the output of the evaluation function f when the input is k, due to the non-negativity of the polynomial;
And (5) plaintext rotation: logically leftwards shifting the polynomial coefficient, shifting b bits to obtain a polynomial ACC after plaintext rotation, wherein the plaintext rotation formula is as follows: acc= (0, testv) ·x b;
Ciphertext rotation: performing ciphertext rotation by using an outer product operation according to the polynomial ACC after plaintext rotation and the bootstrap key bk to obtain a polynomial ACC1 after ciphertext rotation; the input of the outer product operation is two ciphertexts C m1、Cm2, and the output is a ciphertexts C m1×m2; the ciphertext rotation formula is: Wherein h is ciphertext of 1; a i is the ith component in ciphertext a; Representing shifting the polynomial logic by-a i bits, i.e., shifting the logic right by a i bits; bk i is the ith component of the bootstrap key bk; is the outer product; the ciphertext is rotated repeatedly for n times, after each rotation, a polynomial ACC1 is assigned to the polynomial ACC, and n is the dimension of a and a bootstrap key bk in the ciphertext;
and extracting constant term coefficients of the polynomial ACC1 after the ciphertext rotation, and outputting the extracted constant term coefficient ciphertext.
As a preferable technical scheme, the evaluation algorithm realizes a plurality of basic nonlinear operation algorithms on an integer bootstrap algorithm; the basic nonlinear operation algorithm comprises a Sign operation algorithm, a Iden operation algorithm, a EqalConst operation algorithm and a MultBin operation algorithm;
The input of the Sign operation algorithm is a large-noise ciphertext Cm in,Cmin which represents a ciphertext of a plaintext m in, m in epsilon-B, & gt, B-1, and the output is a small-noise ciphertext Cm out, so that m out = -1 when m in epsilon-B+1, & gt, -1} is satisfied, m out =0 when m in epsilon-B, 0} is satisfied, and m out=1;mout when m in epsilon-1, & gt, B-1 is the plaintext of the small-noise ciphertext Cm out;
The input of Iden operation algorithm is a large noise ciphertext Cm in, and the output is a small noise ciphertext Cm out, so that m out=min is satisfied;
The input of the EqalConst operation algorithm is a large-noise ciphertext Cm 1 and a plaintext m 2,m1、m2∈{-B,...,B-1},m2 which are generated by the cloud server, and the output is a small-noise ciphertext Cm out, so that m out = -B when m 1=m2 is met, otherwise, m out =0;
The input of MultBin operation algorithm is a large noise ciphertext Cm int and Cm bin,mint epsilon-B, the term "B-1" represents plaintext data of a large noise ciphertext Cm int, m bin epsilon-B, 0} represents plaintext data of a large noise ciphertext Cm bin, and the output is a small noise ciphertext Cm out, so that m out=mint when m bin epsilon-B is satisfied, otherwise m out =0.
As an preferable technical scheme, the Sign operation algorithm specifically comprises the following implementation processes:
Designing a nonlinear evaluation function f sign (x), f sign (x) =1 when x∈ {1,., B-1} and f sign (x) =0 when x=0;
The large-noise ciphertext Cm in and the nonlinear evaluation function f sign (x) are transmitted into an integer bootstrap algorithm and output as a small-noise ciphertext Cm out;
the Iden operation algorithm comprises the following specific implementation processes:
Designing a nonlinear evaluation function f iden (x), f iden (x) =x when x e { -B,..b-1 };
The large-noise ciphertext Cm in and the nonlinear evaluation function f iden (x) are transmitted into an integer bootstrap algorithm and output as a small-noise ciphertext Cm out;
The EqalConst operation algorithm comprises the following specific implementation processes:
Designing a nonlinear evaluation function f eqal (x), when x=0, f eqal (x) = -B, otherwise f eqal (x) =0;
Generating a ciphertext (0, m 2/2B) for m 2, and obtaining ciphertext C tmp=Cm1-(0,m2/2B);
the ciphertext C tmp and the nonlinear evaluation function f eqal (x) are transmitted into an integer bootstrap algorithm, and a small-noise ciphertext Cm out is output;
The MultBin operation algorithm comprises the following specific implementation processes:
Designing a nonlinear evaluation function f half (x), wherein f half (x) =x/2 when x is even, otherwise f half (x) = - (x+1)/2- (B-1)/2;
Generating ciphertext C tmp1=Cmint+Cmbin + (0, -B/2B); inputting the ciphertext C tmp1 into a Iden operation algorithm to output ciphertext C tmp2;
Generating ciphertext C tmp3=Cmint+Ctmp2; ciphertext C tmp3 and nonlinear evaluation function f half (x) are input into an integer bootstrapping algorithm and output as a small noise ciphertext Cm out.
As a preferable technical solution, the nonlinear evaluation function includes a Sign operation function, iden operation function, eqalConst operation function, multBin operation function, reLU operation function, and Max operation function; the Sign operation function, iden operation function, eqalConst operation function and MultBin operation function are directly realized by calling the corresponding basic nonlinear operation algorithm;
the ReLU operation function and the Max operation function are realized by combining basic nonlinear operation algorithms;
the input of the ReLU operation function is a large noise ciphertext Cm in,min e { -B, & gt, B-1}, the output is a small noise ciphertext Cm out, satisfying m out=frelu(min), m out=min when m in >0, otherwise m out = 0; the specific implementation process of the ReLU operation function is as follows:
invoking a Sign operation algorithm and a Iden operation algorithm to respectively execute operation on the ciphertext Cm in to obtain a ciphertext C tmp1 and a ciphertext C tmp2;
Executing EqalConst operation algorithm on ciphertext C tmp1 and plaintext data 1 to obtain ciphertext C tmp3;
Inputting the ciphertext C tmp2 and C tmp3 into a MultBin operation algorithm, and outputting a small-noise ciphertext Cm out;
The input of the Max operation function is a large noise ciphertext pair (Cm x,Cmy),(mx,my) epsilon-B, & gt, B-1, and the output is a small noise ciphertext Cm out, m out=fmax(mx,my is satisfied), m out=mx is m x≥my, otherwise m out=my; the specific implementation process of the Max operation function is as follows:
Generating ciphertext C tmp1=Cmx-Cmy, generating ciphertext C (-m y) for Cm y;
Executing a Sign operation algorithm on the ciphertext C tmp1 to obtain a ciphertext C tmp2;
Inputting the ciphertext C tmp2 and the plaintext data 1 into a EqalConst operation algorithm to perform operation to obtain ciphertext C tmp3;
inputting the ciphertext C tmp2 and the plaintext data-1 into a EqalConst operation algorithm for operation to obtain ciphertext C tmp4;
Performing Iden operation algorithm on the ciphertext Cm x and the ciphertext C (-m y) to obtain a ciphertext C tmp5 and a ciphertext C tmp6;
Invoking MultBin an operation algorithm to operate on the ciphertext C tmp3 and the ciphertext C tmp5 to obtain a ciphertext C tmp7; invoking MultBin an operation algorithm to operate on the ciphertext C tmp4 and the ciphertext C tmp6 to obtain a ciphertext C tmp8;
ciphertext C tmp7 is added to ciphertext C tmp8 to yield a low noise ciphertext Cm out.
On the other hand, a data processing system based on the whole-number bootstrapping ring surface full homomorphic encryption algorithm is provided, and the data processing system is applied to the whole-number bootstrapping ring surface full homomorphic encryption algorithm based data processing method, and comprises a key generation module, an encryption transmission module, an evaluation execution module and a decryption transmission module;
the key generation module is used for calling a key generation algorithm Key Gen (1 λ) according to the security parameters by the client, generating a self key sk, a bootstrap key bk and a conversion key ks, sending the bootstrap key bk and the conversion key ks to the cloud server, and locally storing the self key sk; the dimensions of the self key sk, the bootstrap key bk and the conversion key ks are all n;
The encryption transmission module is used for a client to call an encryption algorithm Enc (m, sk) and uses a self secret key sk to encrypt plaintext data m epsilon-B, the first place, B-1, and ciphertext c is obtained and transmitted to the cloud server; the plaintext data comprises Boolean-level plaintext data and integer-level plaintext data;
the evaluation execution module is used for executing an evaluation algorithm Eval (c, bk, ks, f) on the ciphertext c according to an evaluation function f, a bootstrap key bk and a conversion key ks provided by the client to obtain an evaluation result c 'in the ciphertext state and sending the evaluation result c' back to the client; the evaluation algorithm comprises an integer bootstrapping algorithm and a key conversion algorithm; the evaluation function f provided by the client comprises a nonlinear evaluation function and a linear evaluation function;
The decryption transmission module is used for the client to call a decryption algorithm Dec (c ', sk) according to the self secret key sk to decrypt the evaluation result c' under the ciphertext state, and the evaluation result of the plaintext data is obtained.
A further aspect provides an electronic device, comprising:
At least one processor; and a memory communicatively coupled to the at least one processor; wherein,
The memory stores computer program instructions executable by the at least one processor to enable the at least one processor to perform the data processing method of the integer bootstrapping-based torus homomorphic encryption algorithm described above.
In yet another aspect, a computer readable storage medium is provided, in which a program is stored, where the program, when executed by a processor, implements the data processing method of the torus homomorphic encryption algorithm based on integer bootstrapping.
Compared with the prior art, the invention has the following advantages and beneficial effects:
1. The full homomorphic encryption algorithm based on integer bootstrapping provided by the invention directly supports integer-level data, and is simple in operation: the nonlinear function ReLU function and the comparison function Max function supporting integer data designed by the invention use integer bootstrap instead of the bootstrap algorithm only supporting Boolean data in the prior art. Therefore, in the operation process of the ReLU function and the Max function, the operation process is simplified, and the calculation time is reduced.
2. The computational complexity is independent of the data accuracy: the nonlinear function ReLU function and the comparison function Max function supporting the integer data designed by the invention do not need to encode the integer data in the operation process, and do not need to carry out bit-by-bit operation on the data, namely the calculation complexity does not depend on the precision of the data any more, and the calculation complexity is independent of the precision of the data, thereby improving the calculation efficiency.
Detailed Description
In order to enable those skilled in the art to better understand the present application, the following description will make clear and complete descriptions of the technical solutions according to the embodiments of the present application with reference to the accompanying drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the described embodiments of the application may be combined with other embodiments.
The technology mentioned in the present application is first described for explanation, wherein:
homomorphic encryption: an encryption method is provided, which satisfies the requirement that homomorphic operation is performed on homomorphic encrypted data to obtain an output, and the output is decrypted, and the result is the same as the output result obtained by processing unencrypted original data by the same method.
Full homomorphic encryption: the encryption method can simultaneously meet the requirements of addition homomorphic encryption and multiplication homomorphic encryption.
Bootstrapping: the key of the full homomorphic encryption method is the most time-consuming algorithm, so that the noise of the ciphertext can be reduced in the ciphertext state, and the ciphertext after noise reduction and the ciphertext before noise reduction can be decrypted, and the decryption result is the same.
Toroidal isomorphic encryption: the full homomorphic encryption method based on the torus performs gate operation on Boolean data, can perform bootstrap while performing gate operation, and is the fastest full homomorphic encryption method at present.
Plaintext space, ciphertext space: the value range of the plaintext and the value range of the ciphertext.
As shown in fig. 1, the embodiment provides a data processing method of a torus full homomorphic encryption algorithm based on integer bootstrapping, which includes the following steps:
The client calls a key generation algorithm KeyGen (1 λ) according to the security parameters, generates a self key sk, a bootstrap key bk and a conversion key ks, and sends the bootstrap key bk and the conversion key ks to the cloud server, and the self key sk is stored locally; the dimensionalities of the self secret key sk, the bootstrap secret key bk and the conversion secret key ks are all n;
the client calls an encryption algorithm Enc (m, sk) and uses a self secret key sk to encrypt plaintext data m E { B, & gt, B-1} to obtain ciphertext c and transmit the ciphertext c to the cloud server; the plaintext data comprises boolean-level plaintext data and integer-level plaintext data;
The cloud server executes an evaluation algorithm Eval (c, bk, ks, f) on the ciphertext c according to an evaluation function f, a bootstrap key bk and a conversion key ks provided by the client, and an evaluation result c' in the ciphertext state is obtained and sent back to the client; the evaluation algorithm comprises an integer bootstrap algorithm and a key conversion algorithm; the evaluation function f provided by the client comprises a nonlinear evaluation function and a linear evaluation function;
And the client calls a decryption algorithm Dec (c ', sk) according to the self secret key sk to decrypt the evaluation result c' in the ciphertext state, so as to obtain an evaluation result of plaintext data.
In the prior art, the fully homomorphic encryption is only performed on the Boolean data, but the fully homomorphic encryption of the integer-level plaintext data is realized by expanding the support data type from the Boolean level to the integer level, so that the Boolean data will not be described in detail in the application. In this embodiment, taking integer-level plaintext data 6 as an example for illustration, firstly, a client calls a key generation algorithm to obtain a self key sk, a bootstrap key bk and a conversion key ks; and then the client encrypts the integer-level plaintext data 6, generates ciphertext thereof and sends the ciphertext to the cloud server. And the cloud server executes an evaluation algorithm on the ciphertext of the 6 according to the evaluation function f, the bootstrap key bk and the conversion key ks, and sends an evaluation result of the ciphertext form back to the client. The client decrypts the ciphertext evaluation result according to the self secret key sk, and the result f (6) of the plaintext data 6 after evaluation can be obtained.
In the prior art, torus full homomorphic encryption is the most commonly used and fastest homomorphic encryption scheme at present; the torus full homomorphic encryption expands the message space to the torus, and can homomorphic gate the Boolean type data. Torus refers to any real number between 0 and 1, symbolized byAnd (3) representing. FIG. 2 shows ciphertext in torus homomorphic encryption, ciphertext represented by 1/8 as 1, and ciphertext represented by-1/8 as 0. In the toroidal isomorphic encryption scheme, the plaintext space isCiphertext space isN represents the dimension. It is noted that, since the existing torus homomorphic encryption scheme only supports homomorphic operation on bit-level boolean data, it is necessary to encode multiple bits for integer-level plaintext data, and operate bit-by-bit. In the operation process, in order to ensure the security, the decryption by malicious adversaries is prevented, so that the secret contains probabilistic noise. Just as noise is contained, the ciphertext of 1 shown in fig. 2 is not a distinct value, but a segment. And since noise is introduced in the encryption step, the noise increases sharply in the evaluation function, resulting in decryption failure. FIG. 3 illustrates the noise problem of a torus homomorphic encryption scheme, wherein the left hand side of FIG. 3 is a circuit diagram of a plaintext evaluation function, with the numbers in the diamond representing plaintext; the right side of fig. 3 is a circuit diagram of an evaluation function under ciphertext, a circle represents ciphertext after plaintext encryption, and the degree of ambiguity of numbers in the circle represents the noise level. Assuming that the plaintext can be seen through the ciphertext, namely the plaintext can be seen clearly from the beginning in the right graph, because the noise is very small at the beginning, but the ciphertext noise is increased and the plaintext in the circle becomes more blurred after each circuit operation; after a certain number of circuit calculations, the plaintext of the last several circles becomes very blurred, and the plaintext inside cannot be distinguished, i.e. the original plaintext cannot be recovered when decrypting the ciphertext, so that decryption failure is caused. In order to solve the noise problem, the existing torus homomorphic encryption scheme introduces a bootstrap algorithm in an evaluation function for reducing ciphertext noise; however, the homomorphic gate operation is only carried out on the Boolean data, and a complex and high-order polynomial is required to be constructed when nonlinear operation is carried out, so that the calculation cost is greatly increased, and the calculation efficiency is reduced.
Based on the problems, the invention designs a torus full homomorphic encryption algorithm supporting integer bootstrapping, the plaintext space is The accuracy of the data is determined by the data,Is a natural number set; the ciphertext space isA. b is two components of the ciphertext, n represents the dimension of a,Torus of real numbers between 0 and 1. The torus homomorphic encryption algorithm of the integer bootstrapping comprises a key generation algorithm, an encryption algorithm, an evaluation algorithm and a decryption algorithm, wherein:
Key generation algorithm KeyGen (1 λ): the security parameter λ is input, and a self Key sk, a bootstrap Key bk (Bootstrapping Key), and a conversion Key ks (Key-SWITCHING KEY) are generated.
Encryption algorithm Enc (m, sk): and inputting plaintext data m and a self secret key sk, and encrypting to obtain ciphertext c. Specifically, the operation of the encryption algorithm is specifically: taking a random noise e and a random mask from a gaussian distributionReturning ciphertext c= (a, b) satisfying b=sk·a+m/2b+e.
Decryption algorithm Dec (c', sk): inputting an evaluation result c 'and a self secret key sk of plaintext data m in a ciphertext state after an evaluation algorithm, and outputting a plaintext f (m) of the evaluation result c'; the decryption algorithm specifically comprises the following operations: obtaining 2Be+f (m) through 2B (B-sk.a), and obtaining corresponding plaintext f (m) through up-and-down rounding and decryption, namely
Evaluation algorithm Eval (c, bk, ks, f): and inputting a ciphertext c, a bootstrap key bk, a conversion key ks and an evaluation function f, and outputting an evaluation result c 'of the ciphertext c, wherein the ciphertext c is the ciphertext of the plaintext data m, and the ciphertext c' is the ciphertext of the ciphertext c evaluated by an evaluation algorithm.
Further, after the ciphertext is transmitted to the cloud server, an evaluation algorithm Eval (c, bk, ks, f) is executed: firstly, a large-noise ciphertext c of plaintext data m, a bootstrap key bk, a dimension parameter N and an evaluation function f are transmitted into an integer bootstrap algorithm to obtain a small-noise ciphertext c'; and then, executing a conversion algorithm on the small-noise ciphertext c 'according to the conversion key, and converting the key of the small-noise ciphertext c' into sk.
In the present invention, the evaluation algorithm includes two sub-algorithms: the integer bootstrapping algorithm and the key conversion algorithm are the core of the torus full homomorphic encryption algorithm supporting the integer bootstrapping.
The specific implementation process of the integer bootstrapping algorithm designed in the invention is as follows:
Initializing a polynomial testv=μ0+μ1X-1+μ2X-2+…+μN-1X-(N-1)=μ0-μN-1X-μN-2X2-…-μ1XN-1∈TN[X],N in a space of 2N as a polynomial dimension parameter according to an evaluation function f; { μ 0,…,μN-1 } is the coefficient set of the initialization polynomial, satisfying μ j×i =f (i), j= {0, …, N/B }, i= {0, …, B-1};
When operating a polynomial of dimension N in a 2N space, the 2N space can be understood as 2N end-to-end slots, which can be divided into 2B shares due to plaintext m e { -B.
Placing all slots in k into f (k), and placing all slots in k+b into-f (k), wherein k= {0, B-1}, f (k) is the output of the evaluation function f when the input is k, due to the non-negativity of the polynomial; as shown in fig. 4, when b=5, 2N slots are divided into 2×5 parts, i.e., k=0, 1,2,3,4; all slots in part 0 were then placed in f (0), -all slots in part 4 were placed in f (4), -all slots in part 0+5 were placed in-f (0), -all slots in part 4+5 were placed in-f (4).
And (5) plaintext rotation: the polynomial coefficient is logically shifted left and b bits are shifted, at the moment, the coefficient of the polynomial is ciphertext, the polynomial ACC after plaintext rotation is obtained, and the plaintext rotation formula is: acc= (0, testv) ·x b;
Ciphertext rotation: performing ciphertext rotation by using an outer product operation according to the polynomial ACC after plaintext rotation and the bootstrap key bk to obtain a polynomial ACC1 after ciphertext rotation; the input of the outer product operation is two ciphertexts C m1、Cm2, and the output is a ciphertext C m1×m2; the ciphertext rotation formula is: Wherein h is ciphertext of 1; a i is the ith component in ciphertext a; Representing shifting the polynomial logic by-a i bits, i.e., shifting the logic right by a i bits; bk i is the ith component of the bootstrap key bk; Is the outer product; the ciphertext rotation is repeated n times, after each rotation, a polynomial ACC1 is assigned to the polynomial ACC, when the ciphertext rotation is executed next time, the updated polynomial ACC continues to operate on the right side of the equation, and n is the dimension of a and a bootstrap key bk in the ciphertext;
and extracting constant term coefficients of the polynomial ACC1 after the ciphertext rotation, and outputting the extracted constant term coefficient ciphertext.
When the input of the integer bootstrap algorithm is the ciphertext of the integer type data, the plaintext rotation and ciphertext rotation steps ensure that the polynomial constant term after rotation is f (m), and the ciphertext in the polynomial coefficient is the ciphertext with small noise, so that the output ciphertext is the ciphertext with the ciphertext f (m) with small noise, namely the integer bootstrap algorithm can synchronously complete the evaluation function f on the ciphertext of the integer-level plaintext data in the ciphertext state while reducing the ciphertext noise.
Furthermore, the evaluation algorithm in the application realizes a linear operation algorithm and a plurality of basic nonlinear operation algorithms on the basis of an integer bootstrap algorithm. The linear operation algorithm in the application is consistent with the linear operation algorithm in the bootstrap algorithm which only supports Boolean data in the prior art, so that the description is omitted. The application focuses on nonlinear operation algorithms, including Sign operation algorithm, iden operation algorithm, eqalConst operation algorithm and MultBin operation algorithm, wherein:
1) Sign operation algorithm:
The Sign arithmetic algorithm has an input of a large noise ciphertext Cm in,Cmin representing a ciphertext of m in, m in e { -B,..2, B-1}, and an output of a small noise ciphertext Cm out, satisfying m out = -1 when m in e { -b+1,., -1} and m out = 0 when m in e { -B,0} and m out=1;mout being the plaintext of the small noise ciphertext Cm out when m in e { 1..2, B-1 }.
The specific implementation process of the Sign operation algorithm is as follows:
Designing a nonlinear evaluation function f sign (x), f sign (x) =1 when x∈ {1,., B-1} and f sign (x) =0 when x=0;
The large-noise ciphertext Cm in and the nonlinear evaluation function f sign (x) are transmitted into an integer bootstrap algorithm and output as a small-noise ciphertext Cm out;
2) Iden arithmetic algorithm:
The input of Iden operation algorithm is a large noise ciphertext Cm in, and the output is a small noise ciphertext Cm out, so that m out=min is satisfied;
The concrete implementation process of Iden operation algorithm is as follows:
Designing a nonlinear evaluation function f iden (x), f iden (x) =x when x e { -B,..b-1 };
The large-noise ciphertext Cm in and the nonlinear evaluation function f iden (x) are transmitted into an integer bootstrap algorithm and output as a small-noise ciphertext Cm out;
3) EqalConst arithmetic algorithm:
The input of EqalConst operation algorithm is a large-noise ciphertext Cm 1 and plaintext m 2,m1、m2∈{-B,...,B-1},m2 generated by the cloud server, and the output is a small-noise ciphertext Cm out, so that m out = -B when m 1=m2 is met, otherwise, m out =0;
The concrete implementation process of EqalConst operation algorithm is as follows:
Designing a nonlinear evaluation function f eqal (x), when x=0, f eqal (x) = -B, otherwise f eqal (x) =0;
Generating a ciphertext (0, m 2/2B) for m 2, and obtaining ciphertext C tmp=Cm1-(0,m2/2B);
the ciphertext C tmp and the nonlinear evaluation function f eqal (x) are transmitted into an integer bootstrap algorithm, and a small-noise ciphertext Cm out is output;
4) MultBin arithmetic algorithm:
The input of MultBin operation algorithm is a large noise ciphertext Cm int and Cm bin,mint epsilon-B, & gt, B-1} represents plaintext data of a large noise ciphertext Cm int, m bin epsilon-B, 0} is plaintext data of a large noise ciphertext Cm bin, and the output is a small noise ciphertext Cm out, so that m out=mint when m bin epsilon-B is satisfied, otherwise m out =0;
The concrete implementation process of MultBin operation algorithm is as follows:
Designing a nonlinear evaluation function f half (x), wherein f half (x) =x/2 when x is even, otherwise f half (x) = - (x+1)/2- (B-1)/2;
Generating ciphertext C tmp1=Cmint+Cmbin + (0, -B/2B); inputting the ciphertext C tmp1 into a Iden operation algorithm to output ciphertext C tmp2;
Generating ciphertext C tmp3=Cmint+Ctmp2; ciphertext C tmp3 and nonlinear evaluation function f half (x) are input into an integer bootstrapping algorithm and output as a small noise ciphertext Cm out.
Further, the evaluation function f provided by the client includes a linear evaluation function and a nonlinear evaluation function; the linear evaluation function comprises an addition and subtraction function, a multiplication and division function, an inversion function and the like; the method is the same as the implementation method in the prior art; the application aims at nonlinear evaluation functions of integer-level data, comprising a Sign operation function, a Iden operation function, a EqalConst operation function, a MultBin operation function, a ReLU operation function and a Max operation function; the Sign operation function, iden operation function, eqalConst operation function and MultBin operation function are directly realized by calling the corresponding basic nonlinear operation algorithm; the ReLU operation function and the Max operation function are realized by combining basic nonlinear operation algorithms, and specifically:
1) ReLU operation function:
The input of the ReLU operation function f relu (x) is a large noise ciphertext Cm in,min e { -B,., B-1}, the output is a small noise ciphertext Cm out, satisfying m out=frelu(min), m out=min when m in >0, otherwise m out = 0;
the specific implementation process of the ReLU operation function is as follows:
invoking a Sign operation algorithm and a Iden operation algorithm to respectively execute operation on the ciphertext Cm in to obtain a ciphertext C tmp1 and a ciphertext C tmp2;
Executing EqalConst operation algorithm on ciphertext C tmp1 and plaintext data 1 to obtain ciphertext C tmp3;
Inputting the ciphertext C tmp2 and C tmp3 into a MultBin operation algorithm, and outputting a small-noise ciphertext Cm out;
The correctness of the lower ReLU operation function is simply analyzed, when m in is more than 0, C tmp1 is 1 ciphertext, C tmp2 is m in ciphertext, and C tmp3 is B ciphertext; then, a MultBin operation algorithm is performed on C tmp3 and C tmp2, and the obtained ciphertext C tmp3 is the ciphertext of m in, which satisfies the definition of f relu (x). And the same applies when m in is less than or equal to 0.
2) Max operation function:
The input of the Max operation function is a large noise ciphertext pair (Cm x,Cmy),(mx,my) epsilon-B, & gt, B-1, and the output is a small noise ciphertext Cm out, m out=fmax(mx,my is satisfied), m out=mx is m x≥my, otherwise m out=my;
the specific implementation process of the Max operation function is as follows:
Generating ciphertext C tmp1=Cmx-Cmy, generating ciphertext C (-m y) for Cm y;
Executing a Sign operation algorithm on the ciphertext C tmp1 to obtain a ciphertext C tmp2;
Inputting the ciphertext C tmp2 and the plaintext data 1 into a EqalConst operation algorithm to perform operation to obtain ciphertext C tmp3;
inputting the ciphertext C tmp2 and the plaintext data-1 into a EqalConst operation algorithm for operation to obtain ciphertext C tmp4;
Performing Iden operation algorithm on the ciphertext Cm x and the ciphertext C (-m y) to obtain a ciphertext C tmp5 and a ciphertext C tmp6;
Invoking MultBin an operation algorithm to operate on the ciphertext C tmp3 and the ciphertext C tmp5 to obtain a ciphertext C tmp7; invoking MultBin an operation algorithm to operate on the ciphertext C tmp4 and the ciphertext C tmp6 to obtain a ciphertext C tmp8;
ciphertext C tmp7 is added to ciphertext C tmp8 to yield a low noise ciphertext Cm out.
The correctness of the Max operation function is briefly analyzed below, when m x>my, C tmp1 is the positive ciphertext, C tmp2 is the ciphertext of 1, C tmp3 is the ciphertext of B, ciphertext of C tmp4 being 0, ciphertext of C tmp5 being m x, ciphertext of C tmp6 being-m y; Then, performing MultBin operation algorithm on C tmp3 and C tmp5 to obtain ciphertext C tmp7 as ciphertext of m x; MultBin operation algorithm is carried out on the C tmp4 and the C tmp6, and the obtained ciphertext C tmp8 is a ciphertext of 0; Finally, C tmp7 and C tmp8 are added to obtain a ciphertext with Cm out of m x, which satisfies the definition of f max. m x≤my is the same.
In summary, the torus full homomorphic encryption algorithm supporting integer bootstrapping provided by the invention realizes the bootstrapping algorithm supporting the integer level data by expanding the Boolean level data to the integer level data and redesigning the bootstrapping algorithm, thereby greatly improving the calculation efficiency. Meanwhile, the nonlinear function of the integer-level data is supported to operate, so that the complexity of the scheme is reduced.
It should be noted that, for the sake of simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the present invention is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present invention.
Based on the same thought as the data processing method of the torus full homomorphic encryption algorithm based on integer bootstrapping in the embodiment, the invention also provides a data processing system of the torus full homomorphic encryption algorithm based on integer bootstrapping, and the system can be used for executing the data processing method of the torus full homomorphic encryption algorithm based on integer bootstrapping. For ease of illustration, only those portions of an embodiment of the invention that are relevant to an embodiment of the invention are shown in a schematic diagram of an embodiment of a data processing system based on an integer bootstrapping torus homomorphic encryption algorithm, and those skilled in the art will appreciate that the illustrated structure does not constitute a limitation of the apparatus, and may include more or fewer components than illustrated, or may combine certain components, or a different arrangement of components.
As shown in FIG. 5, another embodiment of the present invention provides a data processing system 500 of a torus full homomorphic encryption algorithm based on integer bootstrapping, which comprises a key generating module 501, an encryption transmission module 502, an evaluation execution module 503 and a decryption transmission module 504;
The key generation module 501 is configured to invoke a key generation algorithm KeyGen (1 λ) according to a security parameter by a client, generate a self-key sk, a bootstrap key bk and a conversion key ks, send the bootstrap key bk and the conversion key ks to a cloud server, and store the self-key sk locally; the dimensionalities of the self secret key sk, the bootstrap secret key bk and the conversion secret key ks are all n;
The encryption transmission module 502 is used for the client to call an encryption algorithm Enc (m, sk) and use the self secret key sk to encrypt the plaintext data m epsilon-B, & gt, B-1, so as to obtain a ciphertext c and transmit the ciphertext c to the cloud server; the plaintext data comprises boolean-level plaintext data and integer-level plaintext data;
The evaluation execution module 503 is configured to execute an evaluation algorithm Eval (c, bk, ks, f) on the ciphertext c according to the evaluation function f, the bootstrap key bk, and the conversion key ks provided by the client, so as to obtain an evaluation result c 'in the ciphertext state, and send the evaluation result c' back to the client; the evaluation algorithm comprises an integer bootstrap algorithm and a key conversion algorithm; the evaluation function f provided by the client comprises a nonlinear evaluation function and a linear evaluation function;
The decryption transmission module 504 is configured to invoke a decryption algorithm Dec (c ', sk) according to the self-key sk, and perform a decryption operation on the evaluation result c' in the ciphertext state, so as to obtain an evaluation result of plaintext data.
It should be noted that, the data processing system based on the whole-number bootstrapping torus full homomorphic encryption algorithm of the present invention corresponds to the data processing method based on the whole-number bootstrapping torus full homomorphic encryption algorithm of the present invention one by one, and technical features and beneficial effects described in the embodiments of the data processing method based on the whole-number bootstrapping torus full homomorphic encryption algorithm are applicable to the embodiments of the data processing system based on the whole-number bootstrapping torus full homomorphic encryption algorithm, and specific content can be seen from the description in the embodiments of the method of the present invention, which is not repeated here, and is stated here.
In addition, in the implementation manner of the data processing system based on the whole-number bootstrapping torus full homomorphic encryption algorithm of the embodiment, the logic division of each program module is only illustrative, and in practical application, the above-mentioned function allocation may be performed by different program modules according to requirements, for example, in view of configuration requirements of corresponding hardware or convenience of implementation of software, that is, the internal structure of the data processing system based on the whole-number bootstrapping torus full homomorphic encryption algorithm is divided into different program modules, so as to complete all or part of the functions described above.
As shown in fig. 6, in one embodiment, an electronic device is provided that implements a data processing method of an integer bootstrapping-based torus full homomorphic encryption algorithm, where the electronic device 600 may include a first processor 601, a first memory 602, and a bus, and may further include a computer program stored in the first memory 602 and executable on the first processor 601, such as the data processing program 603 of the integer bootstrapping-based torus full homomorphic encryption algorithm.
The first memory 602 includes at least one type of readable storage medium, which includes flash memory, a mobile hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The first memory 602 may in some embodiments be an internal storage unit of the electronic device 600, such as a mobile hard disk of the electronic device 600. The first memory 602 may also be an external storage device of the electronic device 600 in other embodiments, such as a plug-in mobile hard disk, a smart memory card (SMART MEDIA CARD, SMC), a secure digital (SecureDigital, SD) card, a flash memory card (FLASH CARD), etc. that are provided on the electronic device 600. Further, the first memory 602 may also include both an internal storage unit and an external storage device of the electronic device 600. The first memory 602 may be used to store not only application software installed in the electronic device 600 and various data, such as code of the data processing program 603 of the torus homomorphic encryption algorithm based on integer bootstrapping, but also temporarily store data that has been output or is to be output.
The first processor 601 may be formed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be formed of multiple integrated circuits packaged with the same function or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The first processor 601 is a Control Unit (Control Unit) of the electronic device, connects various components of the entire electronic device using various interfaces and lines, executes or executes programs or modules (e.g., a data processing program based on an integer bootstrapping torus homomorphic encryption algorithm, etc.) stored in the first memory 602, and invokes data stored in the first memory 602 to perform various functions of the electronic device 600 and process the data.
Fig. 6 illustrates only an electronic device having components, and it will be appreciated by those skilled in the art that the configuration illustrated in fig. 6 is not limiting of the electronic device 600 and may include fewer or more components than illustrated, or may combine certain components, or a different arrangement of components.
The data processing program 603 of the torus full homomorphic encryption algorithm based on integer bootstrapping stored in the first memory 602 of the electronic device 600 is a combination of a plurality of instructions, which when executed in the first processor 601, can implement:
The client calls a key generation algorithm KeyGen (1 λ) according to the security parameters, generates a self key sk, a bootstrap key bk and a conversion key ks, and sends the bootstrap key bk and the conversion key ks to the cloud server, and the self key sk is stored locally; the dimensionalities of the self secret key sk, the bootstrap secret key bk and the conversion secret key ks are all n;
the client calls an encryption algorithm Enc (m, sk) and uses a self secret key sk to encrypt plaintext data m E { B, & gt, B-1} to obtain ciphertext c and transmit the ciphertext c to the cloud server; the plaintext data comprises boolean-level plaintext data and integer-level plaintext data;
The cloud server executes an evaluation algorithm Eval (c, bk, ks, f) on the ciphertext c according to an evaluation function f, a bootstrap key bk and a conversion key ks provided by the client, and an evaluation result c' in the ciphertext state is obtained and sent back to the client; the evaluation algorithm comprises an integer bootstrap algorithm and a key conversion algorithm; the evaluation function f provided by the client comprises a nonlinear evaluation function and a linear evaluation function;
And the client calls a decryption algorithm Dec (c ', sk) according to the self secret key sk to decrypt the evaluation result c' in the ciphertext state, so as to obtain an evaluation result of plaintext data.
Further, the modules/units integrated with the electronic device 600 may be stored in a non-volatile computer readable storage medium if implemented in the form of software functional units and sold or used as a stand-alone product. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
Those skilled in the art will appreciate that all or part of the processes in the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a non-volatile computer readable storage medium, and where the program, when executed, may include processes in the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above examples, and any other changes, modifications, substitutions, combinations, and simplifications that do not depart from the spirit and principle of the present invention should be made in the equivalent manner, and the embodiments are included in the protection scope of the present invention.