Data query method, device, system and data set processing method
By using ordered interval point sets and encryption protocols during the data query process, encryption algebraic expressions are generated to determine the query results, which solves the privacy and security issues in data query and achieves effective privacy protection of data.
Patent Information
- Application Number
- CN202011247552.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-10
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2040-11-10
AI Technical Summary
Privacy-preserving set intersection calculation technology can easily lead to data leakage during the data query process, and cannot guarantee the privacy and security of the query data.
By sending a data query request, receiving ordered interval point sets, and determining the data group serial number based on these point sets, executing the preset encryption protocol to generate an encrypted data set, constructing an encryption algebraic formula, and passing coefficients to determine the query results, ensuring the encryption and processing of the data. Privacy protection.
It effectively avoids the leakage of the candidate data set, improves the privacy and security of the query data, and ensures the confidentiality of the data.
Smart Images

Figure CN112328639B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data query method, apparatus, system, computer equipment and storage medium, and a data set processing method, apparatus, computer equipment and storage medium. Background Art
[0002] Protecting the privacy of data sets is a natural and even necessary requirement in many scenarios. For example, when the set is a user's address book or the genome of a user of a genetic diagnosis service, such input must be protected by cryptographic means. The privacy-preserving set intersection (PSI) calculation technology allows two parties holding their own sets to jointly calculate the intersection of two sets. At the end of the protocol interaction, one or both parties should obtain the correct intersection and will not obtain any information from the other party's set other than the intersection.
[0003] However, the privacy-preserving set intersection calculation technology requires allowing two parties holding their respective sets to jointly calculate the intersection operation of the two sets. This approach is prone to data leakage during the data query process, and the privacy of the query data cannot be guaranteed, making the query data unsafe. Summary of the invention
[0004] Based on this, it is necessary to provide a data query method, device, system, computer equipment and storage medium, as well as a data set processing method, device, computer equipment and storage medium that can ensure the privacy of query data and thus improve the security of query data in response to the above technical problems.
[0005] In a first aspect, an embodiment of the present application provides a method for data query, comprising the following steps:
[0006] Send a data query request to the device to be queried;
[0007] Receiving an ordered interval point set, the ordered interval point set including ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request;
[0008] Obtain the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set;
[0009] Execute a preset encryption protocol on the data to be queried, and obtain the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed;
[0010] Send the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, obtains a current encryption function corresponding to a preset random number, performs encryption calculation on at least one current data according to the current encryption function to obtain a current encrypted data set, constructs a current encryption algebraic expression according to the current encrypted data set, and generates a current coordinate data set according to the current encryption algebraic expression;
[0011] Receive a current coordinate data set, and generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set, wherein the target encrypted algebraic expression includes a plurality of target calculation unit items, and each target calculation unit item includes a corresponding target algebraic expression coefficient;
[0012] Sending the target algebraic expression coefficients to the device to be queried, so that the device to be queried determines the query result corresponding to the data to be queried according to the target algebraic expression coefficients and the current encrypted algebraic expression;
[0013] Receive query results.
[0014] In a second aspect, an embodiment of the present application further provides a data query device, the device comprising:
[0015] A query request sending module, used for sending a data query request to a device to be queried;
[0016] An ordered interval point set receiving module is used to receive an ordered interval point set, wherein the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request;
[0017] The module for acquiring data to be queried is used to acquire the data to be queried and determine the sequence number of the current data group corresponding to the data to be queried according to the data to be queried and the ordered interval point set;
[0018] A module for generating encrypted data to be queried, used for executing a preset encryption protocol on the data to be queried, and obtaining the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed;
[0019] The current data group sequence number sending module is used to send the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, obtains the current encryption function corresponding to the preset random number, performs encryption calculation on the at least one current data according to the current encryption function to obtain the current encrypted data set, constructs the current encryption algebraic expression according to the current encrypted data set, and generates the current coordinate data set according to the current encryption algebraic expression;
[0020] A coordinate data set receiving module is used to receive a current coordinate data set, and generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set, wherein the target encrypted algebraic expression includes a plurality of target calculation unit items, and each target calculation unit item includes a corresponding target algebraic expression coefficient;
[0021] An algebraic expression coefficient sending module, used to send the target algebraic expression coefficient to the device to be queried, so that the device to be queried determines the query result corresponding to the data to be queried according to the target algebraic expression coefficient and the current encrypted algebraic expression;
[0022] The query result receiving module is used to receive the query result.
[0023] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0024] Send a data query request to the device to be queried;
[0025] Receiving an ordered interval point set, the ordered interval point set including ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request;
[0026] Obtain the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set;
[0027] Execute a preset encryption protocol on the data to be queried, and obtain the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed;
[0028] Send the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, obtains a current encryption function corresponding to a preset random number, performs encryption calculation on at least one current data according to the current encryption function to obtain a current encrypted data set, constructs a current encryption algebraic expression according to the current encrypted data set, and generates a current coordinate data set according to the current encryption algebraic expression;
[0029] Receive a current coordinate data set, and generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set, wherein the target encrypted algebraic expression includes a plurality of target calculation unit items, and each target calculation unit item includes a corresponding target algebraic expression coefficient;
[0030] Sending the target algebraic expression coefficients to the device to be queried, so that the device to be queried determines the query result corresponding to the data to be queried according to the target algebraic expression coefficients and the current encrypted algebraic expression;
[0031] Receive query results.
[0032] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0033] Send a data query request to the device to be queried;
[0034] Receiving an ordered interval point set, the ordered interval point set including ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request;
[0035] Obtain the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set;
[0036] Execute a preset encryption protocol on the data to be queried, and obtain the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed;
[0037] Send the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, obtains a current encryption function corresponding to a preset random number, performs encryption calculation on at least one current data according to the current encryption function to obtain a current encrypted data set, constructs a current encryption algebraic expression according to the current encrypted data set, and generates a current coordinate data set according to the current encryption algebraic expression;
[0038] Receive a current coordinate data set, and generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set, wherein the target encrypted algebraic expression includes a plurality of target calculation unit items, and each target calculation unit item includes a corresponding target algebraic expression coefficient;
[0039] Sending the target algebraic expression coefficients to the device to be queried, so that the device to be queried determines the query result corresponding to the data to be queried according to the target algebraic expression coefficients and the current encrypted algebraic expression;
[0040] Receive query results.
[0041] In a fifth aspect, an embodiment of the present application further provides a data query system, the system comprising:
[0042] A query device is used to obtain a data query request and send the data query request to the device to be queried;
[0043] The device to be queried is used to obtain an ordered interval point set corresponding to the candidate data set according to the data query request, and return the ordered interval point set to the query device, wherein the ordered interval point set includes the ordered data group interval points corresponding to the candidate data set;
[0044] The query device is further used to receive the ordered interval point set, obtain the data to be queried, determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set, execute the preset encryption protocol on the data to be queried, obtain the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed, and send the current data group sequence number to the device to be queried;
[0045] The device to be queried is further used to obtain at least one current data corresponding to the current data group sequence number, obtain a current encryption function corresponding to a preset random number, perform encryption calculation on at least one current data according to the current encryption function to obtain a current encrypted data set, construct a current encryption algebraic expression according to the current encrypted data set, generate a current coordinate data set according to the current encryption algebraic expression, and return the current coordinate data set to the querying device;
[0046] The query device is further used to receive the current coordinate data set, generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set, the target encrypted algebraic expression includes a plurality of target calculation unit items, each target calculation unit item includes a corresponding target algebraic expression coefficient, and send the target algebraic expression coefficient to the device to be queried;
[0047] The device to be queried is further used to determine the query result corresponding to the data to be queried according to the coefficients of the target algebraic expression and the current encrypted algebraic expression, and return the query result to the query device;
[0048] The query device is also used to receive query results.
[0049] In a sixth aspect, an embodiment of the present application further provides a data set processing method, comprising the following steps:
[0050] Acquire a candidate data set, where the candidate data set includes at least one candidate data;
[0051] Processing at least one candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data;
[0052] The target candidate data set is grouped according to a preset rule to obtain multiple candidate data groups;
[0053] The corresponding data group interval points are determined according to the candidate hash data in each candidate data group, and an ordered data group interval point set is generated according to each data group interval point.
[0054] In a seventh aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0055] Acquire a candidate data set, where the candidate data set includes at least one candidate data;
[0056] Processing at least one candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data;
[0057] The target candidate data set is grouped according to a preset rule to obtain multiple candidate data groups;
[0058] The corresponding data group interval points are determined according to the candidate hash data in each candidate data group, and an ordered data group interval point set is generated according to each data group interval point.
[0059] In an eighth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0060] Acquire a candidate data set, where the candidate data set includes at least one candidate data;
[0061] Processing at least one candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data;
[0062] The target candidate data set is grouped according to a preset rule to obtain multiple candidate data groups;
[0063] The corresponding data group interval points are determined according to the candidate hash data in each candidate data group, and an ordered data group interval point set is generated according to each data group interval point.
[0064] The above-mentioned data query method, device, system, computer equipment and storage medium, as well as the data set processing method, device, computer equipment and storage medium, send a data query request to the device to be queried; receive an ordered interval point set, the ordered interval point set includes the ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request; obtain the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set; execute a preset encryption protocol on the data to be queried, and obtain the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed; send the current data group sequence number to the device to be queried, so that the device to be queried obtains the corresponding at least one current data, obtain a current encryption function corresponding to a preset random number, perform encryption calculation on at least one current data according to the current encryption function to obtain a current encrypted data set, construct a current encryption algebraic expression according to the current encrypted data set, and generate a current coordinate data set according to the current encryption algebraic expression; receive the current coordinate data set, generate a target encryption algebraic expression according to the encrypted data to be queried and the current coordinate data set, the target encryption algebraic expression includes a plurality of target calculation unit items, each target calculation unit item includes a corresponding target algebraic expression coefficient; send the target algebraic expression coefficient to the device to be queried, so that the device to be queried determines the query result corresponding to the data to be queried according to the target algebraic expression coefficient and the current encryption algebraic expression; receive the query result.
[0065] Therefore, since the ordered interval point set sent by the device to be queried to the query device is not the candidate data set in the device to be queried, the ordered data group interval points in these ordered interval point sets are meaningless, and the candidate data set in the device to be queried is not sent to the query device, which avoids the leakage of the candidate data set in the device to be queried, and ensures the privacy of the query data. Moreover, the data sent by the device to be queried and the query device to each other are encrypted and calculated by a confidential large prime number. Since their own data and exponents are confidential, they cannot infer the real data of each other, thereby improving the security and privacy of the query data. Moreover, the current coordinate data set sent by the device to be queried to the query device is also randomly generated by the target encrypted algebraic expression generated by the data processed by the current encryption function. If the data to be queried of the query device is in the candidate data set, the correct target encrypted algebraic expression can be restored. However, since the data to be queried in the query device is hidden in the coefficients through the target encrypted algebraic expression, the query device cannot determine the candidate data in the device to be queried, but can only determine whether the data to be queried is in the candidate data set. Neither the query device nor the device to be queried can infer the privacy data of the other party, thereby ensuring the confidentiality of the privacy data.
[0066] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0068] Figure 1 is an application scenario diagram of a data query method according to an embodiment of the present invention;
[0069] Figure 2 is a flow chart of a data query method according to one embodiment of the present invention;
[0070] Figure 3 is a flow chart of steps for determining the sequence number of the current data group according to one embodiment of the present invention;
[0071] Figure 4 is a flow chart of a data query method according to one embodiment of the present invention;
[0072] Figure 5 is a flow chart of steps for generating encrypted data to be queried according to one embodiment of the present invention;
[0073] Figure 6 is a flowchart of steps for generating a target encrypted algebraic expression according to one embodiment of the present invention;
[0074] Figure 7 is a flow chart of query result determination steps according to one embodiment of the present invention;
[0075] Figure 8 is a flow chart of steps for generating an ordered interval point set according to one embodiment of the present invention;
[0076] Fig. 9 is a flow chart of a method for processing a data set according to an embodiment of the present invention;
[0077] Fig.10 is a structural block diagram of a data query system according to an embodiment of the present invention;
[0078] Fig.11 is a structural block diagram of a data query device according to an embodiment of the present invention;
[0079] Fig.12 is a structural block diagram of a data set processing device according to an embodiment of the present invention;
[0080] Fig.13 is a schematic diagram of the structure of a computer device according to an embodiment of the present invention;
[0081] Fig.14It is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0082] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0083] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0084] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0085] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0086] Figure 1 FIG. 1 is an application environment diagram of a data query method in an embodiment. Figure 1 , the data query method is applied to a data query system. The data query system includes a query device 102 and a device to be queried 104. The query device 102 and the device to be queried 104 are connected via a network. The query device 102 can be a desktop terminal or a mobile terminal or a query device to be queried, and the mobile terminal can be at least one of a mobile phone, a tablet computer, a laptop computer, etc. The device to be queried 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0087] Specifically, the query device 102 obtains a data query request to the device to be queried 104. After receiving the data query request, the device to be queried 104 obtains an ordered interval point set corresponding to the candidate data set according to the data query request, and returns the ordered interval point set to the query device 102. The ordered interval point set includes the ordered data group interval points corresponding to the candidate data set. The query device 102 receives the ordered interval point set, obtains the data to be queried, determines the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set, executes a preset encryption protocol on the data to be queried, obtains the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed, and sends the current data group sequence number to the device to be queried 104. The device to be queried 104 obtains at least one current data corresponding to the current data group sequence number, obtains the current encryption function corresponding to the preset random number, performs encryption calculation on at least one current data according to the current encryption function to obtain the current encrypted data set, constructs the current encryption algebraic expression according to the current encrypted data set, generates the current coordinate data set according to the current encryption algebraic expression, and returns the current coordinate data set to the query device 102.
[0088] Further, the query device 102 receives the current coordinate data set, generates a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set, the target encrypted algebraic expression includes a plurality of target calculation unit items, each target calculation unit item includes a corresponding target algebraic expression coefficient, sends the target algebraic expression coefficient to the query device 104, and the query device 104 determines the query result corresponding to the query data according to the target algebraic expression coefficient and the current encrypted algebraic expression, and returns the query result to the query device 102. Finally, the query device 102 receives the query result.
[0089] In one embodiment, Figure 2 As shown, a data query method is provided, which is applied to Figure 1 The query device in is taken as an example to illustrate, including the following steps:
[0090] Step 202: Send a data query request to the device to be queried.
[0091] Among them, the query device can be a device where the data query party is located, which can be but not limited to a query terminal or a query device to be queried, and the device to be queried here can be a device to be queried where the data user party is located, and a candidate data set is stored. The candidate data set includes at least one candidate data, and the candidate data set is processed to obtain a target candidate data set. The target candidate data set is grouped to obtain multiple candidate data groups, and the corresponding data group interval points are determined according to the data in each candidate data group. These data group interval points are sorted to obtain an ordered data group interval point set.
[0092] Among them, the data query request here is used to request the device to be queried to perform data query. The data query request can be generated by triggering an operation on the query device. Specifically, a relevant query application is provided on the query device, and a query button is provided on the relevant interface of the query application. The query button is operated to trigger the generation of the data query request. The operation includes but is not limited to a click operation, a voice operation or a timed event trigger operation.
[0093] Step 204 , receiving an ordered interval point set, where the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request.
[0094] Among them, the ordered interval point set here refers to a set composed of data group interval points in a certain order, and the data group interval point refers to the interval value between candidate data groups corresponding to the candidate data set, and the candidate data set is pre-stored on the device to be queried, the candidate data set includes at least one candidate data, the candidate data set is processed to obtain the target candidate data set, the target candidate data set is grouped to obtain multiple candidate data groups, the corresponding data group interval point is determined according to the data in each candidate data group, these data group interval points are sorted, and an ordered data group interval point set is obtained.
[0095] Among them, the method for determining the corresponding data group interval point based on the data in each candidate data group can be customized. The customization can be to obtain the current candidate data group, obtain the current candidate data corresponding to the current candidate data group, obtain the target candidate data corresponding to the previous candidate data group, calculate the current data group interval point based on the current candidate data and the target candidate data, obtain the next candidate data group, use the next candidate data group as the current candidate data group, return to the step to obtain the current candidate data corresponding to the current candidate data group, until each data group interval point is obtained.
[0096] Among them, the current candidate data can be the first candidate data in the current candidate data group, and the target candidate data can be the last candidate data in the previous candidate data group. Specifically, the device to be queried obtains the current candidate data group, obtains the first candidate data in the current candidate data group, obtains the last candidate data in the previous candidate data group, calculates the current data group interval point according to the first candidate data and the last candidate data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step to obtain the first candidate data in the current candidate data group, until the data group interval point is obtained.
[0097] For example, the current candidate data group is: [317, 553], the previous candidate data group is: [55, 270], the current candidate data is the first candidate data in the current candidate data group: 317, and the target candidate data is the last candidate data in the previous candidate data group: 270. Then the current candidate data group interval point can be calculated based on the first candidate data and the last candidate data: (270+317) / 2=293.5.
[0098] In another embodiment, the method for determining the data group interval point can also be customized by obtaining the current candidate data group, obtaining the current candidate data corresponding to the current candidate data group, obtaining the target candidate data corresponding to the previous candidate data group, and randomly selecting a number between the current candidate data and the target candidate data to determine as the current data group interval point, obtaining the next candidate data group, taking the next candidate data group as the current candidate data group, and returning to the step of obtaining the current candidate data corresponding to the current candidate data group, until each data group interval point is obtained.
[0099] Among them, the current candidate data can be the first candidate data in the current candidate data group, and the target candidate data can be the last candidate data in the previous candidate data group. Specifically, the queried device obtains the current candidate data group, obtains the first candidate data in the current candidate data group, obtains the last candidate data in the previous candidate data group, randomly selects a number between the first candidate data and the last candidate data as the current data group interval point, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step to obtain the current candidate data corresponding to the current candidate data group, until each data group interval point is obtained.
[0100] For example, the current candidate data group is: [317, 553], the previous candidate data group is: [55, 270], the current candidate data is the first candidate data in the current candidate data group: 317, and the target candidate data is the last candidate data in the previous candidate data group: 270. Then the interval point of the current candidate data group can be a number randomly selected between the first candidate data and the last candidate data. For example, 300 can be selected as the interval point of the current candidate data group.
[0101] For example, all candidate data in the candidate data set are processed by the same hash function through the following formula to obtain target candidate data, and the target candidate data constitute the target candidate data set:
[0102]
[0103] Then, the target candidate data are sorted in a certain order, wherein the certain order can be ascending or descending, and grouped in a manner of a fixed size per group to obtain multiple candidate data groups, wherein the fixed size can be predetermined according to business needs, product needs or actual application scenarios. In another embodiment, after the target candidate data are sorted in a certain order, they can also be grouped in a manner of different sizes per group, that is, they can be grouped in a manner of non-fixed sizes per group, and the group size corresponding to each candidate data group can be specifically determined according to business needs, product needs and actual application scenarios. In yet another embodiment, the group sizes corresponding to the candidate data groups may be the same or different, and can be specifically determined according to actual conditions.
[0104] Furthermore, the data group interval points are calculated based on the target candidate data in each candidate data group, and these data group interval points are sorted to obtain the ordered data group interval points. Specifically, when the query device sends a data query request to the device to be queried, the device to be queried obtains the ordered interval point set according to the data query request, and returns the obtained ordered interval point set to the query device.
[0105] Step 206, obtaining the data to be queried, and determining the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set.
[0106] The data to be queried is data waiting to be queried. The data to be queried can be data processed by a hash function. The data to be queried can be obtained by calling from a local database or by obtaining from other devices. The data to be queried can be determined based on business needs, actual application scenarios, and product needs. The current data group sequence number here is the sequence number corresponding to the data group where the data to be queried is located. Specifically, after receiving the ordered interval point set, the current data group sequence number corresponding to the data to be queried can be determined based on the data to be queried and the ordered interval point set. Specifically, the corresponding two adjacent target interval points are obtained from the ordered interval point set according to the data to be queried, and then the current data group sequence number corresponding to the data to be queried is determined based on the two target interval points. If the data to be queried is equal to one of the two adjacent target interval points, or the data to be queried has only one adjacent interval point, it means that the data to be queried is not in the candidate data set, and the data query is terminated.
[0107] For example, the target candidate data set obtained by hash function processing of the candidate data set is: 55, 270, 317, 553, 682, 847. The target candidate data set is grouped to obtain: [55, 270], [317, 553], [682, 847]. The ordered interval point set is: the data group interval point between the first group and the second group is 293.5, and the data group interval point between the second group and the third group is 617.5. If the data to be queried is 583 after hash function processing, since the data to be queried is between 293.5 and 617.5, it can be determined that the current data group sequence number corresponding to the data to be queried is 2, that is, if the data to be queried is to be inserted into the candidate data set, it needs to be inserted into the second group. Among them, the data group interval point between the first group and the second group can be calculated based on the last target candidate data of the first group and the first target candidate data of the second group. For example, the last target candidate data of the first group is 270, and the first target candidate data of the second group is 317. The data group interval point between the first group and the second group can be: (270+317) / 2=293.5. Similarly, the data group interval point between the second group and the third group can be calculated based on the last target candidate data of the second group and the first target candidate data of the third group. For example, the last target candidate data of the second group is 553, and the first target candidate data of the third group is 682. The data group interval point between the second group and the third group can be: (553+682) / 2=617.5.
[0108] Step 208, executing a preset encryption protocol on the data to be queried, and obtaining the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed.
[0109] The preset encryption protocol here is an encryption protocol that is pre-agreed between the querying device and the device to be queried. The preset encryption protocol can be an oblivious pseudorandom function protocol (Oblivious Pseudorandom Function-OPRF): the device to be queried provides a pseudorandom function and a corresponding random number, and the querying device provides the data to be calculated. After the protocol is executed, only the querying device obtains the result of the oblivious pseudorandom function calculation. During the whole process, the device to be queried cannot obtain the calculation data and calculation results of the querying device, and the querying device cannot learn the pseudorandom function and the corresponding random number of the device to be queried.
[0110] Specifically, after obtaining the data to be queried, the preset encryption protocol pre-agreed between the query device and the device to be queried is obtained, which can be specifically, obtaining the oblivious pseudo-random function protocol pre-agreed between the query device and the device to be queried. After the oblivious pseudo-random function protocol is executed, the query device can obtain the calculation result of the oblivious pseudo-random function, and this calculation result is the encrypted data to be queried corresponding to the data to be queried. Among them, the encrypted data to be queried is encrypted data, and other devices cannot obtain the data to be queried by cracking or decrypting it in other ways.
[0111] In one embodiment, the execution process of the inadvertent pseudo-random function protocol for the data to be queried may be to obtain a preset encryption key pair, the preset encryption key pair includes a first encryption key and a second encryption key, receive first encrypted data and second encrypted data sent by the device to be queried, randomly generate a first random number, calculate third encrypted data based on the first random number and the first encryption key, and calculate fourth encrypted data based on the first encrypted data, the data to be queried, and the second encrypted data.
[0112] Further, the third encrypted data, the fourth encrypted data and the first encryption key are sent to the device to be queried, so that the device to be queried randomly generates a second random number, calculates the fifth encrypted data according to the fourth encrypted data, calculates the sixth encrypted data according to the fifth encrypted data and the preset encryption modulus length, calculates the seventh encrypted data according to the sixth encrypted data and the third encrypted data, calculates the eighth encrypted data according to the preset public parameters and the second random number, and calculates the ninth encrypted data according to the seventh encrypted data, the first encryption key and the eighth encrypted data. Among them, the preset public parameters and the preset encryption modulus length can be predetermined according to business requirements, product requirements or actual application scenarios.
[0113] Finally, the querying device receives the seventh encrypted data and the ninth encrypted data returned by the device to be queried, and calculates the encrypted data to be queried corresponding to the data to be queried according to the seventh encrypted data and the ninth encrypted data.
[0114] For example, the encryption key pair in the query device can be (pk c ,sk c ), the first encryption key is pk c , the second secret key is sk c , the first encrypted data is The second encrypted data is pk s , the first random number is a, and the third encrypted data is The fourth encrypted data is The second random number is d s , the fifth encrypted data is b, the sixth encrypted data is r, and the seventh encrypted data is The eighth encrypted data is The ninth encrypted data is v s , the encrypted data to be queried is f k (x), x is the data to be queried, g is the preset public parameter, and n is the preset encryption module length. The specific process can be:
[0115] 1. The device to be queried randomly generates a random number k of an inadvertent pseudo-random function, and obtains the pseudo-random function as The current preset encryption key pair (pk s ,sk s ), the device to be queried calculates and will pk s Sent to the querying device.
[0116] 2. Query the device received pk s After that, a random number a is randomly generated and the calculation is
[0117]
[0118]
[0119] and will pk c Sent to the device to be queried.
[0120] 3. The device to be queried receives pk c After that, a random number d is randomly generated s , calculated
[0121]
[0122] r = b -1 mod n=(ax+ak) -1 mod n
[0123]
[0124] and will v s Sent to the query device.
[0125] 4. Query the device received v s After that, we calculate:
[0126]
[0127]
[0128] Output
[0129] Step 210, sends the current data group serial number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group serial number, obtains the current encryption function corresponding to the preset random number, performs encryption calculation on at least one current data according to the current encryption function to obtain the current encrypted data set, constructs the current encryption algebraic expression according to the current encrypted data set, and generates the current coordinate data set according to the current encryption algebraic expression.
[0130] Wherein, while the preset encryption protocol is executed, the current data group sequence number is sent to the device to be queried. After receiving the current data group sequence number, the device to be queried obtains at least one current data corresponding to the current data group sequence number. The current data here may refer to the data element within the current data group sequence number. The current data may be all the data within the current data group sequence number, or it may be the target data within the current data group sequence number. The number of target data may be determined based on business requirements and actual application conditions. The candidate data set is processed to obtain a target candidate data set, and the target candidate data set is grouped to obtain multiple candidate data groups. Each candidate data group includes corresponding target candidate data and corresponding group sequence number. In one embodiment, all target candidate data within the current data group sequence number may be used as current data.
[0131] Wherein, while obtaining at least one current data corresponding to the current data group sequence number, a preset random number is randomly generated, and the corresponding current encryption function is obtained according to the preset random number. The current encryption function here is used for encryption calculation. The current encryption function can be an inadvertent pseudo-random function. The current encryption function is used to encrypt the current data in the current data group sequence number. Specifically, the current data in the current data group sequence number is encrypted using an inadvertent pseudo-random function to obtain the current encrypted data set. Furthermore, the current encrypted algebraic expression can be constructed according to the data elements in the current confidential data set. The current encrypted algebraic expression can be but not limited to a polynomial. The current encrypted algebraic expression includes multiple current calculation unit items, and each current calculation unit item includes the corresponding current algebraic expression coefficient. For example, the current encrypted algebraic expression is: a0+a1x+a2x 2 , the current encrypted algebraic expression includes multiple current calculation units, a0, a1x, a2x 2 , each current calculation unit item includes the corresponding current algebraic expression coefficients: a0, a1, a2.
[0132] Furthermore, after the current encrypted algebraic expression is constructed, the current coordinate data set can be generated according to the current encrypted algebraic expression. Specifically, a non-zero current coordinate data set can be randomly generated according to the current encrypted algebraic expression. Specifically, the current encrypted algebraic expression can be randomly assigned a corresponding value of the unknown quantity in the current encrypted algebraic expression, thereby obtaining a non-zero current coordinate data set. For example, the current encrypted algebraic expression is: i (x) = a0 + a1x + a2x 2 , the unknown quantity in the current encrypted algebraic expression is x, then the corresponding value of x is randomly assigned, and the corresponding value of x can be assigned to 1, 2, and 3, respectively, to obtain the current coordinate data set. The current coordinate data set can be (1, f i (1))、(2,f i (2)), (3, f i (3)).
[0133] Step 212, receiving the current coordinate data set, generating a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set, wherein the target encrypted algebraic expression includes a plurality of target calculation unit items, and each target calculation unit item includes a corresponding target algebraic expression coefficient.
[0134] Among them, after the device to be queried generates the current coordinate data set, it will send the current coordinate data set to the query device. After receiving the current coordinate data set, the query device can generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set. Specifically, the target algebraic expression structure of the target encrypted algebraic expression is first obtained. The target algebraic expression result is determined in advance according to business needs, actual application scenarios or product needs before the target encrypted algebraic expression is generated. After obtaining the target algebraic expression structure, the encrypted data to be queried and the data to be queried can be combined into the coordinate data to be queried. The coordinate data to be queried and each current coordinate data in the current coordinate data set are respectively used as the values of unknown quantities and corresponding results of the target algebraic expression structure, so as to obtain the target algebraic expression coefficients corresponding to each target calculation unit item of the target algebraic expression structure, and finally obtain the target encrypted algebraic expression.
[0135] For example, the target algebraic structure of the target encrypted algebraic expression is f b (x) = b0 + b1x + b2x 2 , the encrypted data to be queried and the data to be queried form the coordinate data to be queried: (3, 5), the current coordinate data in the current coordinate data set is: (2, 8), (5, 9), and the 3 of the coordinate data to be queried is used as the value corresponding to x in the target algebraic structure, and 5 is used as f in the target algebraic structure. b (x), similarly, the current coordinate data 2 is used as the value corresponding to x in the target algebraic structure, and 8 is used as f in the target algebraic structure. b(x), the current coordinate data 5 is used as the value corresponding to x in the target algebraic structure, and 9 is used as f in the target algebraic structure. b (x), and solve the equation to obtain b0, b1, and b2.
[0136] In another embodiment, after the query device receives the current coordinate data set, it can generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set. Specifically, it can first obtain the target algebraic expression structure of the target encrypted algebraic expression. The target algebraic expression result is determined in advance according to business needs, actual application scenarios or product needs before the target encrypted algebraic expression is generated. After obtaining the target algebraic expression structure, the encrypted data to be queried and the data to be queried can be combined into the coordinate data to be queried, and the coordinate data to be queried and each current coordinate data in the current coordinate data set can be interpolated to restore the target encrypted algebraic expression. Among them, the interpolation method restoration method is an existing calculation method, and the specific calculation process is not described in detail here.
[0137] Further, after the target encrypted algebraic expression is obtained, the target encrypted algebraic expression includes a plurality of target calculation unit items, each of which includes a corresponding target algebraic expression coefficient. For example, the target encrypted algebraic expression is: b0+b1x+b2x 2 , the target encryption algebraic formula includes multiple target calculation units: b0, b1x, b2x 2 , each target calculation unit item includes the corresponding target algebraic expression coefficients: b0, b1, b2.
[0138] Step 214: Send the coefficients of the target algebraic expression to the device to be queried, so that the device to be queried determines the query result corresponding to the data to be queried according to the coefficients of the target algebraic expression and the current encrypted algebraic expression.
[0139] Step 216, receiving the query result.
[0140] Specifically, after the query device generates a target encrypted algebraic expression, the target encrypted algebraic expression includes a plurality of target calculation unit items, each of which includes a corresponding target algebraic expression coefficient, and the target encrypted algebraic expression includes a plurality of target calculation unit items, each of which includes a corresponding target algebraic expression coefficient. The target algebraic expression coefficient corresponding to each target calculation unit item is sent to the device to be queried.
[0141] Furthermore, after receiving the target algebraic expression coefficient, the device to be queried obtains each current calculation unit item corresponding to the current encrypted algebraic expression, and obtains the current algebraic expression coefficient corresponding to each current calculation unit item. The query result corresponding to the data to be queried can be determined according to the current algebraic expression coefficient and the target algebraic expression system. Among them, determining the query result corresponding to the data to be queried can be to compare whether the current algebraic expression coefficient and the corresponding target algebraic expression coefficient are the same. If the current algebraic expression coefficient and the corresponding target algebraic expression coefficient are the same, it means that the data to be queried is an element in the candidate data set, so the query result is to determine that the data to be queried is in the candidate data set.
[0142] On the contrary, if any current algebraic expression coefficient is different from the corresponding target algebraic expression coefficient, it means that the to-be-queried data is not an element in the candidate data set. Therefore, it can be determined that the query result is that the to-be-queried data is not in the candidate data set.
[0143] For example, the current encrypted algebraic expression is: a0+a1x+a2x 2 , the current encrypted algebraic expression includes multiple current calculation units, a0, a1x, a2x 2 , each current calculation unit item includes the corresponding current algebraic expression coefficients: a0, a1, a2, and the target encrypted algebraic expression is: b0+b1x+b2x 2 , the target encryption algebraic formula includes multiple target calculation units: b0, b1x, b2x 2 , each target calculation unit item includes the corresponding target algebraic expression coefficient: b0, b1, b2. If a0 is the same as b0, a1 is the same as b1, and a2 is the same as b2, then the query result is determined to be that the data to be queried is in the candidate data set. On the contrary, if any current algebraic expression coefficient is different from the corresponding target algebraic expression coefficient, then the query result can be determined to be that the data to be queried is not in the candidate data set. For example, a0 is different from b0.
[0144] In the above data query method, a data query request is sent to the device to be queried; an ordered interval point set is received, and the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request; the data to be queried is obtained, and the current data group sequence number corresponding to the data to be queried is determined according to the data to be queried and the ordered interval point set; a preset encryption protocol is executed on the data to be queried, and after the preset encryption protocol is executed, the encrypted data to be queried corresponding to the data to be queried is obtained; the current data group sequence number is sent to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, and obtains the current data corresponding to the preset random number. A pre-encryption function is provided, and encryption calculation is performed on at least one current data according to the current encryption function to obtain a current encrypted data set, a current encrypted algebraic expression is constructed according to the current encrypted data set, and a current coordinate data set is generated according to the current encrypted algebraic expression; the current coordinate data set is received, and a target encrypted algebraic expression is generated according to the encrypted data to be queried and the current coordinate data set, wherein the target encrypted algebraic expression includes a plurality of target calculation unit items, and each target calculation unit item includes a corresponding target algebraic expression coefficient; the target algebraic expression coefficient is sent to the device to be queried, so that the device to be queried determines the query result corresponding to the data to be queried according to the target algebraic expression coefficient and the current encrypted algebraic expression; and the query result is received.
[0145] Therefore, since the ordered interval point set sent by the device to be queried to the query device is not the candidate data set in the device to be queried, the ordered data group interval points in these ordered interval point sets are meaningless, and the candidate data set in the device to be queried is not sent to the query device, which avoids the leakage of the candidate data set in the device to be queried, and ensures the privacy of the query data. Moreover, the data sent by the device to be queried and the query device to each other are encrypted and calculated by a confidential large prime number. Since their own data and exponents are confidential, they cannot infer the real data of each other, thereby improving the security and privacy of the query data. Moreover, the current coordinate data set sent by the device to be queried to the query device is also randomly generated by the target encrypted algebraic expression generated by the data processed by the current encryption function. If the data to be queried of the query device is in the candidate data set, the correct target encrypted algebraic expression can be restored. However, since the data to be queried in the query device is hidden in the coefficients through the target encrypted algebraic expression, the query device cannot determine the candidate data in the device to be queried, but can only determine whether the data to be queried is in the candidate data set. Neither the query device nor the device to be queried can infer the privacy data of the other party, thereby ensuring the confidentiality of the privacy data.
[0146] In one embodiment, Figure 3 As shown, determining the current data group sequence number corresponding to the to-be-queried data and the ordered interval point set according to the to-be-queried data includes:
[0147] Step 302: Acquire two adjacent target interval points corresponding to the data to be queried from the ordered interval point set.
[0148] Step 304: determine the current data group sequence number corresponding to the data to be queried according to the two target interval points.
[0149] Among them, the ordered interval point set here refers to a set composed of data group interval points in a certain order, and the data group interval point refers to the interval value between candidate data groups corresponding to the candidate data set, and the candidate data set is pre-stored on the device to be queried, the candidate data set includes at least one candidate data, the candidate data set is processed to obtain the target candidate data set, the target candidate data set is grouped to obtain multiple candidate data groups, the corresponding data group interval point is determined according to the data in each candidate data group, these data group interval points are sorted, and an ordered data group interval point set is obtained.
[0150] Among them, the corresponding data group interval points are determined according to the data in each candidate data group. Specifically, it can be, obtain the current candidate data group, obtain the current candidate hash data corresponding to the current candidate data group, obtain the target candidate hash data corresponding to the previous candidate data group, calculate the current data group interval point according to the current candidate hash data and the target candidate hash data, obtain the next candidate data group, take the next candidate data group as the current candidate data group, return to the step to obtain the current candidate hash data corresponding to the current candidate data group, until each data group interval point is obtained, and sort the data group interval points to obtain an ordered data group interval point set. Among them, the current candidate hash data can be the first candidate hash data of the current candidate data group, and the target candidate hash data can be the last candidate hash data of the previous candidate data group.
[0151] The current data group sequence number here is the sequence number corresponding to the data group where the data to be queried is located. Specifically, after receiving the ordered interval point set, the current data group sequence number corresponding to the data to be queried can be determined according to the data to be queried and the ordered interval point set. Specifically, it can be that the corresponding two adjacent target interval points are obtained from the ordered interval point set according to the data to be queried, and then the current data group sequence number corresponding to the data to be queried is determined according to the two target interval points. If the data to be queried is equal to one of the two adjacent target interval points, or the data to be queried has only one adjacent interval point, it means that the data to be queried is not in the candidate data set, and the data query ends.
[0152] For example, the target candidate data set obtained by hash function processing of the candidate data set is: 55, 270, 317, 553, 682, 847, 987, 1203. The target candidate data set is grouped to obtain: [55, 270], [317, 553], [682, 847], [987, 1203]. The ordered interval point set is: the data group interval point between the first group and the second group is 293.5, the data group interval point between the second group and the third group is 617.5, and the data group interval point between the third group and the fourth group is 917. If the data to be queried is 583 after hash function processing, since the data to be queried is between 293.5 and 617.5, it can be determined that the current data group sequence number corresponding to the data to be queried is 2.
[0153] Among them, the data group interval point between the first group and the second group can be calculated based on the last candidate hash data of the first group and the first candidate hash data of the second group. For example, the last candidate hash data of the first group is 270, and the first candidate hash data of the second group is 317. The data group interval point between the first group and the second group can be: (270+317) / 2=293.5. Similarly, the data group interval point between the second group and the third group can be calculated based on the last candidate hash data of the second group and the first candidate hash data of the third group. For example, the last candidate hash data of the second group is 553, and the first candidate hash data of the third group is 682. The data group interval point between the second group and the third group can be: (553+682) / 2=617.5. By analogy, the data group interval point between the third group and the fourth group can be calculated based on the last candidate hash data of the third group and the first candidate hash data of the fourth group. For example, the last candidate hash data of the third group is 847, and the first candidate hash data of the fourth group is 987. The data group interval point between the third group and the fourth group can be: (847+987) / 2=917.
[0154] In one embodiment, Figure 4 As shown, the data query method also includes:
[0155] Step 402, send a current ordered interval point set version number query request to the device to be queried, the current ordered interval point set version number query request includes the current ordered interval point set version number, so that the device to be queried obtains the candidate ordered interval point set version number, compares whether the current ordered interval point set version number and the candidate ordered interval point set version number are consistent, if they are consistent, determine them as the first version number information, if they are inconsistent, determine them as the second version number information, and return, wherein the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried.
[0156] Step 404, receiving the first version number information returned by the device to be queried, obtaining a historical ordered interval point set, and then using the historical ordered interval point set as the ordered interval point set, and entering the step of obtaining the data to be queried, or.
[0157] Step 406, receiving the second version number information returned by the device to be queried, and then proceeding to the step of sending a data query request to the device to be queried.
[0158] Among them, the current ordered interval point set version number query request here is used to request the query of the current ordered interval point set version number. The current ordered interval point set version number is the version identification number corresponding to the current ordered interval point set. Each time the current ordered interval point set sent by the device to be queried includes the corresponding current ordered interval point set version number, when the query device sends the ordered interval point set version number query request to the device to be queried for the first time, it will save the ordered interval point set version number returned by the device to be queried. In subsequent queries, when the query device carries the current ordered interval point set version number query request to query the device to be queried, the device to be queried compares the current ordered interval point set version number with the locally stored candidate interval point set version number to see if they are consistent. If they are consistent, it is determined as the first version number information. If they are inconsistent, it is determined as the second version number information and returned, where the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried, and the first version number information or the second version number information is returned to the query device.
[0159] Furthermore, the query device receives the first version number information, indicating that the current ordered interval point set version number is consistent with the candidate interval point set version number stored locally in the device to be queried. Then, the ordered interval points cached by the query device itself can be determined as the ordered interval point set. Specifically, the historical ordered interval point set can be obtained. The so-called historical ordered interval point set is the ordered interval point set cached locally in the query device. The historical ordered interval point set is used as the ordered interval point set, and the step of obtaining the data to be queried is entered.
[0160] Among them, if the query device receives the second version number information, it means that the current ordered interval point set version number is inconsistent with the candidate interval point set version number stored locally in the device to be queried, then enter the step of sending a data query request to the device to be queried, and replace the historical ordered interval point set stored locally in the query device with the subsequently received ordered interval point set, that is, update the locally stored historical ordered interval point set according to the subsequently received ordered interval point set.
[0161] In one embodiment, the preset encryption protocol is an oblivious pseudo-random function protocol, and the preset encryption protocol is executed on the data to be queried. After the preset encryption protocol is executed, the encrypted data to be queried corresponding to the data to be queried is obtained, including: executing the oblivious pseudo-random function protocol on the data to be queried, and after the oblivious pseudo-random function protocol is executed, the encrypted data to be queried corresponding to the data to be queried is obtained, wherein the oblivious pseudo-random function protocol enables the querying device and the device to be queried to exchange information in an oblivious manner.
[0162] Among them, the preset encryption protocol here is an encryption protocol set by consensus in advance between the query device and the device to be queried. The preset encryption protocol can be an oblivious pseudorandom function protocol (Oblivious Pseudorandom Function-OPRF): the device to be queried provides a pseudorandom function and a corresponding random number, and the query device provides the data to be calculated. After the protocol is executed, only the query device obtains the result of the oblivious pseudorandom function calculation. During the whole process, the device to be queried cannot obtain the calculation data and calculation results of the query device, and the query device cannot learn the pseudorandom function and the corresponding random number of the device to be queried. That is, the oblivious pseudorandom function protocol allows the query device and the device to be queried to exchange information in an inadvertent manner.
[0163] Specifically, after obtaining the data to be queried, the preset encryption protocol pre-agreed between the query device and the device to be queried is obtained, which can be specifically, obtaining the oblivious pseudo-random function protocol pre-agreed between the query device and the device to be queried. After the oblivious pseudo-random function protocol is executed, the query device can obtain the calculation result of the oblivious pseudo-random function, and this calculation result is the encrypted data to be queried corresponding to the data to be queried. Among them, the encrypted data to be queried is encrypted data, and other devices cannot obtain the data to be queried by cracking or decrypting it in other ways.
[0164] In one embodiment, Figure 5 As shown, after the pseudo-random function protocol is executed, the encrypted data to be queried corresponding to the data to be queried is obtained, including:
[0165] Step 502: Obtain a preset encryption key pair, where the preset encryption key pair includes a first encryption key and a second encryption key.
[0166] Step 504: Receive first encrypted data and second encrypted data sent by the device to be queried.
[0167] Step 506: randomly generate a first random number, calculate the third encrypted data according to the first random number and the first encryption key, and calculate the fourth encrypted data according to the first encrypted data, the data to be queried, and the second encrypted data.
[0168] The preset encryption key pair here refers to a key pair in the query device, and the preset encryption key pair includes a first encryption key and a second encryption key, wherein the first encryption key may be a public key and the second encryption key may be a private key. The preset encryption key pair in the query device may be pre-set and may be determined according to business requirements, actual application scenarios or product requirements.
[0169] Specifically, a preset encryption key pair is obtained, and the first encrypted data and the second encrypted data sent by the device to be queried are received at the same time. The first encrypted data and the second encrypted data of the device to be queried are obtained confidentially through a preset encryption algorithm and cannot be cracked. Further, after receiving the first encrypted data and the second encrypted data sent by the device to be queried, a first random number is randomly generated, and the third encrypted data can be calculated based on the first random number and the first encryption key, and the fourth encrypted data can be calculated based on the first encrypted data, the data to be queried, and the second encrypted data. Among them, the third encrypted data and the fourth encrypted data can be calculated according to the corresponding encryption algorithm.
[0170] For example, the encryption key pair can be (pk c ,sk c ), the first encryption key is pk c , the second secret key is sk c , the first encrypted data is The second encrypted data is pk s , the first random number is a, and the third encrypted data is The fourth encrypted data is Specifically, the device to be queried randomly generates a random number k of an inadvertent pseudo-random function, and obtains the pseudo-random function as follows: The current preset encryption key pair (pk s ,sk s ), the device to be queried calculates and will pk s Then, the query device receives pk s After that, a random number a is randomly generated and the calculation is: and will pk c Sent to the device to be queried.
[0171] Step 508, the third encrypted data, the fourth encrypted data and the first encryption key are sent to the device to be queried, so that the device to be queried randomly generates a second random number, calculates the fifth encrypted data according to the fourth encrypted data, calculates the sixth encrypted data according to the fifth encrypted data and the preset encryption modulus length, calculates the seventh encrypted data according to the sixth encrypted data and the third encrypted data, calculates the eighth encrypted data according to the preset public parameters and the second random number, and calculates the ninth encrypted data according to the seventh encrypted data, the first encryption key and the eighth encrypted data.
[0172] Step 510: Receive the seventh encrypted data and the ninth encrypted data returned by the device to be queried, and calculate the encrypted data to be queried corresponding to the data to be queried according to the seventh encrypted data and the ninth encrypted data.
[0173] Among them, after the query device calculates and obtains the third encrypted data and the fourth encrypted data, the third encrypted data, the fourth encrypted data and the first encryption key are sent to the device to be queried. After receiving the third encrypted data, the fourth encrypted data and the first encryption key, the device to be queried randomly generates a second random number, and the fifth encrypted data can be calculated according to the fourth encrypted data. The specific calculation method can be calculated according to the corresponding encryption algorithm, and the fourth encrypted data is encrypted to obtain the second encrypted data. Further, after obtaining the fifth encrypted data, the seventh encrypted data can be calculated according to the fifth encrypted data and the preset encryption modulus length, the eighth encrypted data can be calculated according to the preset public parameters and the second random number, and the ninth encrypted data can be calculated according to the seventh encrypted data, the first encryption key and the eighth encrypted data. Among them, the encryption method corresponding to each encrypted data can be calculated according to the corresponding encryption algorithm, and the encryption algorithm is determined in advance according to business needs, actual application scenarios, and product needs. The encryption algorithms of each encrypted data can be different.
[0174] For example, the encryption key pair can be (pk c ,sk c ), the first encryption key is pk c , the second secret key is sk c , the first encrypted data is The second encrypted data is pk s , the first random number is a, and the third encrypted data is The fourth encrypted data is The second random number is d s , the fifth encrypted data is b, the sixth encrypted data is r, and the seventh encrypted data is The eighth encrypted data is The ninth encrypted data is v s , the encrypted data to be queried is f k(x), x is the data to be queried, g is the preset public parameter, and n is the preset encryption module length. The specific process can be:
[0175] 1. The device to be queried randomly generates a random number k of an inadvertent pseudo-random function, and obtains the pseudo-random function as The current preset encryption key pair (pk s ,sk s ), the device to be queried calculates and will pk s Sent to the querying device.
[0176] 2. Query the device received pk s After that, a random number a is randomly generated and the calculation is
[0177]
[0178]
[0179] and will pk c Sent to the device to be queried.
[0180] 3. The device to be queried receives pk c After that, randomly generate a random number d s , calculated
[0181]
[0182] r = b -1 mod n=(ax+ak) -1 mod n
[0183]
[0184] and will v s Sent to the query device.
[0185] In one embodiment, the current encryption function is a current random pseudo-random function, the current data group sequence number is sent to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, obtains the current encryption function corresponding to the preset random number, performs encryption calculation on the at least one current data according to the current encryption function to obtain the current encrypted data set, constructs the current encryption algebraic expression according to the current encrypted data set, and generates the current coordinate data set according to the current encryption algebraic expression, including:
[0186] The current data group serial number is sent to the device to be queried, so that the device to be queried randomly generates a preset random number, obtains a current inadvertent pseudo-random function corresponding to the preset random number, obtains at least one current data corresponding to the current data group serial number, processes at least one current data according to the current inadvertent pseudo-random function, obtains a current encrypted data set corresponding to the at least one current data, takes the current encrypted data in the current encrypted data set as a root, constructs a current encrypted algebraic expression, and randomly generates a non-zero current coordinate data set according to the current encrypted algebraic expression, wherein the current encrypted algebraic expression includes multiple current calculation unit items.
[0187] Wherein, while the preset encryption protocol is executed, the current data group sequence number is sent to the device to be queried. After receiving the current data group sequence number, the device to be queried obtains at least one current data corresponding to the current data group sequence number. The current data here may refer to the data element within the current data group sequence number. The current data may be all the data within the current data group sequence number, or it may be the target data within the current data group sequence number. The number of target data may be determined based on business requirements and actual application conditions. The candidate data set is processed to obtain a target candidate data set, and the target candidate data set is grouped to obtain multiple candidate data groups. Each candidate data group includes corresponding target candidate data and corresponding group sequence number. In one embodiment, all target candidate data within the current data group sequence number may be determined as current data.
[0188] Wherein, while obtaining at least one current data corresponding to the current data group sequence number, a preset random number is randomly generated, and the corresponding current encryption function is obtained according to the preset random number. The current encryption function here is used for encryption calculation. The current encryption function can be an inadvertent pseudo-random function. The current encryption function is used to encrypt the current data in the current data group sequence number. Specifically, the current data in the current data group sequence number is encrypted using an inadvertent pseudo-random function to obtain the current encrypted data set. Furthermore, the current encrypted algebraic expression can be constructed according to the data elements in the current confidential data set. The current encrypted algebraic expression can be but not limited to a polynomial. The current encrypted algebraic expression includes multiple current calculation unit items, and each current calculation unit item includes the corresponding current algebraic expression coefficient. For example, the current encrypted algebraic expression is: a0+a1x+a2x 2 , the current encrypted algebraic expression includes multiple current calculation units, a0, a1x, a2x 2 , each current calculation unit item includes the corresponding current algebraic expression coefficients: a0, a1, a2.
[0189] Furthermore, after the current encrypted algebraic expression is constructed, the current coordinate data set can be generated according to the current encrypted algebraic expression. Specifically, a non-zero current coordinate data set can be randomly generated according to the current encrypted algebraic expression. Specifically, the current encrypted algebraic expression can be randomly assigned a corresponding value of the unknown quantity in the current encrypted algebraic expression, thereby obtaining a non-zero current coordinate data set. For example, the current encrypted algebraic expression is: i (x) = a0 + a1x + a2x 2 , the unknown quantity in the current encrypted algebraic expression is x, then the corresponding value of x is randomly assigned, and the corresponding value of x can be assigned to 1, 2, and 3, respectively, to obtain the current coordinate data set. The current coordinate data set can be (1, f i (1))、(2,f i (2)), (3, f i (3)).
[0190] In one embodiment, Figure 6 As shown, the target encryption algebraic expression is generated according to the encrypted data to be queried and the current coordinate data set, including:
[0191] Step 602: Obtain the encrypted coordinate data corresponding to the encrypted data to be queried.
[0192] Step 604, calculating the target encrypted algebraic expression according to the encrypted coordinate data and the current coordinate data set.
[0193] Among them, the encrypted coordinate data can be a coordinate pair consisting of the data to be queried and the encrypted data to be queried. For example, if the data to be queried is x and the encrypted data to be queried is y, then the encrypted coordinate data is: (x, y). Further, after the encrypted coordinate data is obtained, the target encrypted algebraic expression can be calculated based on the encrypted coordinate data and the current coordinate data in the current coordinate data set. Specifically, the target algebraic expression structure of the target encrypted algebraic expression is first obtained. The target algebraic expression result is determined in advance according to business needs, actual application scenarios or product needs before the target encrypted algebraic expression is generated. After the target algebraic expression structure is obtained, the encrypted data to be queried and the data to be queried can be combined into the coordinate data to be queried. The coordinate data to be queried and each current coordinate data in the current coordinate data set are respectively used as the values and corresponding results of the unknown quantities of the target algebraic expression structure, so as to obtain the target algebraic expression coefficients corresponding to each target calculation unit item of the target algebraic expression structure, and finally obtain the target encrypted algebraic expression.
[0194] For example, the target algebraic structure of the target encrypted algebraic expression is f b (x) = b0 + b1x + b2x 2, the encrypted data to be queried and the data to be queried form the coordinate data to be queried: (3, 5), the current coordinate data in the current coordinate data set is: (2, 8), (5, 9), and the 3 of the coordinate data to be queried is used as the value corresponding to x in the target algebraic structure, and 5 is used as f in the target algebraic structure. b (x), similarly, the current coordinate data 2 is used as the value corresponding to x in the target algebraic structure, and 8 is used as f in the target algebraic structure. b (x), the current coordinate data 5 is used as the value corresponding to x in the target algebraic structure, and 9 is used as f in the target algebraic structure. b (x), and solve the equation to obtain b0, b1, and b2.
[0195] In one embodiment, Figure 7 As shown, the current encrypted algebraic expression includes multiple current calculation unit items, each current calculation unit item includes a corresponding current algebraic expression coefficient, and the target algebraic expression coefficient is sent to the device to be queried, so that the device to be queried determines the query result corresponding to the data to be queried according to the target algebraic expression coefficient and the current encrypted algebraic expression, including:
[0196] Step 702, the target algebraic expression coefficients corresponding to each target calculation unit item are sent to the device to be queried, so that the device to be queried obtains the current algebraic expression coefficients corresponding to each current calculation unit item in the current encrypted algebraic expression, and compares whether the current algebraic expression coefficients and the corresponding target algebraic expression coefficients are the same. When the current algebraic expression coefficients and the corresponding target algebraic expression coefficients are the same, it is determined that the data to be queried is in the candidate data set.
[0197] Step 704: On the contrary, when any current algebraic expression coefficient is different from the corresponding target algebraic expression coefficient, it is determined that the data to be queried is not in the candidate data set.
[0198] Specifically, after the query device generates a target encrypted algebraic expression, the target encrypted algebraic expression includes a plurality of target calculation unit items, each of which includes a corresponding target algebraic expression coefficient, and the target encrypted algebraic expression includes a plurality of target calculation unit items, each of which includes a corresponding target algebraic expression coefficient. The target algebraic expression coefficient corresponding to each target calculation unit item is sent to the device to be queried.
[0199] Furthermore, after receiving the target algebraic expression coefficient, the device to be queried obtains each current calculation unit item corresponding to the current encrypted algebraic expression, and obtains the current algebraic expression coefficient corresponding to each current calculation unit item. The query result corresponding to the data to be queried can be determined according to the current algebraic expression coefficient and the target algebraic expression system. Among them, determining the query result corresponding to the data to be queried can be to compare whether the current algebraic expression coefficient and the corresponding target algebraic expression coefficient are the same. If the current algebraic expression coefficient and the corresponding target algebraic expression coefficient are the same, it means that the data to be queried is an element in the candidate data set, so the query result is to determine that the data to be queried is in the candidate data set.
[0200] On the contrary, if any current algebraic expression coefficient is different from the corresponding target algebraic expression coefficient, it means that the to-be-queried data is not an element in the candidate data set. Therefore, it can be determined that the query result is that the to-be-queried data is not in the candidate data set.
[0201] For example, the current encrypted algebraic expression is: a0+a1x+a2x 2 , the current encrypted algebraic expression includes multiple current calculation units, a0, a1x, a2x 2 , each current calculation unit item includes the corresponding current algebraic expression coefficients: a0, a1, a2, and the target encrypted algebraic expression is: b0+b1x+b2x 2 , the target encryption algebraic formula includes multiple target calculation units: b0, b1x, b2x 2 , each target calculation unit item includes the corresponding target algebraic expression coefficient: b0, b1, b2. If a0 is the same as b0, a1 is the same as b1, and a2 is the same as b2, then the query result is determined to be that the data to be queried is in the candidate data set. On the contrary, if any current algebraic expression coefficient is different from the corresponding target algebraic expression coefficient, then the query result can be determined to be that the data to be queried is not in the candidate data set. For example, if a0 is different from b0, then the query result is determined to be that the data to be queried is not in the candidate data set.
[0202] In one embodiment, Figure 8 As shown, the steps for generating an ordered interval point set include:
[0203] Step 802: The device to be queried obtains a candidate data set, where the candidate data set includes at least one candidate data.
[0204] Step 804: the device to be queried processes the candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data.
[0205] Among them, the device to be queried here can be the device to be queried where the data user is located, storing a candidate data set, the candidate data set includes at least one candidate data, processing the candidate data set to obtain a target candidate data set, grouping the target candidate data set to obtain multiple candidate data groups, determining the corresponding data group interval points based on the data in each candidate data group, sorting these data group interval points to obtain an ordered data group interval point set.
[0206] Among them, the ordered interval point set here refers to a set of data group interval points in a certain order, and the data group interval point refers to the interval value between the candidate data groups corresponding to the candidate data set, and the candidate data set is pre-stored on the device to be queried, and the candidate data set includes at least one candidate data. The candidate data set is processed to obtain the target candidate data set.
[0207] Among them, the candidate data set is processed to obtain the target candidate data set, which can be specifically, obtaining a preset hash function, hashing each candidate data in the candidate data set through the preset hash function to obtain corresponding candidate hash data, and the target candidate data set is composed of each candidate hash data.
[0208] For example, all candidate data in the candidate data set are processed by the same hash function through the following formula to obtain candidate hash data, and the candidate hash data constitute the target candidate data set:
[0209]
[0210] Step 806: The device to be queried groups the target candidate data set according to a preset rule to obtain multiple candidate data groups.
[0211] Step 808: The device to be queried determines the corresponding data group interval points according to the candidate hash data in each candidate data group, and generates an ordered data group interval point set according to each data group interval point.
[0212] Specifically, after obtaining the target candidate data set, which includes at least one candidate hash data, the device to be queried groups the target candidate data set to obtain multiple candidate data groups, determines the corresponding data group interval points according to the data in each candidate data group, and sorts these data group interval points to obtain an ordered data group interval point set. Specifically, the device to be queried groups the target candidate data set according to a preset rule to obtain multiple candidate data groups, wherein the preset rule can be sorting the candidate hash data in the target candidate data set, and the sorting can be in ascending or descending order to obtain a sorted target candidate data set, and then groups the sorted target candidate data set according to a preset grouping size to obtain multiple candidate data groups.
[0213] Specifically, the candidate hash data in the target candidate data set can be sorted according to an ascending rule, or the candidate hash data in the target candidate data set can be descended according to a descending rule to obtain a sorted target candidate data set, and then a preset group size is obtained. The so-called group size refers to the maximum bearing capacity corresponding to the corresponding group. The preset group size can be determined according to business needs, application scenarios or product needs. The sorted target candidate data set is grouped according to the preset group size to obtain each grouped candidate data group.
[0214] Furthermore, the corresponding data group interval points are determined according to the data in each candidate data group. Specifically, the current candidate data group is obtained, the current candidate hash data corresponding to the current candidate data group is obtained, the target candidate hash data corresponding to the previous candidate data group is obtained, the current data group interval points are calculated according to the current candidate hash data and the target candidate hash data, the next candidate data group is obtained, the next candidate data group is used as the current candidate data group, and the step of obtaining the current candidate hash data corresponding to the current candidate data group is returned until each data group interval point is obtained, and each data group interval point is sorted to obtain an ordered data group interval point set. Among them, the current candidate hash data can be the first candidate hash data of the current candidate data group, and the target candidate hash data can be the last candidate hash data of the previous candidate data group.
[0215] For example, the target candidate data set obtained by hash function processing the candidate data set is: 55, 270, 317, 553, 682, 847, 987, 1203. The target candidate data set is grouped to obtain: [55, 270], [317, 553], [682, 847], [987, 1203]. The ordered interval point set is: the data group interval point between the first group and the second group is 293.5, the data group interval point between the second group and the third group is 617.5, and the data group interval point between the third group and the fourth group is 917. The ordered data group interval point set is: {293.5, 617.5, 917}. Among them, the data group interval point between the first group and the second group can be calculated based on the last candidate hash data of the first group and the first candidate hash data of the second group. For example, the last candidate hash data of the first group is 270, and the first candidate hash data of the second group is 317. The data group interval point between the first group and the second group can be: (270+317) / 2=293.5. Similarly, the data group interval point between the second group and the third group can be calculated based on the last candidate hash data of the second group and the first candidate hash data of the third group. For example, the last candidate hash data of the second group is 553, and the first candidate hash data of the third group is 682. The data group interval point between the second group and the third group can be: (553+682) / 2=617.5. By analogy, the data group interval point between the third group and the fourth group can be calculated based on the last candidate hash data of the third group and the first candidate hash data of the fourth group. For example, the last candidate hash data of the third group is 847, and the first candidate hash data of the fourth group is 987. The data group interval point between the third group and the fourth group can be: (847+987) / 2=917.
[0216] Among them, the method for determining the corresponding data group interval point based on the data in each candidate data group can be customized. The customization can be to obtain the current candidate data group, obtain the current candidate hash data corresponding to the current candidate data group, obtain the target candidate hash data corresponding to the previous candidate data group, calculate the current data group interval point based on the current candidate hash data and the target candidate hash data, obtain the next candidate data group, use the next candidate data group as the current candidate data group, return to the step to obtain the current candidate hash data corresponding to the current candidate data group, until each data group interval point is obtained.
[0217] Among them, the current candidate hash data can be the first candidate hash data in the current candidate data group, and the target candidate hash data can be the last candidate hash data in the previous candidate data group. Specifically, the queried device obtains the current candidate data group, obtains the first candidate hash data in the current candidate data group, obtains the last candidate hash data in the previous candidate data group, calculates the current data group interval point according to the first candidate hash data and the last candidate hash data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step to obtain the first candidate hash data in the current candidate data group, until the data group interval point is obtained.
[0218] For example, the current candidate data group is: [317, 553], the previous candidate data group is: [55, 270], the current candidate hash data is the first candidate hash data in the current candidate data group: 317, and the target candidate hash data is the last candidate hash data in the previous candidate data group: 270. Then the current candidate data group interval point can be calculated based on the first candidate hash data and the last candidate hash data: (270+317) / 2=293.5.
[0219] In another embodiment, the method for determining the data group interval point can also be customized by obtaining the current candidate data group, obtaining the current candidate hash data corresponding to the current candidate data group, obtaining the target candidate hash data corresponding to the previous candidate data group, and randomly selecting a number between the current candidate hash data and the target candidate hash data as the current data group interval point, obtaining the next candidate data group, taking the next candidate data group as the current candidate data group, and returning to the step of obtaining the current candidate hash data corresponding to the current candidate data group, until each data group interval point is obtained.
[0220] Among them, the current candidate hash data can be the first candidate hash data in the current candidate data group, and the target candidate hash data can be the last candidate hash data in the previous candidate data group. Specifically, the queried device obtains the current candidate data group, obtains the first candidate hash data in the current candidate data group, obtains the last candidate hash data in the previous candidate data group, randomly selects a number between the first candidate hash data and the last candidate hash data as the current data group interval point, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step to obtain the current candidate hash data corresponding to the current candidate data group, until each data group interval point is obtained.
[0221] For example, the current candidate data group is: [317, 553], the previous candidate data group is: [55, 270], the current candidate hash data is the first candidate hash data in the current candidate data group: 317, and the target candidate hash data is the last candidate hash data in the previous candidate data group: 270. Then the current candidate data group interval point can be a number randomly selected from the first candidate hash data and the last candidate hash data. For example, 300 can be selected as the current candidate data group interval point.
[0222] In one embodiment, the device to be queried determines the corresponding data group interval point based on the candidate hash data in each candidate data group, including: the device to be queried obtains the current candidate data group, obtains the current candidate hash data in the current candidate data group, obtains the target candidate hash data in the previous candidate data group, calculates the current data group interval point based on the current candidate hash data and the target candidate hash data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step of obtaining the current candidate hash data in the current candidate data group, until the data group interval point is obtained.
[0223] Specifically, the corresponding data group interval points are determined according to the data in each candidate data group. Specifically, the current candidate data group is obtained, the current candidate hash data corresponding to the current candidate data group is obtained, the target candidate hash data corresponding to the previous candidate data group is obtained, the current data group interval points are calculated according to the current candidate hash data and the target candidate hash data, the next candidate data group is obtained, the next candidate data group is used as the current candidate data group, and the step of returning to obtain the current candidate hash data corresponding to the current candidate data group is returned until each data group interval point is obtained, and each data group interval point is sorted to obtain an ordered data group interval point set. Among them, the current candidate data group can be randomly selected from each candidate data group as the current candidate data group, or the candidate data groups can be determined as the current candidate data group in sequence.
[0224] In another embodiment, the current candidate hash data may be the first candidate hash data in the current candidate data group, and the target candidate hash data may be the last candidate hash data in the previous candidate data group. Specifically, the device to be queried obtains the current candidate data group, obtains the first candidate hash data in the current candidate data group, obtains the last candidate hash data in the previous candidate data group, calculates the current data group interval point based on the first candidate hash data and the last candidate hash data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step of obtaining the first candidate hash data in the current candidate data group, until the data group interval point is obtained.
[0225] In one embodiment, Fig. 9As shown, a data set processing method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the device to be queried:
[0226] Step 902: Acquire a candidate data set, where the candidate data set includes at least one candidate data.
[0227] Step 904: Process at least one candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data.
[0228] Among them, the device to be queried here can be the device to be queried where the data user is located, storing a candidate data set, the candidate data set includes at least one candidate data, processing the candidate data set to obtain a target candidate data set, grouping the target candidate data set to obtain multiple candidate data groups, determining the corresponding data group interval points based on the data in each candidate data group, sorting these data group interval points to obtain an ordered data group interval point set.
[0229] Among them, the ordered interval point set here refers to a set of data group interval points in a certain order, and the data group interval point refers to the interval value between the candidate data groups corresponding to the candidate data set, and the candidate data set is pre-stored on the device to be queried, and the candidate data set includes at least one candidate data. The candidate data set is processed to obtain the target candidate data set.
[0230] Among them, the candidate data set is processed to obtain the target candidate data set, which can be specifically, obtaining a preset hash function, hashing each candidate data in the candidate data set through the preset hash function to obtain corresponding candidate hash data, and the target candidate data set is composed of each candidate hash data.
[0231] For example, all candidate data in the candidate data set are processed by the same hash function through the following formula to obtain candidate hash data, and the candidate hash data constitute the target candidate data set:
[0232]
[0233] Step 906: group the target candidate data set according to a preset rule to obtain multiple candidate data groups.
[0234] Step 908, determining the corresponding data group interval points according to the candidate hash data in each candidate data group, and generating an ordered data group interval point set according to each data group interval point.
[0235] Specifically, after obtaining the target candidate data set, which includes at least one candidate hash data, the device to be queried groups the target candidate data set to obtain multiple candidate data groups, determines the corresponding data group interval points according to the data in each candidate data group, and sorts these data group interval points to obtain an ordered data group interval point set. Specifically, the device to be queried groups the target candidate data set according to a preset rule to obtain multiple candidate data groups, wherein the preset rule can be sorting the candidate hash data in the target candidate data set, and the sorting can be in ascending or descending order to obtain a sorted target candidate data set, and then groups the sorted target candidate data set according to a preset grouping size to obtain multiple candidate data groups.
[0236] Specifically, the candidate hash data in the target candidate data set can be sorted according to an ascending rule, or the candidate hash data in the target candidate data set can be descended according to a descending rule to obtain a sorted target candidate data set, and then a preset group size is obtained. The so-called group size refers to the maximum bearing capacity corresponding to the corresponding group. The preset group size can be determined according to business needs, application scenarios or product needs. The sorted target candidate data set is grouped according to the preset group size to obtain each grouped candidate data group.
[0237] Furthermore, the corresponding data group interval points are determined according to the data in each candidate data group. Specifically, the current candidate data group is obtained, the current candidate hash data corresponding to the current candidate data group is obtained, the target candidate hash data corresponding to the previous candidate data group is obtained, the current data group interval points are calculated according to the current candidate hash data and the target candidate hash data, the next candidate data group is obtained, the next candidate data group is used as the current candidate data group, and the step of obtaining the current candidate hash data corresponding to the current candidate data group is returned until each data group interval point is obtained, and each data group interval point is sorted to obtain an ordered data group interval point set. Among them, the current candidate hash data can be the first candidate hash data of the current candidate data group, and the target candidate hash data can be the last candidate hash data of the previous candidate data group.
[0238] For example, the target candidate data set obtained by hash function processing the candidate data set is: 55, 270, 317, 553, 682, 847, 987, 1203. The target candidate data set is grouped to obtain: [55, 270], [317, 553], [682, 847], [987, 1203]. The ordered interval point set is: the data group interval point between the first group and the second group is 293.5, the data group interval point between the second group and the third group is 617.5, and the data group interval point between the third group and the fourth group is 917. The ordered data group interval point set is: {293.5, 617.5, 917}. Among them, the data group interval point between the first group and the second group can be calculated based on the last candidate hash data of the first group and the first candidate hash data of the second group. For example, the last candidate hash data of the first group is 270, and the first candidate hash data of the second group is 317. The data group interval point between the first group and the second group can be: (270+317) / 2=293.5. Similarly, the data group interval point between the second group and the third group can be calculated based on the last candidate hash data of the second group and the first candidate hash data of the third group. For example, the last candidate hash data of the second group is 553, and the first candidate hash data of the third group is 682. The data group interval point between the second group and the third group can be: (553+682) / 2=617.5. By analogy, the data group interval point between the third group and the fourth group can be calculated based on the last candidate hash data of the third group and the first candidate hash data of the fourth group. For example, the last candidate hash data of the third group is 847, and the first candidate hash data of the fourth group is 987. The data group interval point between the third group and the fourth group can be: (847+987) / 2=917.
[0239] In one embodiment, the corresponding data group interval point is determined according to the candidate hash data in each candidate data group, including: obtaining the current candidate data group, obtaining the current candidate hash data in the current candidate data group, obtaining the target candidate hash data in the previous candidate data group, calculating the current data group interval point according to the current candidate hash data and the target candidate hash data, obtaining the next candidate data group, taking the next candidate data group as the current candidate data group, returning to the step of obtaining the current candidate hash data in the current candidate data group, until the data group interval point is obtained.
[0240] Specifically, the corresponding data group interval points are determined according to the data in each candidate data group. Specifically, the current candidate data group is obtained, the current candidate hash data corresponding to the current candidate data group is obtained, the target candidate hash data corresponding to the previous candidate data group is obtained, the current data group interval points are calculated according to the current candidate hash data and the target candidate hash data, the next candidate data group is obtained, the next candidate data group is used as the current candidate data group, and the step of returning to obtain the current candidate hash data corresponding to the current candidate data group is returned until each data group interval point is obtained, and each data group interval point is sorted to obtain an ordered data group interval point set. Among them, the current candidate data group can be randomly selected from each candidate data group as the current candidate data group, or the candidate data groups can be determined as the current candidate data group in sequence.
[0241] In another embodiment, the current candidate hash data may be the first candidate hash data in the current candidate data group, and the target candidate hash data may be the last candidate hash data in the previous candidate data group. Specifically, the device to be queried obtains the current candidate data group, obtains the first candidate hash data in the current candidate data group, obtains the last candidate hash data in the previous candidate data group, calculates the current data group interval point based on the first candidate hash data and the last candidate hash data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step of obtaining the first candidate hash data in the current candidate data group, until the data group interval point is obtained.
[0242] In one embodiment, the data set processing method also includes: receiving newly added candidate hash data, inserting the newly added candidate hash data into its corresponding first data group, determining whether the amount of data in the first data group exceeds a set range, and if so, redetermining the data group interval points from the first data group, and updating the ordered data group interval point set according to each data group interval point.
[0243] Among them, the first data group here refers to the data group into which the newly added candidate hash data needs to be inserted. The first data group corresponding to the newly added candidate hash data can be determined based on the interval points of each data group, and then whether the number of data in the first data group exceeds the set range. If so, the data group interval points are redetermined from the first data group, and the ordered data group interval point set is updated according to each data group interval point. For example, the data group interval point between the first group and the second group is 293.5, the data group interval point between the second group and the third group is 617.5, and the newly added candidate hash data is 530, then the newly added candidate hash data is determined to be the second group as the first data group, and then it is determined whether the number of data in the first data group exceeds the set range. If so, the data group interval points are redetermined from the first data group, and the ordered data group interval point set is updated according to each data group interval point.
[0244] In a specific embodiment, a data query method is provided, which specifically includes the following steps:
[0245] 1. The device to be queried obtains a candidate data set, where the candidate data set includes at least one candidate data.
[0246] 2. The device to be queried processes the candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data.
[0247] 3. The device to be queried groups the target candidate data set according to preset rules to obtain multiple candidate data groups.
[0248] 4. The device to be queried determines the corresponding data group interval points according to the candidate hash data in each candidate data group, and generates an ordered data group interval point set according to each data group interval point.
[0249] 4-1. The device to be queried obtains the current candidate data group, obtains the current candidate hash data in the current candidate data group, obtains the target candidate hash data in the previous candidate data group, calculates the current data group interval point based on the current candidate hash data and the target candidate hash data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to step to obtain the current candidate hash data in the current candidate data group, until the data group interval point is obtained.
[0250] 5. Send a query request for the current ordered interval point set version number to the device to be queried. The query request for the current ordered interval point set version number includes the current ordered interval point set version number, so that the device to be queried obtains the candidate ordered interval point set version number, and compares whether the current ordered interval point set version number and the candidate ordered interval point set version number are consistent. If they are consistent, they are determined as the first version number information. If they are inconsistent, they are determined as the second version number information and returned, where the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried.
[0251] 6. Receive the first version number information returned by the device to be queried, obtain the historical ordered interval point set, and use the historical ordered interval point set as the ordered interval point set, and proceed to step 10.
[0252] 7. Receive the second version number information returned by the device to be queried, and then proceed to step 8.
[0253] 8. Send a data query request to the device to be queried.
[0254] 9. Receive an ordered interval point set, where the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request.
[0255] 10. Obtain the data to be queried, and determine the current data group number corresponding to the data to be queried based on the data to be queried and the ordered interval point set.
[0256] 10-1. Obtain two adjacent target interval points corresponding to the data to be queried from the ordered interval point set.
[0257] 10-2. Determine the current data group number corresponding to the data to be queried based on the two target interval points.
[0258] 11. Execute a preset encryption protocol on the data to be queried, and obtain the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed.
[0259] 11-1. The preset encryption protocol is an oblivious pseudo-random function protocol, and the oblivious pseudo-random function protocol is executed on the query data. After the oblivious pseudo-random function protocol is executed, the encrypted data to be queried corresponding to the query data is obtained, wherein the oblivious pseudo-random function protocol enables the query device and the queried device to exchange information in an oblivious manner.
[0260] 11-1-1. Obtain a preset encryption key pair, where the preset encryption key pair includes a first encryption key and a second encryption key.
[0261] 11-1-2. Receive the first encrypted data and the second encrypted data sent by the device to be queried.
[0262] 11-1-3. Randomly generate a first random number, calculate the third encrypted data according to the first random number and the first encryption key, and calculate the fourth encrypted data according to the first encrypted data, the data to be queried, and the second encrypted data.
[0263] 11-1-4. The third encrypted data, the fourth encrypted data and the first encryption key are sent to the device to be queried, so that the device to be queried randomly generates a second random number, calculates the fifth encrypted data according to the fourth encrypted data, calculates the sixth encrypted data according to the fifth encrypted data and the preset encryption modulus, calculates the seventh encrypted data according to the sixth encrypted data and the third encrypted data, calculates the eighth encrypted data according to the preset public parameters and the second random number, and calculates the ninth encrypted data according to the seventh encrypted data, the first encryption key and the eighth encrypted data.
[0264] 11-1-5. Receive the seventh encrypted data and the ninth encrypted data returned by the device to be queried, and calculate the encrypted data to be queried corresponding to the data to be queried according to the seventh encrypted data and the ninth encrypted data.
[0265] 12. Send the current data group serial number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group serial number, obtains the current encryption function corresponding to the preset random number, performs encryption calculation on at least one current data according to the current encryption function to obtain the current encrypted data set, constructs the current encryption algebraic expression according to the current encrypted data set, and generates the current coordinate data set according to the current encryption algebraic expression.
[0266] 12-1. The current encryption function is a current oblivious pseudo-random function. The current data group serial number is sent to the device to be queried so that the device to be queried randomly generates a preset random number, obtains the current oblivious pseudo-random function corresponding to the preset random number, obtains at least one current data corresponding to the current data group serial number, processes at least one current data according to the current oblivious pseudo-random function, obtains a current encrypted data set corresponding to at least one current data, takes the current encrypted data in the current encrypted data set as a root, constructs a current encrypted algebraic expression, and randomly generates a non-zero current coordinate data set according to the current encrypted algebraic expression, wherein the current encrypted algebraic expression includes multiple current calculation unit items.
[0267] 13. Receive the current coordinate data set, and generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set. The target encrypted algebraic expression includes a plurality of target calculation unit items, and each target calculation unit item includes a corresponding target algebraic expression coefficient.
[0268] 13-1. Obtain the encrypted coordinate data corresponding to the encrypted data to be queried.
[0269] 13-2. Calculate the target encrypted algebraic expression based on the encrypted coordinate data and the current coordinate data set.
[0270] 14. Send the coefficients of the target algebraic expression to the device to be queried, so that the device to be queried determines the query result corresponding to the data to be queried according to the coefficients of the target algebraic expression and the current encrypted algebraic expression.
[0271] 14-1. The current encrypted algebraic expression includes multiple current calculation unit items, each of which includes a corresponding current algebraic expression coefficient. The target algebraic expression coefficient corresponding to each target calculation unit item is sent to the device to be queried, so that the device to be queried obtains the current algebraic expression coefficient corresponding to each current calculation unit item in the current encrypted algebraic expression, and compares whether the current algebraic expression coefficient and the corresponding target algebraic expression coefficient are the same. When the current algebraic expression coefficient and the corresponding target algebraic expression coefficient are the same, it is determined that the data to be queried is in the candidate data set.
[0272] 14-2. On the contrary, when any current algebraic expression coefficient is different from the corresponding target algebraic expression coefficient, it is determined that the data to be queried is not in the candidate data set.
[0273] 15. Receive query results.
[0274] It should be understood that, although the various steps in the above-mentioned flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0275] In one embodiment, Fig.10 As shown, a data query system 1000 is provided, including:
[0276] The query device 1002 is used to obtain a data query request and send the data query request to the device to be queried.
[0277] The device to be queried 1004 is used to obtain an ordered interval point set corresponding to the candidate data set according to the data query request, and return the ordered interval point set to the query device, wherein the ordered interval point set includes the ordered data group interval points corresponding to the candidate data set.
[0278] The query device 1002 is also used to receive an ordered interval point set, obtain the data to be queried, determine the current data group sequence number corresponding to the data to be queried based on the data to be queried and the ordered interval point set, execute a preset encryption protocol on the data to be queried, obtain the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed, and send the current data group sequence number to the device to be queried.
[0279] The device to be queried 1004 is also used to obtain at least one current data corresponding to the current data group serial number, obtain the current encryption function corresponding to the preset random number, perform encryption calculation on at least one current data according to the current encryption function to obtain the current encrypted data set, construct the current encryption algebraic expression according to the current encrypted data set, generate the current coordinate data set according to the current encryption algebraic expression, and return the current coordinate data set to the query device.
[0280] The query device 1002 is also used to receive the current coordinate data set, generate a target encrypted algebraic expression based on the encrypted data to be queried and the current coordinate data set, the target encrypted algebraic expression includes multiple target calculation unit items, each target calculation unit item includes a corresponding target algebraic expression coefficient, and send the target algebraic expression coefficient to the device to be queried.
[0281] The device to be queried 1004 is further used to determine the query result corresponding to the data to be queried according to the coefficients of the target algebraic expression and the current encrypted algebraic expression, and return the query result to the query device.
[0282] The query device 1002 is also used to receive query results.
[0283] In one embodiment, Fig.11 As shown, a data query device 1100 is provided, comprising: a query request sending module 1102, an ordered interval point set receiving module 1104, a to-be-queried data obtaining module 1106, a to-be-queried encrypted data generating module 1108, a current data group sequence number sending module 1110, a coordinate data set receiving module 1112, an algebraic expression coefficient sending module 1114 and a query result receiving module 1116, wherein:
[0284] The query request sending module 1102 is used to send a data query request to the device to be queried.
[0285] The ordered interval point set receiving module 1104 is used to receive an ordered interval point set, where the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request.
[0286] The to-be-queried data acquisition module 1106 is used to acquire the to-be-queried data and determine the current data group sequence number corresponding to the to-be-queried data according to the to-be-queried data and the ordered interval point set.
[0287] The encrypted data to be queried generating module 1108 is used to execute a preset encryption protocol on the data to be queried, and obtain the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed.
[0288] The current data group sequence number sending module 1110 is used to send the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, obtains the current encryption function corresponding to the preset random number, performs encryption calculation on at least one current data according to the current encryption function to obtain the current encrypted data set, constructs the current encryption algebraic expression according to the current encrypted data set, and generates the current coordinate data set according to the current encryption algebraic expression.
[0289] The coordinate data set receiving module 1112 is used to receive the current coordinate data set, and generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set. The target encrypted algebraic expression includes multiple target calculation unit items, and each target calculation unit item includes a corresponding target algebraic expression coefficient.
[0290] The algebraic expression coefficient sending module 1114 is used to send the target algebraic expression coefficient to the device to be queried, so that the device to be queried determines the query result corresponding to the data to be queried according to the target algebraic expression coefficient and the current encrypted algebraic expression.
[0291] The query result receiving module 1116 is used to receive the query result.
[0292] In one embodiment, the to-be-queried data acquisition module 1106 is further configured to acquire two adjacent target interval points corresponding to the to-be-queried data from the ordered interval point set, and determine the current data group sequence number corresponding to the to-be-queried data according to the two target interval points.
[0293] In one embodiment, the data query device 1100 is also used to send a current ordered interval point set version number query request to the device to be queried, and the current ordered interval point set version number query request includes the current ordered interval point set version number, so that the device to be queried obtains the candidate ordered interval point set version number, compares whether the current ordered interval point set version number and the candidate ordered interval point set version number are consistent, if they are consistent, then it is determined as the first version number information, if they are inconsistent, then it is determined as the second version number information and returned, wherein the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried, receives the first version number information returned by the device to be queried, obtains the historical ordered interval point set, then uses the historical ordered interval point set as the ordered interval point set, and enters the step of obtaining the data to be queried, or, receives the second version number information returned by the device to be queried, then enters the step of sending a data query request to the device to be queried.
[0294] In one embodiment, the preset encryption protocol is an oblivious pseudo-random function protocol, and the encrypted data to be queried generation module 1108 is also used to execute the oblivious pseudo-random function protocol on the data to be queried, and after the oblivious pseudo-random function protocol is executed, the encrypted data to be queried corresponding to the data to be queried is obtained, wherein the oblivious pseudo-random function protocol enables the querying device and the device to be queried to exchange information in an oblivious manner.
[0295] In one embodiment, the preset encryption protocol is an inadvertent pseudo-random function protocol, and the encrypted data generation module 1108 to be queried is also used to obtain a preset encryption key pair, the preset encryption key pair includes a first encryption key and a second encryption key, receive the first encrypted data and the second encrypted data sent by the device to be queried, randomly generate a first random number, calculate the third encrypted data according to the first random number and the first encryption key, calculate the fourth encrypted data according to the first encrypted data, the data to be queried, and the second encrypted data, send the third encrypted data, the fourth encrypted data and the first encryption key to the device to be queried, so that the device to be queried randomly generates a second random number, calculates the fifth encrypted data according to the fourth encrypted data, calculates the sixth encrypted data according to the fifth encrypted data and the preset encryption modulus length, calculates the seventh encrypted data according to the sixth encrypted data and the third encrypted data, calculates the eighth encrypted data according to the preset public parameters and the second random number, calculates the ninth encrypted data according to the seventh encrypted data, the first encryption key and the eighth encrypted data, receives the seventh encrypted data and the ninth encrypted data returned by the device to be queried, and calculates the encrypted data to be queried corresponding to the data to be queried according to the seventh encrypted data and the ninth encrypted data.
[0296] In one embodiment, the current encryption function is a current oblivious pseudo-random function, and the current data group sequence number sending module 1110 is also used to send the current data group sequence number to the device to be queried, so that the device to be queried randomly generates a preset random number, obtains the current oblivious pseudo-random function corresponding to the preset random number, obtains at least one current data corresponding to the current data group sequence number, processes at least one current data according to the current oblivious pseudo-random function, obtains a current encrypted data set corresponding to at least one current data, takes the current encrypted data in the current encrypted data set as the root, constructs a current encrypted algebraic expression, and randomly generates a non-zero current coordinate data set according to the current encrypted algebraic expression, wherein the current encrypted algebraic expression includes multiple current calculation unit items.
[0297] In one embodiment, the coordinate data set receiving module 1112 is further used to obtain encrypted coordinate data corresponding to the encrypted data to be queried, and calculate the target encrypted algebraic expression according to the encrypted coordinate data and the current coordinate data set.
[0298] In one embodiment, the current encrypted algebraic expression includes multiple current calculation unit items, each of which includes a corresponding current algebraic expression coefficient. The algebraic expression coefficient sending module 1114 is also used to send the target algebraic expression coefficient corresponding to each target calculation unit item to the device to be queried, so that the device to be queried obtains the current algebraic expression coefficient corresponding to each current calculation unit item in the current encrypted algebraic expression, compares the current algebraic expression coefficient and the corresponding target algebraic expression coefficient to see if they are the same. When the current algebraic expression coefficient and the corresponding target algebraic expression coefficient are the same, it is determined that the data to be queried is in the candidate data set. Otherwise, when any current algebraic expression coefficient is different from the corresponding target algebraic expression coefficient, it is determined that the data to be queried is not in the candidate data set.
[0299] For the specific definition of the data query device, please refer to the definition of the data query method above, which will not be repeated here. Each module in the above-mentioned data query device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0300] In one embodiment, Fig.12 As shown, a data set processing device 1200 is provided, comprising: a candidate data set acquisition module 1202, a target candidate data set acquisition module 1204, a target candidate data set grouping module 1206, and an ordered data group interval point set generation module 1208, wherein:
[0301] The candidate data set acquisition module 1202 is used to acquire a candidate data set, where the candidate data set includes at least one candidate data.
[0302] The target candidate data set acquisition module 1204 is used to process at least one candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data.
[0303] The target candidate data set grouping module 1206 is used to group the target candidate data set according to a preset rule to obtain multiple candidate data groups.
[0304] The ordered data group interval point set generation module 1208 is used to determine the corresponding data group interval points according to the candidate hash data in each candidate data group, and generate an ordered data group interval point set according to each data group interval point.
[0305] In one embodiment, the ordered data group interval point set generation module 1208 is also used to obtain the current candidate data group, obtain the current candidate hash data in the current candidate data group, obtain the target candidate hash data in the previous candidate data group, calculate the current data group interval point based on the current candidate hash data and the target candidate hash data, obtain the next candidate data group, use the next candidate data group as the current candidate data group, return to the step of obtaining the current candidate hash data in the current candidate data group, until the data group interval point is obtained.
[0306] In one embodiment, the data set processing device 1200 is also used to receive newly added candidate hash data, insert the newly added candidate hash data into its corresponding first data group, and determine whether the amount of data in the first data group exceeds a set range. If so, redetermine the data group interval points from the first data group, and update the ordered data group interval point set according to each data group interval point.
[0307] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.13 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store query results. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data query method is implemented.
[0308] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.14As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data query method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0309] Those skilled in the art will understand that Fig.13 or Fig.14 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0310] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above data query method. The steps of the data query method here may be the steps in the data query method of each of the above embodiments.
[0311] In one embodiment, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above data query method. The steps of the data query method here can be the steps in the data query method of each of the above embodiments.
[0312] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned data set processing method. The steps of the data set processing method here may be the steps of the data set processing method in the above-mentioned various embodiments.
[0313] In one embodiment, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the processor executes the steps of the above-mentioned data set processing method. The steps of the data set processing method here may be the steps of the data set processing method in each of the above-mentioned embodiments.
[0314] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0315] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0316] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A data query method, characterized in that: The method comprises: Send a data query request to the device to be queried; Receiving an ordered interval point set, the ordered interval point set comprising ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request; Acquire the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set; Executing a preset encryption protocol on the data to be queried, and obtaining the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed; Send the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, obtains a current encryption function corresponding to a preset random number, performs encryption calculation on at least one current data according to the current encryption function to obtain a current encrypted data set, constructs a current encryption algebraic expression according to the current encrypted data set, and generates a current coordinate data set according to the current encryption algebraic expression; Receive the current coordinate data set, and generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set, wherein the target encrypted algebraic expression includes a plurality of target calculation unit items, and each target calculation unit item includes a corresponding target algebraic expression coefficient; Sending the target algebraic expression coefficients to the device to be queried, so that the device to be queried determines a query result corresponding to the data to be queried according to the target algebraic expression coefficients and the current encrypted algebraic expression; The query result is received.
2. The method according to claim 1, characterized in that The determining the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set comprises: Acquire two adjacent target interval points corresponding to the data to be queried from the ordered interval point set; The current data group sequence number corresponding to the data to be queried is determined according to the two target interval points.
3. The method according to claim 1, characterized in that The method further comprises: Send a current ordered interval point set version number query request to the device to be queried, wherein the current ordered interval point set version number query request includes the current ordered interval point set version number, so that the device to be queried obtains the candidate ordered interval point set version number, compares whether the current ordered interval point set version number and the candidate ordered interval point set version number are consistent, and if they are consistent, determines them as the first version number information, and if they are inconsistent, determines them as the second version number information, and returns, wherein the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried; Receive the first version number information returned by the device to be queried, obtain a historical ordered interval point set, use the historical ordered interval point set as an ordered interval point set, and proceed to the step of obtaining the data to be queried, or; After receiving the second version number information returned by the device to be queried, the step of sending a data query request to the device to be queried is entered.
4. The method according to claim 1, characterized in that: The preset encryption protocol is an inadvertent pseudo-random function protocol, and the preset encryption protocol is executed on the data to be queried, and after the preset encryption protocol is executed, the encrypted data to be queried corresponding to the data to be queried is obtained, including: Executing the oblivious pseudo-random function protocol on the data to be queried, and obtaining the encrypted data to be queried corresponding to the data to be queried after the oblivious pseudo-random function protocol is executed, wherein the oblivious pseudo-random function protocol enables the querying device and the device to be queried to exchange information in an oblivious manner; After the execution of the inadvertent pseudo-random function protocol is completed, obtaining the encrypted data to be queried corresponding to the data to be queried includes: Obtaining a preset encryption key pair, wherein the preset encryption key pair includes a first encryption key and a second encryption key; Receiving first encrypted data and second encrypted data sent by the device to be queried; Randomly generate a first random number, calculate third encrypted data according to the first random number and the first encryption key, and calculate fourth encrypted data according to the first encrypted data, the data to be queried, and the second encrypted data; Sending the third encrypted data, the fourth encrypted data, and the first encryption key to the device to be queried, so that the device to be queried randomly generates a second random number, calculates fifth encrypted data according to the fourth encrypted data, calculates sixth encrypted data according to the fifth encrypted data and a preset encryption modulus length, calculates seventh encrypted data according to the sixth encrypted data and the third encrypted data, calculates eighth encrypted data according to a preset public parameter and the second random number, and calculates ninth encrypted data according to the seventh encrypted data, the first encryption key, and the eighth encrypted data; The seventh encrypted data and the ninth encrypted data returned by the device to be queried are received, and the encrypted data to be queried corresponding to the data to be queried is calculated according to the seventh encrypted data and the ninth encrypted data.
5. The method according to claim 1, characterized in that The current encryption function is a current random pseudo-random function, the current data group sequence number is sent to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, obtains the current encryption function corresponding to a preset random number, performs encryption calculation on at least one current data according to the current encryption function to obtain a current encrypted data set, constructs a current encryption algebraic expression according to the current encrypted data set, and generates a current coordinate data set according to the current encryption algebraic expression, including: The current data group serial number is sent to the device to be queried, so that the device to be queried randomly generates a preset random number, obtains a current inadvertent pseudo-random function corresponding to the preset random number, obtains at least one current data corresponding to the current data group serial number, processes at least one current data according to the current inadvertent pseudo-random function, obtains a current encrypted data set corresponding to at least one current data, takes the current encrypted data in the current encrypted data set as a root, constructs a current encrypted algebraic expression, and randomly generates a non-zero current coordinate data set according to the current encrypted algebraic expression, wherein the current encrypted algebraic expression includes multiple current calculation unit items.
6. The method according to claim 1, characterized in that The step of generating a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set includes: Obtaining encrypted coordinate data corresponding to the encrypted data to be queried; A target encrypted algebraic expression is calculated based on the encrypted coordinate data and the current coordinate data set.
7. The method according to claim 1, characterized in that The current encrypted algebraic expression includes a plurality of current calculation unit items, each of which includes a corresponding current algebraic expression coefficient, and sending the target algebraic expression coefficient to the device to be queried so that the device to be queried determines a query result corresponding to the data to be queried according to the target algebraic expression coefficient and the current encrypted algebraic expression, including: Sending the target algebraic expression coefficients corresponding to the target calculation unit items to the device to be queried, so that the device to be queried obtains the current algebraic expression coefficients corresponding to the current calculation unit items in the current encrypted algebraic expression, and compares whether the current algebraic expression coefficients and the corresponding target algebraic expression coefficients are the same, and when the current algebraic expression coefficients and the corresponding target algebraic expression coefficients are the same, determining that the data to be queried is in the candidate data set; On the contrary, when any of the current algebraic expression coefficients is different from the corresponding target algebraic expression coefficients, it is determined that the data to be queried is not in the candidate data set.
8. The method according to claim 1, characterized in that The step of generating the ordered interval point set comprises: The device to be queried obtains a candidate data set, where the candidate data set includes at least one candidate data; The device to be queried processes the candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data; The device to be queried groups the target candidate data set according to a preset rule to obtain a plurality of candidate data groups; The device to be queried determines the corresponding data group interval point according to the candidate hash data in each of the candidate data groups, and generates an ordered data group interval point set according to each of the data group interval points.
9. The method according to claim 8, characterized in that The device to be queried determines the corresponding data group interval point according to the candidate hash data in each of the candidate data groups, including: The device to be queried obtains the current candidate data group, obtains the current candidate hash data in the current candidate data group, obtains the target candidate hash data in the previous candidate data group, calculates the current data group interval point based on the current candidate hash data and the target candidate hash data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step of obtaining the current candidate hash data in the current candidate data group, until the data group interval point is obtained.
10. The method according to claim 8 or 9, characterized in that: The method further comprises: The device to be queried receives the newly added candidate hash data and inserts the newly added candidate hash data into its corresponding first data group; determines whether the amount of data in the first data group exceeds the set range: if so, redetermines the data group interval points from the first data group, and updates the ordered data group interval point set according to each data group interval point.
11. A data query device, characterized in that: The device comprises: A query request sending module, used for sending a data query request to a device to be queried; An ordered interval point set receiving module, used for receiving an ordered interval point set, wherein the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request; A to-be-queried data acquisition module, used to acquire the to-be-queried data, and determine the current data group sequence number corresponding to the to-be-queried data according to the to-be-queried data and the ordered interval point set; A module for generating encrypted data to be queried, used for executing a preset encryption protocol on the data to be queried, and obtaining the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed; A current data group sequence number sending module, used for sending the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, obtains a current encryption function corresponding to a preset random number, performs encryption calculation on at least one current data according to the current encryption function to obtain a current encrypted data set, constructs a current encryption algebraic expression according to the current encrypted data set, and generates a current coordinate data set according to the current encryption algebraic expression; A coordinate data set receiving module, used for receiving the current coordinate data set, generating a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set, wherein the target encrypted algebraic expression includes a plurality of target calculation unit items, each of which includes a corresponding target algebraic expression coefficient; an algebraic expression coefficient sending module, configured to send the target algebraic expression coefficient to the device to be queried, so that the device to be queried determines a query result corresponding to the data to be queried according to the target algebraic expression coefficient and the current encrypted algebraic expression; The query result receiving module is used to receive the query result.
12. A data query system, characterized in that: The system comprises: A query device, used to obtain a data query request and send the data query request to a device to be queried; The device to be queried is used to obtain an ordered interval point set corresponding to the candidate data set according to the data query request, and return the ordered interval point set to the query device, wherein the ordered interval point set includes the ordered data group interval points corresponding to the candidate data set; The query device is further used to receive an ordered interval point set, obtain the data to be queried, determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set, execute a preset encryption protocol on the data to be queried, obtain the encrypted data to be queried corresponding to the data to be queried after the preset encryption protocol is executed, and send the current data group sequence number to the device to be queried; The device to be queried is further used to obtain at least one current data corresponding to the current data group sequence number, obtain a current encryption function corresponding to a preset random number, perform encryption calculation on at least one current data according to the current encryption function to obtain a current encrypted data set, construct a current encryption algebraic expression according to the current encrypted data set, generate a current coordinate data set according to the current encryption algebraic expression, and return the current coordinate data set to the querying device; The query device is further configured to receive the current coordinate data set, generate a target encrypted algebraic expression according to the encrypted data to be queried and the current coordinate data set, wherein the target encrypted algebraic expression includes a plurality of target calculation unit items, each of which includes a corresponding target algebraic expression coefficient, and send the target algebraic expression coefficient to the device to be queried; The device to be queried is further used to determine a query result corresponding to the data to be queried according to the coefficients of the target algebraic expression and the current encrypted algebraic expression, and return the query result to the query device; The query device is also used to receive the query result.
13. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Web page information processing method and device
CN104794237A
Data query method and device
CN110096899A
Data ciphertext query method based on fine-grained sorting in multi-user environment
CN110222081A
Data query method and system and storage medium
CN111783109A
Systems and methods for secure prediction using an encrypted query executed based on encrypted data
US20200082112A1
