Data processing method, device, computer equipment and computer readable storage medium
By splitting and combining encrypted data through a fully homomorphic encryption algorithm, the problems of large computational complexity and complicated steps in the existing technology for comparing the size of encrypted data are solved, and fast and reliable comparison of long-bit encrypted data is achieved.
Patent Information
- Application Number
- CN202111101946.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-18
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2041-09-18
AI Technical Summary
The existing technology has a large amount of calculation and cumbersome steps when performing encrypted data size comparison, especially when comparing long bit integers, and cannot effectively support the size comparison between encrypted integers.
A fully homomorphic encryption algorithm is used to split and combine encrypted data, and the size relationship between encrypted data and reference data is calculated through homomorphic multiplication and addition to achieve fast and efficient ciphertext comparison.
It realizes fast and reliable comparison between long-bit encrypted data and reference data, simplifies the operation steps, reduces the amount of calculation, and ensures the security and efficiency of ciphertext comparison.
Smart Images

Figure CN114003781B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a data processing method, apparatus, computer equipment, and computer-readable storage medium. Background Art
[0002] In the related art, two solutions are generally used to solve the problem of comparing the size of encrypted data (for example, integer encrypted data). 1) Adopt a privacy-preserving decision tree reasoning scheme and borrow a semi-trusted third-party arbitration setting to assist the reasoning process; 2) Calculate the size comparison between encrypted integers based on a lookup table. However, when using the above two solutions to solve the size comparison problem of (integer) encrypted data, the following problems will arise: 1) Borrowing a semi-trusted third-party arbitration setting, but the security and reliability are not high; 2) The lookup based on the lookup table can only support short-bit integers. For long-bit integers, the calculation amount is too large, the ciphertext list is too long, and it is difficult to complete the ciphertext comparison. In order to complete the comparison of long-bit integers, it is necessary to increase the number of communication rounds and the communication volume. The steps are too cumbersome, and it can only support the size comparison between ciphertext and plaintext, and cannot support the size comparison between two encrypted integers.
[0003] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0004] Embodiments of the present invention provide a data processing method, apparatus, computer device, and computer-readable storage medium to at least solve the technical problems of excessive computational complexity and complicated computational steps that occur when comparing ciphertext sizes in related technologies.
[0005] According to one aspect of an embodiment of the present invention, a data processing method is provided, comprising: receiving integer encrypted data sent by a client device, wherein the integer encrypted data is obtained by encrypting a predetermined integer of data that meets a predetermined bit length condition, and the bit length of the predetermined integer is greater than a predetermined number of bits; comparing the integer encrypted data with reference data to obtain result encrypted data; and sending the result encrypted data to the client device, so that the client device decrypts the result encrypted data using a predetermined decryption key to obtain a comparison result between the integer encrypted data and the reference data.
[0006] Optionally, the comparing the encrypted data of the integer encrypted data with the reference data to obtain the result encrypted data includes: splitting the encrypted data of the integer encrypted data to obtain a plurality of partial encrypted data arranged according to position, and splitting the reference data into a plurality of partial data arranged according to position; comparing the partial encrypted data obtained by splitting the encrypted data of the integer encrypted data with the corresponding partial data obtained by splitting the reference data according to the position correspondence to obtain the partial result encrypted data of the corresponding position; and combining the plurality of partial result encrypted data corresponding to the plurality of partial encrypted data to obtain the result encrypted data.
[0007] Optionally, the integer encrypted data is obtained by performing fully homomorphic encryption on the predetermined integer that meets the predetermined bit length condition. When the reference data is encrypted data, the reference data is data obtained using fully homomorphic encryption.
[0008] Optionally, combining the multiple partial result encrypted data corresponding to the multiple partial encrypted data to obtain the result encrypted data includes: for each partial encrypted data in the multiple partial encrypted data, performing homomorphic multiplication on the partial result encrypted data corresponding to the partial encrypted data with the partial result encrypted data corresponding to the previous partial encrypted data of the partial encrypted data to obtain the component items corresponding to the partial encrypted data; and performing homomorphic addition on the component items corresponding to the multiple partial encrypted data to obtain the result encrypted data.
[0009] Optionally, the reference data includes: encrypted data, or plaintext data.
[0010] Optionally, the data meeting the predetermined bit length condition is data having a bit length greater than or equal to 20 bits.
[0011] According to another aspect of an embodiment of the present invention, a data processing method is provided, comprising: encrypting a predetermined integer of data that meets a predetermined bit length condition to obtain integer encrypted data, wherein the bit length of the predetermined integer is greater than a predetermined number of bits; sending the integer encrypted data to a server, for the server to compare the integer encrypted data with reference data to obtain result encrypted data; receiving the result encrypted data returned by the server, and decrypting the result encrypted data using a predetermined decryption key to obtain a comparison result between the integer encrypted data and the reference data.
[0012] Optionally, the integer encrypted data is obtained by performing fully homomorphic encryption on the predetermined integer that meets the predetermined bit length condition. When the reference data is encrypted data, the reference data is data obtained using fully homomorphic encryption.
[0013] Optionally, the result encrypted data is obtained by homomorphically adding component items corresponding to multiple partial encrypted data, the multiple partial encrypted data are obtained by splitting the encrypted data of the integer encrypted data, and the reference data is split into multiple partial data. According to the position correspondence, the partial encrypted data obtained by splitting the encrypted data of the integer encrypted data are compared with the corresponding partial data obtained by splitting the reference data to obtain partial result encrypted data at the corresponding position. For each partial encrypted data in the multiple partial encrypted data, the component item corresponding to the partial encrypted data is obtained by homomorphic multiplication of the partial result encrypted data corresponding to the partial encrypted data and the partial result encrypted data corresponding to the previous partial encrypted data of the partial encrypted data.
[0014] Optionally, the data meeting the predetermined bit length condition is data having a bit length greater than or equal to 20 bits, and the predetermined number of bits is greater than or equal to 20 bits.
[0015] According to another aspect of an embodiment of the present invention, a data processing device is provided, comprising: a first receiving module, configured to receive integer encrypted data sent by a client device, wherein the integer encrypted data is obtained by encrypting a predetermined integer of data that meets a predetermined bit length condition, and the bit length of the predetermined integer is greater than a predetermined number of bits; a first comparing module, configured to compare the integer encrypted data with reference data to obtain result encrypted data; and a first sending module, configured to send the result encrypted data to the client device, so that the client device decrypts the result encrypted data using a predetermined decryption key to obtain a comparison result between the integer encrypted data and the reference data.
[0016] According to another aspect of an embodiment of the present invention, a data processing device is provided, comprising: a first encryption module, configured to encrypt a predetermined integer of data satisfying a predetermined bit length condition to obtain integer encrypted data, wherein the bit length of the predetermined integer is greater than a predetermined number of bits; a second sending module, configured to send the integer encrypted data to a server, for the server to compare the integer encrypted data with reference data to obtain result encrypted data; and a second receiving module, configured to receive the result encrypted data returned by the server, and decrypt the result encrypted data using a predetermined decryption key to obtain a comparison result between the integer encrypted data and the reference data.
[0017] According to another aspect of an embodiment of the present invention, a computer device is provided, comprising: a memory and a processor, wherein the memory stores a computer program; the processor is configured to execute the computer program stored in the memory, wherein when the computer program is executed, the processor executes any one of the data processing methods.
[0018] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any one of the data processing methods described above.
[0019] According to another aspect of an embodiment of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any one of the data processing methods described above.
[0020] In an embodiment of the present invention, the encrypted data sent by the client device is compared with the reference data to obtain result encrypted data, and the result data is decrypted in the client device using a predetermined decryption key. Since the encrypted data is data that meets the predetermined bit length condition, for example, it can be an integer with a bit length greater than a predetermined number of bits, for example, greater than 20 bits, the long-bit encrypted data is quickly and efficiently compared with the reference data, and the comparison of the long-bit encrypted data with the reference data is realized to obtain the encrypted comparison result, and decryption is implemented in the client device, which effectively solves the technical problems of excessive calculation amount and cumbersome calculation steps when comparing ciphertext sizes in related technologies. For example, the related technology can only compare encrypted data below 10 bits, so that not only the operation is simple, but also the ciphertext comparison result is obtained efficiently, and the reliability of the ciphertext comparison is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0022] Figure 1 A hardware structure block diagram of a computer terminal for implementing a data processing method is shown;
[0023] Figure 2 is a flow chart of a data processing method 1 according to embodiment 1 of the present invention;
[0024] Figure 3 is a flow chart of a second data processing method according to embodiment 1 of the present invention;
[0025] Figure 4 It is a flow chart of using decision tree to make data judgment in related technologies;
[0026] Figure 5 is a structural block diagram of a data processing device 1 provided according to embodiment 2 of the present invention;
[0027] Figure 6 is a structural block diagram of a data processing device 2 provided according to embodiment 3 of the present invention;
[0028] Figure 7 is a device block diagram of a terminal according to an embodiment of the present invention;
[0029] Figure 8 is a structural block diagram of a server according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretations:
[0033] Fully homomorphic encryption: A special cryptographic algorithm that supports computation on encrypted data. It consists of a set of encryption / decryption algorithms and additive homomorphic and multiplicative homomorphic algorithms. Homomorphic encryption algorithms allow arithmetic addition and multiplication between ciphertexts. For example, the additive homomorphism on encrypted integers is Add(Enc(10), Enc(7)) = Enc(17), and the multiplicative homomorphism is Mul(Enc(10), Enc(7)) = Enc(70).
[0034] Size comparison between integer ciphertexts: For two encrypted integers Enc(a) and Enc(b), compare their size relationship, such as the greater than relationship GreaterThan (or the less than relationship LessThan). If a>b, GreaterThan(Enc(a), Enc(b)) calculates the ciphertext of 1, that is, Enc(1); otherwise, a<=b, GreaterThan(Enc(a), Enc(b)) calculates the ciphertext of 0, that is, Enc(0).
[0035] Long bit integer: a bit integer with more than 10 bits, for example, an integer greater than 20 bits.
[0036] Example 1
[0037] According to an embodiment of the present invention, an embodiment of a data processing method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0038] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing a data processing method. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more (illustrated as 102a, 102b, ..., 102n) processors 102 (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0039] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuitry may be a single independent processing module, or may be incorporated in whole or in part into any of the other components of the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0040] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the data processing method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the data processing method of the application described above. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0041] The transmission device 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of the computer terminal 10. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.
[0042] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0043] Under the above operating environment, this application provides Figure 2 The data processing method shown. Figure 2 is a flow chart of a data processing method 1 according to embodiment 1 of the present invention. Figure 2 As shown, the method includes the following steps:
[0044] Step S202: receiving encrypted data sent by the client device, wherein the encrypted data is obtained by encrypting a predetermined integer;
[0045] Step S204, comparing the encrypted data with the reference data to obtain result encrypted data;
[0046] Step S206: Send the encrypted data to the client device, so that the client device decrypts the encrypted data using a predetermined decryption key to obtain a comparison result between the encrypted data and the reference data.
[0047] Through the above steps, for the server side, the encrypted data sent by the client device is compared with the reference data to obtain the result encrypted data, and the predetermined decryption key is used to decrypt the result data on the client device. Since the encrypted data is data that meets the predetermined bit length condition, for example, the bit length can be greater than the predetermined number of bits, for example, an integer greater than 20 bits, thereby quickly and efficiently obtaining the long-bit encrypted data and the reference data for comparison, realizing the comparison of the long-bit encrypted data and the reference data, obtaining the encrypted comparison result, and realizing decryption in the client device, effectively solving the technical problems of excessive calculation amount and cumbersome calculation steps when comparing the ciphertext size in the related technology, for example, the related technology can only compare encrypted data below 10 bits, so as to achieve not only simple operation, but also efficient ciphertext comparison results, and ensure the reliability of the ciphertext comparison.
[0048] As an optional embodiment, taking the case where the encrypted data is an integer whose bit length is greater than a predetermined number of bits as an example, receiving the integer encrypted data sent by the client device can ensure that the data obtained from the client device is encrypted, thereby preventing the data of the client device from being leaked during the data transmission process. The integer encrypted data is obtained by encrypting the predetermined integer. The predetermined integer has a certain length, and the length of the predetermined integer can be measured in bits. In this optional embodiment, the bit length of the predetermined integer is greater than the predetermined number of bits. The predetermined number of bits can be set independently according to the actual application situation. For example, the predetermined number of bits is set to be greater than or equal to 20 bits. It should be noted that whether the encrypted data is data obtained by encrypting data that meets the predetermined bit length condition can be identified in a variety of ways. For example, when receiving the encrypted data sent by the client device, an identification bit can be read from the identification information identifying the encrypted data. The identification bit is used to identify whether the encrypted data is data obtained by encrypting data that meets the predetermined bit length condition. For example, when the flag bit is 1, it indicates that the encrypted data received from the client device is obtained by encrypting data that meets the predetermined bit length condition. When the flag bit is 0, it indicates that the encrypted data received from the client device is not obtained by encrypting data that meets the predetermined bit length condition. It should be noted that the longer the bit length is, the greater the amount of computation required when performing ciphertext comparison. When the number of bits is 10 bits, the length of the encrypted ciphertext is 2^10=1024; when the number of bits is 20 bits, the length of the encrypted ciphertext is 1048576. It can be seen that as the bit length increases, the amount of computation required for ciphertext encryption increases exponentially. The length range of the predetermined bit number can be adaptively selected according to the actual operating conditions of the computing device so that the ciphertext comparison result can be obtained efficiently.
[0049] As an optional embodiment, the encrypted data is compared with the reference data to obtain the resulting encrypted data. As long as the user uploads the encrypted data to the server, the server can directly calculate the size comparison between the encrypted data and the reference data without the need for additional communication interaction. By comparison, the size relationship between the encrypted data and the reference data can be quickly obtained. In the comparison process, a variety of comparison methods can be selected, such as fully homomorphic algorithms, list comparison methods, and so on. Adaptive selection is performed based on the size of the encrypted data and the type of reference data. Among them, the reference data includes: encrypted data, or plaintext data. That is, in this optional embodiment, the comparison between encrypted data and encrypted data can be realized, and the comparison between encrypted data and plaintext data can also be realized. It has a large scope of application.
[0050] As an optional embodiment, the encrypted data is compared with the reference data to obtain the result encrypted data, and a variety of methods can be selected. It should be noted that if the lengths of the reference data and the encrypted data are different, the size relationship between the two can be directly determined based on the lengths of the data. For example, the comparison can be achieved in the following manner: the encrypted data is compared with the reference data to obtain the result encrypted data, including: splitting the encrypted data to obtain multiple partial encrypted data arranged according to position, and splitting the reference data into multiple partial data arranged according to position; comparing the partial encrypted data obtained by splitting the encrypted data with the corresponding partial data obtained by splitting the reference data according to the position correspondence relationship to obtain partial result encrypted data of the corresponding position; and combining multiple partial result encrypted data corresponding to the multiple partial encrypted data to obtain the result encrypted data. For example, if the reference data and the integer encrypted data have the same length, the comparison can be performed in the following manner, for example: splitting the integer encrypted data to obtain multiple partial encrypted data arranged according to position, and splitting the reference data into multiple partial data arranged according to position. When splitting the integer encrypted data and the reference data, the integer encrypted data and the reference data need to be divided in the same position. For example, if the integer encrypted data is 20 bits long, the integer encrypted data is split from the middle position into two 10-bit parts, that is, the 20-bit integer encrypted data is divided into a 10-bit high-order part and a 10-bit low-order part. In this case, the reference data needs to be divided in the same position. That is, if the reference data is 20 bits long, the reference data is also split from the middle position into two 10-bit parts, that is, the 20-bit reference data is divided into a 10-bit high-order part and a 10-bit low-order part. This allows the two parts of the integer encrypted data and the reference data to be compared separately. That is, according to the positional correspondence, the partial encrypted data obtained by splitting the integer encrypted data is compared with the corresponding partial data obtained by splitting the reference data to obtain the partial result encrypted data at the corresponding position. Since the data length is reduced, the required computational complexity is also reduced, which speeds up the comparison process. The multiple partial result encrypted data corresponding to the multiple partial encrypted data are combined to obtain the result encrypted data. After the integer encrypted data and the reference data are divided into multiple parts, the comparison conditions also change. For example, before the division, it is necessary to compare the size relationship between the integer encrypted data and the reference data. After the division, it is necessary to compare the size relationship between the high-order part of the integer encrypted data and the high-order part of the reference data. When the size relationship between the high-order part of the integer encrypted data and the high-order part of the reference data is the same, the size relationship between the low-order part of the integer encrypted data and the low-order part of the reference data is compared.It should be noted that in this optional embodiment, only the case of dividing the overall encrypted data and reference data into two parts is given as an example. The case of dividing the overall encrypted data and reference data into more parts according to their lengths can also be applied. The logic for determining the size relationship between the encrypted data and the reference data is the same as above and will not be elaborated here.
[0051] As an optional embodiment, the encrypted data is obtained by performing fully homomorphic encryption on data that meets a predetermined bit length condition. When the reference data is encrypted data, the reference data is data obtained by using fully homomorphic encryption. For example, the integer encrypted data is obtained by performing fully homomorphic encryption on a predetermined integer. When the reference data is encrypted data, the reference data is data obtained by using fully homomorphic encryption. Among them, the fully homomorphic encryption algorithm includes additive homomorphism and multiplicative homomorphism. Using the fully homomorphic encryption algorithm, calculations can be performed in the cloud server, and ciphertext data can also be calculated without the need for decryption. In the process of integer encryption using fully homomorphic encryption, data processing rights and data ownership can be separated, which prevents client data leakage while utilizing the computing power of the cloud server. After the integer encrypted data and the reference data are divided into multiple parts as described above, additive homomorphism and multiplicative homomorphism can also be used to compare the sizes of the encrypted data and the multiple parts of the reference data, and obtain the size relationship between the encrypted data and the reference number.
[0052] As an optional embodiment, multiple partial encrypted result data corresponding to the multiple partial encrypted data are combined to obtain the result encrypted data. Specifically, the following method can be used: for each partial encrypted data in the multiple partial encrypted data, the partial encrypted result data corresponding to the partial encrypted data is homomorphically multiplied with the partial encrypted result data corresponding to the previous partial encrypted data of the partial encrypted data to obtain the component items corresponding to the partial encrypted data; and the component items corresponding to the multiple partial encrypted data are homomorphically added to obtain the result encrypted data. This can be simply understood as homomorphic multiplication represents an AND relationship, and homomorphic addition represents a NOT relationship. When the encrypted data and reference data are divided into two parts, namely, a high-order part and a low-order part, homomorphic multiplication is performed on the partial result encrypted data corresponding to the partial result encrypted data of the partial encrypted data with the partial result encrypted data corresponding to the previous partial encrypted data of the partial encrypted data. That is, the result of comparing the encrypted data with the low-order part of the reference data is homomorphically multiplied with the partial result corresponding to the previous partial data of the partial encrypted data, i.e., the result of the high-order part of the encrypted data and the reference data being equal. This results in a component item corresponding to the partial encrypted data. Homomorphic addition is performed on the component items corresponding to the multiple partial encrypted data. That is, the component items are homomorphically added with the result of comparing the encrypted data with the high-order part of the reference data to obtain the result encrypted data. Through homomorphic operation, the result encrypted data is accurately represented.
[0053] As an optional embodiment, the encrypted result data is sent to the client device, which then decrypts the encrypted result data using a predetermined decryption key to obtain a comparison result between the (integer) encrypted data and the reference data. The comparison result data received by the client device is also encrypted and requires the predetermined decryption key to be used on the client device to decrypt the encrypted result data, effectively preventing data leakage during the comparison process.
[0054] Figure 3 is a flow chart of a second data processing method according to embodiment 1 of the present invention. Figure 3 As shown, the method includes the following steps:
[0055] Step S302, encrypting the data that meets the predetermined bit length condition to obtain encrypted data;
[0056] Step S304: Send the encrypted data to the server, so that the server compares the encrypted data with the reference data to obtain result encrypted data;
[0057] Step S306: receiving the encrypted result data returned by the server, and decrypting the encrypted result data using a predetermined decryption key to obtain a comparison result between the encrypted data and the reference data.
[0058] Through the above steps, for the client side, the encrypted data obtained after encrypting the data that meets the predetermined bit length condition is sent to the server, and the result encrypted data returned by the server is received, and the result data is decrypted using a predetermined decryption key. Since the encrypted data is data that meets the predetermined bit length condition, for example, it can be a bit length greater than a predetermined number of bits, for example, an integer greater than 20 bits, so that the long-bit encrypted data is quickly and efficiently compared with the reference data, and the comparison of the long-bit encrypted data with the reference data is realized, and the encrypted comparison result is obtained. Decryption is implemented in the client device, which effectively solves the technical problems of excessive calculation amount and cumbersome calculation steps when comparing ciphertext sizes in related technologies. For example, the related technology can only compare encrypted data below 10 bits, so as to achieve not only simple operation but also efficient ciphertext comparison results, thereby ensuring the reliability of ciphertext comparison.
[0059] As an optional embodiment, the encrypted data is obtained by performing fully homomorphic encryption on data that meets the predetermined bit length condition. When the reference data is encrypted data, the reference data is data obtained by using fully homomorphic encryption. Taking the case where the data that meets the predetermined bit length condition is a predetermined integer whose bit length is greater than the predetermined bit length, the predetermined integer is encrypted to obtain integer encrypted data, wherein the bit length of the predetermined integer is greater than the predetermined number of bits. The predetermined number of bits is greater than or equal to 20 bits. This ensures that the data sent from the client device is encrypted to prevent the predetermined integer from being leaked during the data transmission process. The integer encrypted data is obtained by encrypting a predetermined integer. The predetermined integer has a certain length, and the length of the predetermined integer is in bits. In this optional embodiment, the bit length of the predetermined integer is greater than the predetermined number of bits. The predetermined number of bits can be set independently according to the actual application situation. For example, the predetermined number of bits is set to be greater than or equal to 20 bits. It should be noted that the longer the bit length, the greater the amount of computation required when performing ciphertext comparison. When the bit length is 10, the encrypted ciphertext length is 2^10 = 1024; when the bit length is 20, the encrypted ciphertext length is 1048576. As can be seen, as the bit length increases, the computational complexity of ciphertext encryption increases exponentially. The predetermined bit length range can be adaptively selected based on the actual operating conditions of the computing device to efficiently obtain ciphertext comparison results.
[0060] As an optional embodiment, the encrypted data is sent to the server, and the server compares the encrypted data with the reference data to obtain the resulting encrypted data. As long as the user uploads the encrypted data to the server, the server can directly calculate the size comparison between the encrypted data and the reference data without the need for additional communication interaction. Through comparison, the size relationship between the encrypted data and the reference data can be quickly obtained. In the comparison process, a variety of comparison methods can be selected, such as fully homomorphic algorithms, list comparison methods, and so on. Adaptive selection is performed based on the size of the encrypted data and the type of reference data. Among them, the reference data includes: encrypted data, or plaintext data. That is, in this optional embodiment, the comparison of encrypted data and encrypted data can be realized, and the comparison of encrypted data and plaintext data can also be realized. It has a large scope of application.
[0061] As an optional embodiment, the encrypted result data returned by the server is received and decrypted using a predetermined decryption key to obtain a comparison result between the encrypted data and the reference data. The comparison result data received by the client device is also encrypted and requires the predetermined decryption key to decrypt the encrypted result data, effectively preventing data leakage during the comparison process.
[0062] As an optional embodiment, the encrypted data is obtained by performing fully homomorphic encryption on a predetermined integer. When the reference data is encrypted data, the reference data is data obtained by using fully homomorphic encryption. The fully homomorphic encryption algorithm includes additive homomorphism and multiplicative homomorphism. Using the fully homomorphic encryption algorithm, calculations can be performed in the cloud server, and the ciphertext data can be calculated without the need for decryption. In the process of integer encryption using fully homomorphic encryption, data processing rights and data ownership can be separated, which prevents client data leakage while utilizing the computing power of the cloud server. After the encrypted data and the reference data are divided into multiple parts as described above, additive homomorphism and multiplicative homomorphism can also be used to compare the sizes of the encrypted data and the multiple parts of the reference data, and obtain the size relationship between the encrypted data and the reference number.
[0063] As an optional embodiment, the result encrypted data is obtained by homomorphically adding components corresponding to multiple partial encrypted data, the multiple partial encrypted data being obtained by splitting the encrypted data, and the reference data being split into multiple partial data. The partial encrypted data obtained by splitting the encrypted data are compared with the corresponding partial data obtained by splitting the reference data according to the positional correspondence to obtain partial result encrypted data at the corresponding position. For each partial encrypted data in the multiple partial encrypted data, the component corresponding to the partial encrypted data is obtained by homomorphically multiplying the partial result encrypted data corresponding to the partial encrypted data with the partial result encrypted data corresponding to the previous partial encrypted data of the partial encrypted data. This can be simply understood as homomorphic multiplication representing an AND relationship, and homomorphic addition representing an AND relationship. When the encrypted data and reference data are divided into two parts, namely, a high-order part and a low-order part, homomorphic multiplication is performed on the partial result encrypted data corresponding to the partial result encrypted data of the partial encrypted data with the partial result encrypted data corresponding to the previous partial encrypted data of the partial encrypted data. That is, the result of comparing the encrypted data with the low-order part of the reference data is homomorphically multiplied with the partial result corresponding to the previous partial data of the partial encrypted data, i.e., the result of the high-order part of the encrypted data and the reference data being equal. This results in a component item corresponding to the partial encrypted data. Homomorphic addition is performed on the component items corresponding to the multiple partial encrypted data. That is, the component items are homomorphically added with the result of comparing the encrypted data with the high-order part of the reference data to obtain the result encrypted data. Through homomorphic operation, the result encrypted data is accurately represented.
[0064] Based on the above embodiment and optional embodiment, an optional implementation manner is provided, which is described in detail below.
[0065] In the related art, two solutions are used to solve the size comparison problem of encrypted integers. 1) A privacy-preserving decision tree reasoning solution is used, and a semi-trusted third-party arbitration setting is used to assist the reasoning process. For example, A has a risk control model with excellent performance, and B has data and wants to use A's model to reason about the data; but A is unwilling to tell B the internal parameters of the model, and B is unwilling to tell A his own data; for example, A has a financial risk control model that can give a financial risk control rating based on the consumer's portrait, and B hopes to pay to purchase A's risk control model for his own use, so as to better design targeted products; if A gives the model parameters directly to B, then B can disseminate and sell it for the second time, which is not good for A; if B gives the consumer data to A for reasoning, it may infringe on the consumer's privacy, because the consumer may only agree to authorize B to give personal information. At this time, a third-party arbitration setting is needed to assist the reasoning process, that is, to design a solution that allows B to use the model while meeting the security demands of both parties. Currently, the decision tree is one of the most commonly used models in risk control models. The reasoning process of the decision tree is a process of size judgment. Figure 4 It is a flowchart of using decision tree to make data judgment in related technologies, such as Figure 4 As shown, the judgment is made by comparing data; 2) the size comparison between encrypted integers is calculated based on a lookup table. For example, integers in [0,4] will be encrypted 5 times; for example, the integer 2 will be encrypted into a ciphertext list [Enc(0), Enc(0), Enc(0), Enc(1), Enc(1)], that is, the ciphertext with bits 1 to 3 being 0, and the ciphertext with bits 4 to 5 being 1. In other words, the size relationship between the values is obtained by looking up the table. If you want to compare the size relationship between the plaintext 3 and this ciphertext, you only need to take out the ciphertext number 4 in the list. However, when using the above two solutions to solve the problem, the following problems will arise: 1) Borrowing a semi-trusted third-party arbitration setting, the security and reliability are not high; 2) The lookup based on the lookup table can only support short-bit integers. For example, each 10-bit integer needs to be encrypted into a ciphertext list with a length of 2^10=1024. For long integers, such as 20-bit integers, the list length needs to expand to 2^20 to 1 million, which increases the computational complexity and the length of the ciphertext list, making ciphertext comparison difficult. Comparing long integers also requires increasing the number of communication rounds and the amount of communication, making the steps too cumbersome. Furthermore, the algorithm only supports ciphertext-plaintext size comparisons, not comparing two encrypted integers.
[0066] The above examples illustrate that the related art cannot solve the problem of efficiently comparing the sizes of ciphertexts.
[0067] Based on this, an optional embodiment of the present invention provides a size comparison scheme between multi-bit ciphertexts based on fully homomorphic encryption, taking integer ciphertext as an example. This scheme is an indispensable part of building secure databases, secure decision trees and other applications. The solution provided by the optional embodiment of the present invention consumes less storage and communication than the storage and communication consumption in the related art. Moreover, the scheme only requires one round of communication, which saves resource consumption compared to the related art that requires multiple rounds of communication. The optional embodiment of the present invention is described in detail below.
[0068] An optional embodiment of the present invention utilizes the algebraic structure of polynomials to compare the size of bit integer ciphertexts. For encrypted long-bit integers a and b, the comparison can be performed by determining whether a is greater than b. However, due to the length of long-bit integers, this results in excessive computational complexity. This optional embodiment first compares the size of encrypted long-bit integers by splitting the long-bit integers into multiple pairs of "shorter bit" integers. For example, 20-bit integers a and b are each split into two 10-bit integers, each with a high-order portion a_H and b_H, and a low-order portion a_L and b_L. Where a = a_H*2^10+a_L and b = a_H*2^10+a_L. This means that the long-bit integers a and b are split into their high-order portions a_H and b_H, and their low-order portions a_L and b_L, to determine whether a is greater than b. The conditions for this determination are equivalent to: 1) the high-order portion a_H is greater than b_H; 2) if the high-order portions are the same, the low-order portion a_L is greater than b_L. Written as a>b<=>(a_H>b_H)or(a_H=b_H and a_L>b_L). This allows for simple and efficient determination of the size of a long-bit integer. The specific solution is as follows:
[0069] 1. Display short bit integers in the form of polynomials;
[0070] a_H, a_L are interpreted as polynomials X^{a_H}, X^{a_L}, and then encrypted as Enc(X^{a_H}), Enc(X^{a_L}); b_H, b_L are interpreted as polynomials X^{-b_H}, X^{-b_L}, and then encrypted as Enc(X^{-b_H}), Enc(X^{-b_L}); It should be noted that the coefficient of the above polynomial is 1.
[0071] 2. Compare the high-order and low-order parts of two groups of short bit integers;
[0072] The ciphertext corresponding to the high-order portion of the integer, Enc(X^{a_H}) and Enc(X^{-b_H}), can be calculated using two homomorphic multiplications and one homomorphic addition to compare the magnitude. This can be expressed as Enc(X^{a_H))*Enc(X^{-b_H})*(1 / 2+1 / 2X+1 / 2X^2+....1 / 2X^{N-1})+(1 / 2)->Enc(GreaterThan(a_H, b_H)). Similarly, the magnitude of the low-order portion can be expressed as Enc(GreaterThan(a_L, b_L)). It should be noted that N is a public parameter of the fully homomorphic encryption algorithm, which specifies the maximum degree of the polynomial.
[0073] 3. Calculate the cases where the high-order parts of two sets of short bit integers are equal;
[0074] Enc(X^{a_H))*Enc(X^{-b_H})->Enc(Equal(a_H,b_H)).
[0075] 4. Using the ciphertext corresponding to the three relationships between the obtained short bit integers, calculate the size relationship between the two groups of long bit integers a and b.
[0076] The ciphertexts corresponding to these three relationships are: Enc(GreaterThan(a_H, b_H)), Enc(Equal(a_H, b_H)), and Enc(GreaterThan(a_L, b_L)). Using one homomorphic multiplication and one homomorphic addition, we can obtain the size relationship between the two long-bit integers a and b: Enc(GreaterThan(a_H, b_H))+Enc(Equal(a_H, b_H))*Enc(GreaterThan(a_L, b_L))->Enc(GreaterThan(a, b)). This means that the high-order part of a is greater than the high-order part of b, or, if the high-order part of a is equal to the high-order part of b, the low-order part of a is greater than the low-order part of b.
[0077] Through the above optional implementation, the following beneficial effects can be achieved:
[0078] (1) The algebraic structure of the current fully homomorphic encryption algorithm is used to directly calculate the size relationship between encrypted integers without using a table lookup method, that is, there is no need to generate a large amount of ciphertext, which reduces the transmission and storage overhead;
[0079] (2) It supports a wider range of bit integers. By utilizing the homomorphic multiplication property of the fully homomorphic encryption scheme, it can be naturally extended to the encryption comparison of long-bit integers.
[0080] (3) It has a wider range of applications and supports comparisons between ciphertexts and between ciphertexts and plaintexts;
[0081] (4) Fewer usage restrictions: the client only needs to upload the ciphertext to the server, and the server can directly calculate the size comparison between the encrypted ciphertexts without the need for additional communication interaction or the assistance of an additional third party;
[0082] (5) The result of the calculation is a homomorphic ciphertext of 0 or 1, which allows the server to process further calculations based on the size comparison results. For example, in the decision tree reasoning scenario, the size comparison results are aggregated, that is, further calculations are performed to obtain the final reasoning result.
[0083] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0084] Through the description of the above embodiments, those skilled in the art can clearly understand that the data processing method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform, or of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the relevant technology, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of various embodiments of the present invention.
[0085] Example 2
[0086] According to an embodiment of the present invention, there is also provided a device 1 for implementing the above data processing method. Figure 5 : is a structural block diagram of a data processing device 1 provided according to embodiment 2 of the present invention, as shown in FIG. Figure 5 As shown, the device includes: a first receiving module 502, a first comparing module 504 and a first sending module 506. The device is described below.
[0087] The first receiving module 502 is used to receive encrypted data sent by the client device, wherein the encrypted data is obtained by encrypting a predetermined integer of data that meets a predetermined bit length condition; the first comparing module 504 is connected to the above-mentioned first receiving module 502, and is used to compare the encrypted data with the reference data to obtain result encrypted data; the first sending module 506 is connected to the above-mentioned first comparing module 504, and is used to send the result encrypted data to the client device, so that the client device uses a predetermined decryption key to decrypt the result encrypted data to obtain a comparison result between the encrypted data and the reference data.
[0088] It should be noted that the first receiving module 502, the first comparing module 504, and the first sending module 506 correspond to steps S202 to S206 in Example 1. The examples and application scenarios implemented by the two modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.
[0089] Example 3
[0090] According to an embodiment of the present invention, a second apparatus for implementing the above data processing method is also provided. Figure 6 : is a structural block diagram of a data processing device 2 provided according to embodiment 3 of the present invention, as shown in FIG. Figure 6 As shown, the device includes: a first encryption module 602, a second sending module 604 and a second receiving module 606. The device is described below.
[0091] The first encryption module 602 is used to encrypt data that meets the predetermined bit length condition to obtain encrypted data; the second sending module 604 is connected to the above-mentioned first encryption module 602, and is used to send the encrypted data to the server, so that the server compares the encrypted data with the reference data to obtain the result encrypted data; the second receiving module 606 is connected to the above-mentioned second sending module 604, and is used to receive the result encrypted data returned by the server, and decrypt the result encrypted data using a predetermined decryption key to obtain the comparison result between the encrypted data and the reference data.
[0092] It should be noted that the first encryption module 602, the second sending module 604, and the second receiving module 606 correspond to steps S302 to S306 in Example 1. The examples and application scenarios implemented by the multiple modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.
[0093] Example 4
[0094] Embodiments of the present disclosure may provide a computer device, which may be a terminal or a server. In this embodiment, the computer device, as a terminal, may be any computer terminal device in a computer terminal group. Alternatively, in this embodiment, the terminal may also be a terminal device such as a mobile terminal.
[0095] Optionally, in this embodiment, the terminal may be located in at least one network device among a plurality of network devices of a computer network.
[0096] Optionally, Figure 7 FIG. 1 is a block diagram of a terminal according to an exemplary embodiment. Figure 7 As shown, the terminal may include: one or more (only one is shown in the figure) processors 71, and a memory 72 for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement any of the above-mentioned data processing methods.
[0097] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the data processing method and device in the embodiments of the present disclosure. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned data processing method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely located relative to the processor, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0098] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: receiving integer encrypted data sent by the client device, wherein the integer encrypted data is obtained by encrypting a predetermined integer of data that meets a predetermined bit length condition, and the bit length of the predetermined integer is greater than a predetermined number of bits; comparing the integer encrypted data with reference data to obtain result encrypted data; and sending the result encrypted data to the client device, so that the client device uses a predetermined decryption key to decrypt the result encrypted data to obtain a comparison result between the integer encrypted data and the reference data.
[0099] Optionally, the processor may also execute the program code of the following steps: comparing the encrypted data of the integer encrypted data with the reference data to obtain result encrypted data, including: splitting the encrypted data of the integer encrypted data to obtain a plurality of partial encrypted data arranged according to position, and splitting the reference data into a plurality of partial data arranged according to position; comparing the partial encrypted data obtained by splitting the encrypted data of the integer encrypted data with the corresponding partial data obtained by splitting the reference data according to the position correspondence to obtain partial result encrypted data of the corresponding position; combining a plurality of partial result encrypted data corresponding to the plurality of partial encrypted data to obtain result encrypted data.
[0100] Optionally, the above-mentioned processor can also execute the program code of the following steps: integer encrypted data: the encrypted data is obtained by performing fully homomorphic encryption on a predetermined integer of data that meets a predetermined bit length condition; when the reference data is encrypted data, the reference data is data obtained using fully homomorphic encryption.
[0101] Optionally, the processor may also execute the program code of the following steps: combining multiple partial result encrypted data corresponding to multiple partial encrypted data to obtain result encrypted data, including: for each partial encrypted data in the multiple partial encrypted data, performing homomorphic multiplication on the partial result encrypted data corresponding to the partial encrypted data and the partial result encrypted data corresponding to the previous partial encrypted data of the partial encrypted data to obtain the component items corresponding to the partial encrypted data; performing homomorphic addition on the component items corresponding to the multiple partial encrypted data to obtain the result encrypted data.
[0102] Optionally, the processor may further execute program code of the following steps: the reference data includes: encrypted data, or plaintext data.
[0103] Optionally, the processor may further execute a program code of the following steps: the data satisfying the predetermined bit length condition is predetermined to be data having a bit length greater than or equal to 20 bits.
[0104] In the embodiment of the present disclosure, the computer device acts as a server. Figure 8 FIG. 1 is a structural block diagram of a server according to an exemplary embodiment. Figure 8 As shown, the server 80 may include: one or more (only one is shown in the figure) processing components 81, a memory 82 for storing executable instructions of the processing component 81, a power supply component 83 for providing power, a network interface 84 for communicating with an external network, and an I / O input and output interface 85 for data transmission with the outside; wherein, the processing component 81 is configured to execute instructions to implement any of the above-mentioned data processing methods.
[0105] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the image processing method and device in the embodiment of the present disclosure. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned image processing method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely located relative to the processor, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0106] The processing component can call the information and application stored in the memory through the transmission device to perform the following steps: encrypt a predetermined integer of data that meets the predetermined bit length condition to obtain integer encrypted data, wherein the bit length of the predetermined integer is greater than a predetermined number of bits; send the integer encrypted data to the server, so that the server compares the integer encrypted data with reference data to obtain result encrypted data; receive the result encrypted data returned by the server, and decrypt the result encrypted data using a predetermined decryption key to obtain a comparison result between the integer encrypted data and the reference data.
[0107] Optionally, the above-mentioned processing component can also execute the program code of the following steps: integer encrypted data: the encrypted data is obtained by performing fully homomorphic encryption on a predetermined integer of data that meets a predetermined bit length condition; when the reference data is encrypted data, the reference data is data obtained using fully homomorphic encryption.
[0108] Optionally, the above-mentioned processing component can also execute the program code of the following steps: the result encrypted data is obtained by homomorphic addition of components corresponding to multiple partial encrypted data, the multiple partial encrypted data are obtained by splitting the encrypted data of the integer encrypted data, the reference data is split to obtain multiple partial data, and according to the position correspondence, the partial encrypted data obtained by splitting the encrypted data of the integer encrypted data are compared with the corresponding partial data obtained by splitting the reference data to obtain partial result encrypted data at the corresponding position, and for each partial encrypted data in the multiple partial encrypted data, the component corresponding to the partial encrypted data is obtained by homomorphic multiplication of the partial result encrypted data corresponding to the partial encrypted data and the partial result encrypted data corresponding to the previous partial encrypted data of the partial encrypted data.
[0109] Optionally, the processing component may further execute program code of the following steps: data satisfying the predetermined bit length condition is data with a bit length greater than or equal to 20 bits, and the predetermined number of bits is greater than or equal to 20 bits.
[0110] It can be understood by those skilled in the art that Figure 7 , Figure 8 The structure shown is for illustration only. For example, the terminal may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 7 , Figure 8 It does not limit the structure of the above electronic device. Figure 7 , Figure 8 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 7 , Figure 8 Different configurations shown.
[0111] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0112] Example 4
[0113] The embodiment of the present invention further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the data processing method provided in the first embodiment.
[0114] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0115] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: receiving integer encrypted data sent by a client device, wherein the integer encrypted data is obtained by encrypting a predetermined integer of data that meets a predetermined bit length condition, and the bit length of the predetermined integer is greater than a predetermined number of bits; comparing the integer encrypted data with reference data to obtain result encrypted data; and sending the result encrypted data to the client device, so that the client device decrypts the result encrypted data using a predetermined decryption key to obtain a comparison result between the integer encrypted data and the reference data.
[0116] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: comparing the integer encrypted data with reference data to obtain result encrypted data, including: splitting the integer encrypted data to obtain multiple partial encrypted data arranged according to position, and splitting the reference data into multiple partial data arranged according to position; comparing the partial encrypted data obtained by splitting the integer encrypted data with the corresponding partial data obtained by splitting the reference data according to the position correspondence to obtain partial result encrypted data at the corresponding position; combining multiple partial result encrypted data corresponding to the multiple partial encrypted data to obtain result encrypted data.
[0117] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: integer encrypted data: the encrypted data is obtained by performing fully homomorphic encryption on a predetermined integer of data that meets a predetermined bit length condition; and when the reference data is encrypted data, the reference data is data obtained using fully homomorphic encryption.
[0118] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: combining multiple partial result encrypted data corresponding to multiple partial encrypted data to obtain result encrypted data, including: for each partial encrypted data in the multiple partial encrypted data, performing homomorphic multiplication on the partial result encrypted data corresponding to the partial encrypted data with the partial result encrypted data corresponding to the previous partial encrypted data of the partial encrypted data to obtain a component item corresponding to the partial encrypted data; performing homomorphic addition on the component items corresponding to the multiple partial encrypted data to obtain result encrypted data.
[0119] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps: the reference data includes: encrypted data, or plaintext data.
[0120] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: the data satisfying the predetermined bit length condition is predetermined to be data having a bit length greater than or equal to 20 bits.
[0121] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: encrypting a predetermined integer of data that meets a predetermined bit length condition to obtain integer encrypted data, wherein the bit length of the predetermined integer is greater than a predetermined number of bits; sending the integer encrypted data to a server, so that the server compares the integer encrypted data with reference data to obtain result encrypted data; receiving the result encrypted data returned by the server, and decrypting the result encrypted data using a predetermined decryption key to obtain a comparison result between the integer encrypted data and the reference data.
[0122] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: integer encrypted data: the encrypted data is obtained by performing fully homomorphic encryption on a predetermined integer of data that meets a predetermined bit length condition; and when the reference data is encrypted data, the reference data is data obtained using fully homomorphic encryption.
[0123] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: the result encrypted data is obtained by homomorphically adding components corresponding to the multiple partial encrypted data, the multiple partial encrypted data are obtained by splitting the integer encrypted data, the reference data is split to obtain multiple partial data, and according to the position correspondence, the partial encrypted data obtained by splitting the integer encrypted data are compared with the corresponding partial data obtained by splitting the reference data to obtain partial result encrypted data at the corresponding position, and for each partial encrypted data in the multiple partial encrypted data, the component corresponding to the partial encrypted data is obtained by homomorphically multiplying the partial result encrypted data corresponding to the partial encrypted data and the partial result encrypted data corresponding to the previous partial encrypted data of the partial encrypted data.
[0124] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: the data meeting the predetermined bit length condition is data with a bit length greater than or equal to 20 bits, and the predetermined number of bits is greater than or equal to 20 bits.
[0125] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0126] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0127] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0128] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0129] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0130] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the relevant technology, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.
[0131] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A data processing method, characterized in that: include: Receiving encrypted data sent by a client device, wherein the encrypted data is obtained by encrypting data that meets a predetermined bit length condition; Comparing the encrypted data with reference data to obtain result encrypted data, wherein the result encrypted data is obtained by homomorphic addition of component items corresponding to a plurality of partial encrypted data, the plurality of partial encrypted data are obtained by splitting the encrypted data, the component items are obtained by homomorphic multiplication of partial result encrypted data corresponding to each partial encrypted data with partial result encrypted data corresponding to a previous partial encrypted data of each partial encrypted data, and the partial result encrypted data are obtained by processing the encrypted data and the reference data based on a position correspondence; The result encrypted data is sent to the client device, so that the client device decrypts the result encrypted data using a predetermined decryption key to obtain a comparison result between the encrypted data and the reference data.
2. The method according to claim 1, characterized in that The method further comprises: Splitting the encrypted data to obtain the plurality of partial encrypted data arranged according to positions, and splitting the reference data into the plurality of partial data arranged according to positions; According to the position correspondence, the partial encrypted data obtained by splitting the encrypted data is compared with the corresponding partial data obtained by splitting the reference data to obtain the partial result encrypted data of the corresponding position.
3. The method according to claim 2, characterized in that The encrypted data is obtained by performing fully homomorphic encryption on data that meets a predetermined bit length condition. When the reference data is encrypted data, the reference data is data obtained by using fully homomorphic encryption.
4. The method according to claim 1, wherein The reference data includes: encrypted data or plaintext data.
5. The method according to any one of claims 1 to 4, characterized in that The data meeting the predetermined bit length condition is data having a bit length greater than or equal to 20 bits.
6. A data processing method, characterized in that: include: Encrypting data that meets a predetermined bit length condition to obtain encrypted data; Sending the encrypted data to a server, so that the server compares the encrypted data with reference data to obtain result encrypted data, wherein the result encrypted data is obtained by homomorphic addition of component items corresponding to a plurality of partial encrypted data, the plurality of partial encrypted data are obtained by splitting the encrypted data, the component items are obtained by homomorphic multiplication of partial result encrypted data corresponding to each partial encrypted data with partial result encrypted data corresponding to a previous partial encrypted data of each partial encrypted data, and the partial result encrypted data are obtained by processing the encrypted data and the reference data based on a position correspondence relationship; The result encrypted data returned by the server is received, and the result encrypted data is decrypted using a predetermined decryption key to obtain a comparison result between the encrypted data and the reference data.
7. The method according to claim 6, characterized in that The encrypted data is obtained by performing fully homomorphic encryption on data that meets a predetermined bit length condition. When the reference data is encrypted data, the reference data is data obtained by using fully homomorphic encryption.
8. The method according to claim 7, characterized in that The result encrypted data is obtained by performing homomorphic addition on the component items corresponding to the multiple partial encrypted data, and the reference data is split to obtain multiple partial data. According to the position correspondence, the partial encrypted data obtained by splitting the encrypted data are compared with the corresponding partial data obtained by splitting the reference data to obtain partial result encrypted data at the corresponding position.
9. The method according to any one of claims 6 to 8, characterized in that The data meeting the predetermined bit length condition is data having a bit length greater than or equal to 20 bits.
10. A data processing device, characterized in that: include: A first receiving module is configured to receive encrypted data sent by a client device, wherein the encrypted data is obtained by encrypting data that meets a predetermined bit length condition; a first comparison module, configured to compare the encrypted data with reference data to obtain result encrypted data, wherein the result encrypted data is obtained by homomorphic addition of component items corresponding to a plurality of partial encrypted data, the plurality of partial encrypted data are obtained by splitting the encrypted data, the component items are obtained by homomorphic multiplication of partial result encrypted data corresponding to each partial encrypted data with partial result encrypted data corresponding to a previous partial encrypted data of each partial encrypted data, and the partial result encrypted data are obtained by processing the encrypted data and the reference data based on a position correspondence; The first sending module is configured to send the result encrypted data to the client device, so that the client device decrypts the result encrypted data using a predetermined decryption key to obtain a comparison result between the encrypted data and the reference data.
11. A data processing device, characterized in that: include: A first encryption module is used to encrypt data that meets a predetermined bit length condition to obtain encrypted data; a second sending module, configured to send the encrypted data to a server, for the server to compare the encrypted data with reference data to obtain result encrypted data, wherein the result encrypted data is obtained by homomorphic addition of component items corresponding to a plurality of partially encrypted data, the plurality of partially encrypted data are obtained by splitting the encrypted data, the component items are obtained by homomorphic multiplication of partial result encrypted data corresponding to each partially encrypted data with partial result encrypted data corresponding to a previous partial encrypted data of each partially encrypted data, and the partial result encrypted data are obtained by processing the encrypted data and the reference data based on a position correspondence; The second receiving module is configured to receive the encrypted result data returned by the server, and decrypt the encrypted result data using a predetermined decryption key to obtain a comparison result between the encrypted data and the reference data.
12. A computer device, characterized in that: include: memory and processor, The memory stores a computer program; The processor is configured to execute a computer program stored in the memory, and when the computer program is run, the processor is enabled to execute the data processing method according to any one of claims 1 to 9.
13. A computer-readable storage medium, characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data processing method according to any one of claims 1 to 9.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the data processing method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Data security comparison protocol implementation method and system, electronic device and storage medium
CN112231737A
Data homomorphic encryption and decryption method and apparatus for implementing privacy protection
WO2020253234A1