A query method, electronic device and system

By simplifying the encryption and decryption operations of condition-value query on mobile terminals, efficient privacy information query under limited computing and communication resources is achieved, and the problem of high complexity of existing PIR technology on mobile terminals is solved.

CN117729534BActive Publication Date: 2024-11-08HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310564211.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-17
Publication Date
2024-11-08
Estimated Expiration
2043-05-17

AI Technical Summary

Technical Problem

The existing privacy information retrieval (PIR) technology is highly complex on mobile terminals and is difficult to apply to mobile phones, tablets and other devices with limited computing power and communication resources.

Method used

A query method is adopted to simplify the condition-value query process by using encryption and decryption operations to reduce the computing and communication resource requirements by only one round-trip communication between the query requesting end and the querying end. The specific method includes the first device sending an encrypted query request to the second device, receiving an encrypted response, and obtaining the query result through simple comparison and decryption.

Benefits of technology

The condition-value query process is simplified, query delay is reduced, query efficiency is improved, and computing and communication resources of mobile terminals are saved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117729534B_ABST
    Figure CN117729534B_ABST
Patent Text Reader

Abstract

A query method, electronic device and system, relating to the field of information security technology. The method comprises: in response to a query event, a first device sends a query request to a second device, the query request includes a first ciphertext obtained by encrypting a condition to be queried using a first key. In response to the query request, the second device sends a query response to the first device, the query response includes a second ciphertext and at least one ciphertext group, the second ciphertext is obtained by encrypting the first ciphertext using a second key, and a ciphertext group includes a third ciphertext obtained by encrypting a matching condition using the second key and a fourth ciphertext obtained by encrypting the result information using feature information of the matching condition. In response to the query response, the first device obtains the result information of the condition to be queried. In this way, the complexity of the condition-value query can be simplified, so that the solution can be applied to mobile terminals such as mobile phones and tablets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of information security technology, and in particular to a query method, electronic device and system. Background Art

[0002] When using mobile terminals such as mobile phones and tablets, the value corresponding to a certain condition is often queried from the cloud, server or other devices. For example, the mobile phone queries the server for the service functions activated by a friend in a social application. Another example is that the mobile phone queries the server for the treatment method of a certain disease. At the same time, the query process may involve the interaction of private information. For example, a friend's mobile phone number, disease information, etc.

[0003] In the prior art, reverse trace query, also known as private information retrieval (PIR), can be used to protect private information in the above-mentioned "condition-value" query process.

[0004] However, the inventors found during the implementation of the embodiments of the present application that the existing PIR is relatively complex and is generally difficult to apply to mobile terminals such as mobile phones and tablets that have limited computing power and communication resources. Summary of the invention

[0005] The present application provides a query method, electronic device and system, which can reduce the requirements on the computing power and communication resources of the query request end in the condition-value query scenario, so that mobile terminals such as mobile phones and tablets can also be used as query request ends.

[0006] In the first aspect, the present application provides a query method, which is applied to a first device such as a mobile phone, a tablet, and a laptop computer. The first device has a requirement to perform a condition-value query on other devices (such as a second device) to obtain a query result corresponding to the query condition. Specifically, in response to a query event, the first device sends a query request to the second device, and the query request includes a first ciphertext obtained by encrypting the condition to be queried using a first key. The first device receives a query response from the second device, and the query response includes a second ciphertext and a first ciphertext set. The second ciphertext is obtained by encrypting the first ciphertext using a second key. The first ciphertext set includes at least one ciphertext group, and one ciphertext group corresponds to a matching condition and the result information of the matching condition. One ciphertext group includes a third ciphertext obtained by encrypting the matching condition using the second key and a fourth ciphertext obtained by encrypting the result information using the feature information of the matching condition. The first device obtains the result information of the condition to be queried, and the result information of the condition to be queried is one of the result information of at least one matching condition.

[0007] Since the second device uses the characteristic information of the matching condition to encrypt the result information corresponding to the matching condition, then after the first device obtains the matching condition that matches the condition to be queried through comparison, it can naturally use the characteristic information of the condition to be queried to decrypt the corresponding result information, thereby obtaining the result information of the condition to be queried. In this way, on the one hand, the first device and the second device only need one round-trip communication to obtain the query result; on the other hand, the first device can obtain the result information of the condition to be queried through simple matching and decryption operations. It can be seen that the use of the present application solution can simplify the query process of condition-value query, reduce query latency, and improve query efficiency.

[0008] In a possible design, the first device obtains the result information of the condition to be queried, including: the first device uses the characteristic information of the condition to be queried to decrypt the fourth ciphertext corresponding to the target ciphertext in the first ciphertext set to obtain the result information of the condition to be queried. It should be understood that in the first ciphertext set, the third ciphertext and the fourth ciphertext exist in the form of a ciphertext group (i.e., in pairs), so each third ciphertext has a corresponding fourth ciphertext. Among them, the target ciphertext is the ciphertext in the third ciphertext of the first ciphertext set that is equal to the fifth ciphertext, and the fifth ciphertext is the ciphertext obtained by decrypting the second ciphertext using the first key.

[0009] The first device obtains the fifth ciphertext by decrypting the second ciphertext. That is, the fifth ciphertext is the ciphertext encrypted by the second key for the condition to be queried. At the same time, the third ciphertexts in the first ciphertext set are all ciphertexts obtained by encrypting the corresponding matching condition using the second key. On this basis, the fifth ciphertext is equal to the target ciphertext in the third ciphertext of the first ciphertext set, indicating that the condition to be queried is equal to the corresponding matching condition. Therefore, it can be determined that the fourth ciphertext corresponding to the target ciphertext is the ciphertext of the result information of the condition to be queried. At the same time, the fourth ciphertext is encrypted using the characteristic information of the matching condition. Therefore, the first device uses the characteristic information of the condition to be queried to decrypt the fourth ciphertext corresponding to the target ciphertext to obtain the result information of the condition to be queried.

[0010] Normally, in a query process, the number of conditions to be queried is small, and accordingly, the number of second ciphertexts is also small. For example, if there is only one condition to be queried each time, there is only one second ciphertext. However, there may be multiple matching conditions, so there may be multiple third ciphertexts in the first ciphertext set. It can be seen that the amount of calculation for encrypting the third ciphertext is often greater than the amount of calculation for decrypting the second ciphertext. Therefore, after receiving the query response, the first device decrypts the second ciphertext and then determines the target ciphertext, which can reduce the amount of calculation of the first device and save computing resources.

[0011] In a possible design, the feature information includes information of some bits (such as the first feature) in the hash value of the corresponding data. For example, the feature information of the condition to be queried may be some bits in the hash value of the condition to be queried, and the hash feature of the matching condition may be some bits in the hash value of the matching condition.

[0012] In a possible design, the first bit is one or more bits in the hash value from low to high, which can also be called a hash suffix.

[0013] In a possible design, the third ciphertext in the first ciphertext set is a compressed ciphertext obtained by encrypting the matching condition using the second key and then compressing it. In this way, the amount of data transmission between the first device and the second device can be reduced, saving communication overhead. In addition, in order to make the fifth ciphertext comparable to the third ciphertext in the first ciphertext set, the fifth ciphertext should be a compressed ciphertext obtained by decrypting the second ciphertext using the first key and then compressing it.

[0014] In one possible design, the compressed ciphertext includes information of some bits (such as the second bit) in the ciphertext before compression; or, the compressed ciphertext includes information of the second bit in the hash value of the ciphertext before compression.

[0015] In a possible design, the first ciphertext set is a ciphertext set in multiple ciphertext sets, and the hash feature is the same as the hash feature of the condition to be queried. A ciphertext set includes at least one ciphertext group, and a ciphertext group corresponds to a matching condition and result information of the matching condition. The hash feature of at least one matching condition corresponding to at least one ciphertext group is the same, and the hash feature of a ciphertext set is the hash feature of at least one matching condition.

[0016] It should be understood that if any matching condition is the same as the condition to be queried, then its hash value must be the same, and the hash feature is naturally the same. Then, through the hash feature, it is possible to find a matching condition that may be the same as the condition to be queried. Therefore, if the hash feature of the first ciphertext set is the same as the hash feature of the condition to be queried, it is equivalent to finding the third ciphertext with the matching condition that may be the same as the condition to be queried.

[0017] That is to say, with this design, the second device only sends the third ciphertext that may match the condition to be queried and the corresponding fourth ciphertext to the first device. In this way, the amount of data transmitted from the second device to the first device can be reduced, saving communication overhead.

[0018] In a possible design, the hash feature includes information of some special bits (such as the third bit) in the hash value of the corresponding data. Exemplarily, the third bit is one or more bits from high to low in the hash value (i.e., the first k2 bits), which can also be called a hash prefix.

[0019] In the actual query process, the third bit is used to find the matching condition that may be the same as the condition to be queried, then the information of the third bit in the hash value of the condition to be queried is the information of the third bit in the hash value of the matching condition corresponding to the third ciphertext in the first ciphertext set. At the same time, if the first bit is the same as the third bit, the first device can use the information of the third bit in the hash value of the condition to be queried to decrypt the result information corresponding to all the fourth ciphertexts in the first ciphertext set, which will obviously lead to information leakage in the second device. Therefore, in actual implementation, the third bit is different from the first bit to ensure the security of information in the second device. For example, the first bit is the last k1 bits, that is, the hash suffix, and the third bit is the first k2 bits, that is, the hash prefix.

[0020] In a possible design, the query request also includes a hash feature of the condition to be queried, so that the second device can determine a first ciphertext set with the same hash feature.

[0021] In the second aspect, the present application provides a query method, which is applied to a second device such as a cloud device and a server that provides query services. Specifically, the second device receives a query request from the first device, and the query request includes a first ciphertext obtained by encrypting the condition to be queried using a first key. The second device sends a query response to the first device, and the query response includes a second ciphertext and a first ciphertext set. The second ciphertext is obtained by encrypting the first ciphertext using a second key. The first ciphertext set includes at least one ciphertext group, and a ciphertext group corresponds to a matching condition and the result information of the matching condition. A ciphertext group includes a third ciphertext obtained by encrypting the matching condition using the second key and a fourth ciphertext obtained by encrypting the result information using the feature information of the matching condition. Among them, the query response is used by the first device to obtain the result information of the condition to be queried, and the result information of the condition to be queried is one of the result information of at least one matching condition. For details, please refer to the description of the first aspect, which will not be repeated here.

[0022] In a possible design, the query request also includes a hash feature of the condition to be queried. Before the second device sends a query response to the first device, the second device queries a first ciphertext set from multiple ciphertext sets whose hash feature is equal to the hash feature of the condition to be queried. Among them, a ciphertext set includes at least one ciphertext group, a ciphertext group corresponds to a matching condition and the result information of the matching condition, at least one ciphertext group corresponds to at least one matching condition with the same hash feature, and the hash feature of a ciphertext set is the hash feature of at least one matching condition. For details, please refer to the description in the possible design of the first aspect, which will not be repeated here.

[0023] In a possible design, the third ciphertext is obtained by encrypting the matching condition using the second key and then compressing it. For details, please refer to the description of the possible design of the first aspect, which will not be repeated here.

[0024] In a third aspect, the present application provides a query method, which is applied to a first device and a second device. Specifically, in response to a query event, the first device sends a query request to the second device, and the query request includes a first ciphertext obtained by encrypting the condition to be queried using a first key. In response to the query request, the second device sends a query response to the first device, and the query response includes a second ciphertext and a first ciphertext set. The second ciphertext is obtained by encrypting the first ciphertext using a second key. The first ciphertext set includes at least one ciphertext group, and a ciphertext group corresponds to a matching condition and the result information of the matching condition. A ciphertext group includes a third ciphertext obtained by encrypting the matching condition using the second key and a fourth ciphertext obtained by encrypting the result information using the feature information of the matching condition. In response to the query response, the first device obtains the result information of the condition to be queried, and the result information of the condition to be queried is one of the result information of at least one matching condition. For details, please refer to the description of the first aspect, which will not be repeated here.

[0025] In a fourth aspect, the present application further provides an electronic device, comprising a memory and one or more processors. The memory is coupled to the processor. The memory is used to store computer program code, and the computer program code includes computer instructions. Wherein, the electronic device is a first device, and when the computer instructions are executed by the processor, the electronic device executes the steps executed by the first device in the first aspect, the second aspect, the third aspect, and any possible design thereof; or, the electronic device is a second device, and when the computer instructions are executed by the processor, the electronic device executes the steps executed by the second device in the first aspect, the second aspect, the third aspect, and any possible design thereof.

[0026] In a fifth aspect, the present application also provides a communication system, comprising a first device and a second device as in the first aspect, the second aspect, the third aspect and any possible design thereof.

[0027] In a sixth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device including a display screen and a memory; the chip system includes one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through a line; the interface circuit is used to receive a signal from the memory of the electronic device and send the signal to the processor, and the signal includes a computer instruction stored in the memory. Wherein, the electronic device is a first device, and when the processor executes the computer instruction, the electronic device executes the steps executed by the first device in the first aspect, the second aspect, the third aspect, and any possible design thereof. Alternatively, the electronic device is a second device, and when the processor executes the computer instruction, the electronic device executes the steps executed by the second device in the first aspect, the second aspect, the third aspect, and any possible design thereof.

[0028] In a seventh aspect, the present application provides a computer storage medium, which includes computer instructions. Wherein, when the computer instructions are executed on a first device, the first device is caused to execute the steps executed by the first device in the first aspect, the second aspect, the third aspect, and any possible design thereof. Alternatively, when the computer instructions are executed on a second device, the second device is caused to execute the steps executed by the second device in the first aspect, the second aspect, the third aspect, and any possible design thereof.

[0029] In an eighth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the method described in the first aspect and any possible design thereof.

[0030] It can be understood that the beneficial effects that can be achieved by the above-mentioned electronic device, communication system, chip system, computer storage medium, and computer program product can refer to the beneficial effects in the first aspect, the second aspect, the third aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1A A schematic diagram of a PIR provided in an embodiment of the present application;

[0032] Figure 1B A schematic diagram of a PSI provided in an embodiment of the present application;

[0033] Figure 2 A diagram of a communication system provided in an embodiment of the present application;

[0034] Figure 3 A schematic diagram of a scenario applicable to an embodiment of the present application;

[0035] Figure 4 One of the flowcharts of the query method provided in the embodiment of the present application;

[0036] Figure 5 A hardware structure diagram of an electronic device provided in an embodiment of the present application;

[0037] Figure 6 A diagram showing the phase structure of a query method provided in an embodiment of the present application;

[0038] Figure 7 A flowchart of stage 1 of the query method provided in an embodiment of the present application;

[0039] Figure 8 A flowchart of stage 2 of the query method provided in an embodiment of the present application;

[0040] Fig. 9 One of the flowcharts of stage 3 in the query method provided in the embodiment of the present application;

[0041] Fig.10 One of the principle diagrams of the query method provided in the embodiment of the present application;

[0042] Fig.11 One of the flowcharts of stage 4 in the query method provided in the embodiment of the present application;

[0043] Fig.12 The second flowchart of stage 4 in the query method provided in the embodiment of the present application;

[0044] Fig.13 The second flowchart of stage 3 of the query method provided in the embodiment of the present application;

[0045] Fig.14 The third flowchart of stage 4 in the query method provided in the embodiment of the present application;

[0046] Fig.15 The second flowchart of the query method provided in the embodiment of the present application;

[0047] Fig.16 The second schematic diagram of the query method provided in the embodiment of the present application;

[0048] Fig.17 A structural diagram of the chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "a kind of", "", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0050] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.

[0051] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.

[0052] Before describing the embodiments of the present application, a brief introduction to the technical terms involved in the present application is given:

[0053] 1. Condition-value query.

[0054] Condition-result query is to send the condition to be queried to the queried end and obtain the value corresponding to the condition. For example, the condition is recorded as id, and the value corresponding to the condition is recorded as payload. The queried end can record the "condition-value" list shown in Table 1 below:

[0055] Table 1

[0056] condition(id) Value(payload) id-1 payload-1 id-2 Payload-2 id-3 Payload-3 ……

[0057] Then, the query end sends any condition in Table 1 above, such as id-2, to the queried end, and the value corresponding to the condition, such as payload-2, can be queried.

[0058] The query method provided in the embodiment of the present application is applied in the scenario of condition-value query.

[0059] 2. Anonymous query.

[0060] Anonymous query is also called Private Information Retrieval (PIR). PIR is a Secure Multi Party Computation (SMPC) technology. With PIR, in the above condition-value query process, the query can be completed without obtaining the condition and the value corresponding to the condition. In this way, when the condition and / or the value corresponding to the condition involves privacy, it will not be disclosed to the queried end.

[0061] The query requester is Figure 1A The mobile phone shown is the one being queried. Figure 1A Taking the cloud shown in FIG. 1 as an example, the cloud includes a condition-value table as shown in Table 1A above. With PIR, after the mobile phone sends a query request to the cloud to query the value corresponding to a condition, the cloud can return a query response to the mobile phone so that the mobile phone can obtain the value corresponding to the condition. However, in this process, the cloud cannot obtain the condition and the value corresponding to the condition.

[0062] In the embodiment of the present application, PIR is used to protect the privacy in the condition-value query process.

[0063] 3. Private Set Intersection (PSI).

[0064] PSI is a secure multi-party computing (SMPC) technology. With PSI, the intersection of the data held by both parties (such as the query requester and the queried party) can be obtained without leaking data other than the intersection of the data held by both parties, thus achieving privacy protection.

[0065] The query requester is Figure 1B The mobile phone shown is the one being queried. Figure 1B Taking the cloud shown in FIG. 1 as an example, using PSI, the mobile phone has data set A, the cloud has data set B, and the mobile phone sends a query request to the cloud to query the intersection A∩B of data set A and data set B. The cloud can return a query response to the mobile phone so that the mobile phone obtains the intersection A∩B. However, in this process, the mobile phone will not obtain data in data set B other than A∩B, and the cloud will not obtain data set A.

[0066] In the embodiment of the present application, based on PIR and combined with PSI, it is possible to further ensure that the conditions of the queried end other than the conditions carried by the query request will not be leaked to the query request end during the condition-value query process. For example, the condition carried by the query request is the above-mentioned data set A, and the condition in the queried end is the above-mentioned data set B.

[0067] 4. PSI encryption algorithm.

[0068] The PSI encryption algorithm refers to an algorithm that supports data encryption in a scheme using PSI. Exemplarily, the PSI encryption algorithm includes the Diffie-Hellman (DH) algorithm, the Elliptic Curve Diffie-Hellman (ECDH / ECC) algorithm, the Leonard Adleman-Ron Rivest-Adi Shamir (RSA) blind signature algorithm, the Oblivious Transfer (OT) algorithm, etc. In this article, the DH algorithm and the ECDH algorithm are mainly used to illustrate the present application scheme.

[0069] Among them, the DH protocol and the ECDH protocol are both interchangeable encryption protocols. Interchangeable encryption algorithms are algorithms whose encryption and decryption order can be swapped.

[0070] For example, a commutative encryption algorithm is used to encrypt data x using key a to obtain ciphertext x a , use key b to ciphertext x a Further encryption to obtain the ciphertext x ab Using the exchangeable encryption algorithm, use the key b to encrypt the data y and get the ciphertext y b , use key a to ciphertext y b Further encryption to obtain the ciphertext y ba If data x and data y are equal, then the above ciphertext x ab With the ciphertext x baThat is, for the same data, if an interchangeable encryption algorithm is used, the same ciphertext can be obtained by exchanging the encryption order (referred to as Principle 1). In PSI, this Principle 1 can be used to achieve privacy protection.

[0071] Furthermore, for the above ciphertext x ab , first use key a to decrypt and get the ciphertext x b , if data x and data y are equal, then the ciphertext x b is equal to the ciphertext obtained by encrypting data y using key b, that is, ciphertext y b Then, for data x, after double encryption using the commutative encryption algorithm (that is, first encrypt with key a, then encrypt with key b), and then decrypt with key a, we can get the ciphertext x obtained by encrypting data x with key b. b , if the ciphertext x b The ciphertext y obtained by encrypting data y with key b b If they are equal, it can be determined that data x and data y are equal (referred to as Principle 2). In PSI, Principle 2 can also be used to implement privacy protection to reduce query latency.

[0072] It should be noted that, unless otherwise stated below, encryption / decryption in PSI is implemented using an interchangeable encryption algorithm.

[0073] The present application embodiment provides a query method, which can be applied to the communication system provided in the present application embodiment. Figure 2 , the communication system may include a first device (such as Figure 2 The mobile phone 210 shown in FIG. 2 and the second device (such as Figure 2 The first device is a device having a query requirement, and the second device is a device providing a query service.

[0074] The first device and the second device are connected in communication for data interaction during the transmission query process. For example, the first device sends a query request to the second device, and the second device returns a query response to the first device. Exemplarily, a wired connection can be established between the first device and the second device using a universal serial bus (USB). Alternatively, a wireless connection can be established between the first device and the second device through a global system for mobile communications (GSM), a general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), Bluetooth, wireless fidelity (Wi-Fi), NFC, voice over Internet protocol (VoIP), and a communication protocol that supports a network slicing architecture.

[0075] The first device may be a mobile phone, tablet computer, desktop, laptop, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital assistant (PDA), augmented reality (AR)\virtual reality (VR) device and other devices with query needs. The second device may be a cloud, server, personal computer (PC) and other devices that can provide query services. The embodiments of the present application do not impose any special restrictions on the specific forms of the first device and the second device.

[0076] Exemplarily, the first device can be any end of a business to consumer (B2C) mode, a consumer to consumer (C2C) mode, or a business to business (B2B) mode, and the second device can be the other end of a B2C mode, a C2C mode, or a B2B mode. It should be understood that compared with the B-end device: the communication resources (such as traffic) of the C-end device are limited. If the communication overhead increases to a certain extent, it may be difficult for the user to accept. Then, if the first device is a C-end device in the above-mentioned B2C mode, C2C mode, or B2B mode, the query method provided in the embodiment of the present application can be used to more significantly reduce the communication overhead.

[0077] Hereinafter, the first device is Figure 3 As shown in mobile phone 210, the second device is Figure 3 Cloud 220 is shown as an example.

[0078] The query method provided in the embodiment of the present application can be applied to scenarios where the mobile phone 210 performs condition-value query on the cloud 220 and the query process involves privacy information (hereinafter referred to as privacy query scenario) to achieve privacy protection. Several typical scenarios are listed below.

[0079] Scenario 1: Business function discovery scenario. That is, discovering the business functions activated by friends in the target application.

[0080] The target application may be any application installed in the mobile phone 210, and the service function includes one or more functions supported by the target application. In the following, the target application is a social application A, and the service functions include a video call function, a voice call function, a text message sending and receiving function, and a file transfer function.

[0081] When the mobile phone 210 installs and runs the social application A for the first time, it can display Figure 3 Interface 301 is shown. Interface 301 includes a prompt text "Do you allow to find contacts in the address book?" to prompt the user to find out whether the contacts in the address book have accounts registered in the social application. In addition, interface 301 also includes two options "Yes" and "No". In response to the user's selection of the "Yes" option in interface 301, mobile phone 210 can send a query request to find contacts in the address book to cloud 220 to query whether each contact in the address book has an account registered in social application A. After the query is completed, mobile phone 210 can display Figure 3Interface 302 is shown. Interface 302 includes contacts who have registered accounts in social application A, such as Tom, Alice, etc. Of course, interface 302 may also include information such as accounts of these contacts in social application A (such as I love eating fish, Happy every day, etc.), avatars, etc.

[0082] In the process of running social application A for a non-first time, in response to an operation of discovering address book friends (such as the user clicking a button for discovering address book friends in the settings of social application A), mobile phone 210 may also send a query request for discovering address book friends to cloud 220, and display the query results after obtaining them, which will not be elaborated here.

[0083] After the mobile phone 210 finds the contacts (referred to as target contacts) who have registered accounts in the social application A, it can further find the service functions activated by these target contacts in the social application A. The mobile phone 210 can send a query request for discovering service functions to the cloud 220 to query the service functions activated by the target contacts in the social application A. After the query is completed, the mobile phone 210 can display Figure 3 Interface 303 is shown. Interface 303 includes the service functions activated by the target contact in social application A. For example, the service functions activated by the target contact Tom include video call function, voice call function and SMS sending function, and the service functions activated by the target contact Alice include voice call function, SMS sending function and file sending and receiving function.

[0084] In the above scenario 1, the query request for the service function sent by the mobile phone 210 to the cloud 220 usually needs to carry the number of the target contact (referred to as the contact number). At the same time, the cloud 220 records the correspondence between the number of the registered user (referred to as the registration number) and the service functions activated by the registered user. In this way, by comparing the contact number with the registration number recorded in the cloud 220, the service function activated by the target contact in the social application A can be found.

[0085] The above scenario 1 satisfies the condition-value query, where the condition is the contact number and the value is the business function. Also, the mobile phone 210 does not want the cloud 220 to obtain the contact number and the queried business function, which meets the applicable scenario of PIR. Moreover, the cloud 220 hopes that the mobile phone 210 can only obtain the data of the intersection of the contact number and the registration number, and does not want the mobile phone 210 to obtain data other than the intersection of the contact number and the registration number, which meets the applicable scenario of SPI.

[0086] In scenario 1, the query method provided in the embodiment of the present application, combined with PIR and PSI, can prevent the cloud 220 from obtaining the contact number and the queried service function while discovering the service function activated by the target contact, and prevent the mobile phone 210 from obtaining data other than the intersection of the contact number and the registration number in the cloud 220. In addition, the query efficiency can be improved.

[0087] Scenario 2: disease retrieval, that is, querying the treatment plan for a disease.

[0088] After detecting the user's operation of searching for a treatment plan for a certain disease, the mobile phone 210 can send a query request for the treatment plan to the cloud 220 to query the treatment plan for the disease. After the query is completed, the mobile phone 210 can display the treatment plan.

[0089] In the above scenario 2, the query request for treatment plan sent by mobile phone 210 to cloud 220 usually requires the name of the disease. At the same time, the correspondence between the disease name and the treatment plan is recorded in cloud 220. In this way, the treatment plan corresponding to the disease name can be found by comparing the disease name.

[0090] The above scenario 2 satisfies the condition-value query, where the condition is the disease name and the value is the treatment plan. Also, the mobile phone 210 does not want the cloud 220 to obtain the disease name and the queried treatment plan, which meets the applicable scenario of PIR. Moreover, the cloud 220 hopes that the mobile phone 210 can only obtain the data of the queried disease name, and does not want the mobile phone 210 to obtain other disease names and their treatment plans stored in the cloud 220, which meets the applicable scenario of SPI.

[0091] In scenario 2, the query method provided by the embodiment of the present application is used in combination with PIR and PSI to find the treatment plan for the queried disease while preventing the cloud 220 from obtaining the queried disease name and the queried treatment plan, and preventing the mobile phone 210 from obtaining data other than the queried disease name in the cloud 220. In addition, the query efficiency can be improved.

[0092] For the above privacy query scenario, PIR can be used to solve it. However, the existing mainstream PIR solutions, such as OT-based PIR, homomorphic encryption-based PIR, or keyword-based PIR, are relatively complex and difficult to apply to mobile terminals such as mobile phones and tablets where the first device has limited computing power and communication resources. Specifically, the technologies and shortcomings of the various existing mainstream PIR solutions are shown in Table 2 below:

[0093] Table 2

[0094]

[0095] As shown in the third column of Table 2 above, in the mainstream PIR solution, the relationship between the communication overhead between the mobile phone 210 and the cloud 220 (denoted as O1) and the number of data sets in the cloud 220 (denoted as n, such as the number of registration numbers and business function items, disease names and treatment plans) is as follows:

[0096] The communication overhead O1 in the OT-based PIR includes the communication overhead O1(n) of public key distribution and the communication overhead O1(n) of ciphertext transmission after private key decryption. Public key distribution means that the cloud 220 distributes n public keys corresponding to n data in the data set to the mobile phone 210. Ciphertext transmission after private key decryption means that the cloud 220 uses the n private keys corresponding to the n data to decrypt and transmits n decrypted ciphertexts to the mobile phone 210.

[0097] The communication overhead O1 in both homomorphic encryption-based PIR and keyword-based PIR includes the communication overhead O1(n) of homomorphic ciphertext transmission. Homomorphic ciphertext transmission means that the mobile phone 210 transmits n ciphertexts corresponding to n pieces of data obtained by homomorphic encryption to the cloud 220.

[0098] Obviously, in the mainstream PIR schemes shown in Table 2, the communication overhead O1 between the mobile phone 210 and the cloud 220 is strongly related to n. The larger n is, the larger the communication overhead O1 is. However, the network resources of the mobile phone 210 are very limited. When the communication overhead O1 increases to a certain extent, it may be difficult for users to accept it.

[0099] And, as shown in the fourth column of Table 2 above, in the mainstream PIR solution, the relationship between the computational overhead O2 in the mobile phone 210 and n is as follows:

[0100] The computational overhead O2 in the OT-based PIR includes the computational overhead O2(m) of public key encryption and the computational overhead O2(n) of symmetric decryption. Public key encryption means that the mobile phone 210 uses m of the n public keys sent by the cloud 220 to encrypt m conditions to be queried (such as contact number, disease name). Symmetric decryption means that the mobile phone 210 decrypts the n decrypted ciphertexts sent by the cloud 220 respectively.

[0101] The computational overhead O2 in the homomorphic encryption-based PIR and the keyword-based PIR both includes the computational overhead O2(n) of the homomorphic ciphertext. Homomorphic encryption means that the mobile phone 210 obtains n ciphertexts corresponding to n pieces of data through homomorphic encryption.

[0102] Obviously, in the mainstream PIR schemes shown in Table 2, the computational overhead O2 of the mobile phone 210 is strongly related to n. The larger n is, the larger the computational overhead O2 is. However, the computational resources of the mobile phone 210 are very limited. When the computational overhead O2 increases to a certain extent, the query delay may be seriously increased, affecting the real-time performance of the query.

[0103] Based on the above problems, the embodiment of the present application provides a query method, which can be applied to a communication system including a mobile phone 210 and a cloud 220. The method adopts a combination of PIR and PSI to implement condition-value query. Figure 4 , the query method provided in the embodiment of the present application includes:

[0104] S401. In response to a query event, the mobile phone 210 sends a query request to the cloud 220, and the query request includes the first ciphertext of the query condition x. The first ciphertext is obtained by encrypting the query condition using the key a by the mobile phone 210. Exemplarily, in scenario 1, the query event may be an event in which a target contact is found; in scenario 2, the query event may be an event in which a user enters a disease name in a search engine. In this way, it can be ensured that the query condition will not be directly exposed to the cloud 220.

[0105] S402. In response to the query request, the cloud 220 encrypts the first ciphertext using the key b to obtain a second ciphertext.

[0106] S403, cloud 220 sends a query response to mobile phone 210, the query response includes the second ciphertext and the third ciphertext of the target condition and the fourth ciphertext of the target value (also called result information) associated with the target condition (also called matching condition). Among them, the target condition is a condition in cloud 220 that may be the same as the condition to be queried. The third ciphertext is obtained by cloud 220 encrypting the target condition using key b, and the fourth ciphertext is obtained by cloud 220 encrypting the target value using information (feature information) of the target condition. In this way, cloud 220 only needs to send information about the target condition that may be the same as the condition to be queried and its corresponding target value to mobile phone 210, without sending all conditions and their corresponding values ​​in the condition-value correspondence relationship, which reduces the amount of data sent by cloud 220 to mobile phone 210 and saves the communication overhead of mobile phone 210. In addition, both the target condition and the target value are sent to mobile phone 210 in the form of ciphertext and will not be directly exposed to mobile phone 210.

[0107] S404. In response to the query response, the mobile phone 210 obtains the target value corresponding to the first condition. The first condition is the condition in the target condition that is the same as the condition to be queried. Since the cloud 220 uses the information of the target condition to encrypt the target value in S403, after obtaining the first condition, the mobile phone 210 can naturally use the information of the first condition to decrypt the corresponding target value, that is, obtain the query result, without further obtaining the query result through communication between the mobile phone 210 and the cloud 220, which can reduce the number of communications between the mobile phone 210 and the cloud 220, and further save the communication overhead of the mobile phone 210.

[0108] In addition, since the cloud 220 sends information about target conditions and their corresponding target values ​​that may be the same as the conditions to be queried, rather than all conditions and their corresponding values ​​in the condition-value correspondence, the mobile phone 210 does not need to calculate all conditions and their corresponding values ​​in the condition-value correspondence in response to the query response, thereby saving computing overhead.

[0109] It should be understood that the mobile phone 210 only obtains the first condition that is the same as the condition to be queried and the target value corresponding to the first condition, but cannot obtain other conditions in the target condition, nor can it obtain the target values ​​corresponding to other conditions, thereby achieving the greatest extent possible for protecting the data sent from the cloud 220.

[0110] In summary, by using the embodiments of the present application, privacy protection can be achieved during the condition-value query process while also saving the communication overhead of the mobile phone 210.

[0111] It should be noted that the above Figure 4 In the scheme, the cloud 220 returns to the mobile phone 210 a third ciphertext of the target condition that may be the same as the condition to be queried and a fourth ciphertext of the target value corresponding to the target condition. In practice, the cloud 220 may also return to the mobile phone 210 the third ciphertext of all conditions in the condition-value correspondence relationship and the fourth ciphertext of the value corresponding to each condition. In this way, the process of the cloud 220 searching for the target condition and the target value can be omitted. However, the characteristic information of the condition should also be used to encrypt the value corresponding to the condition to ensure that the first device and the second device only need one round-trip communication, and the first device can obtain the query result through simple matching and decryption operations. In this way, the condition-value query process can also be simplified, the query delay can be reduced, and the query efficiency can be improved.

[0112] The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings. Figure 5 The hardware structure diagram of an electronic device (such as a first device and a second device) provided in an embodiment of the present application. Taking the electronic device as a mobile phone 210 as an example, Figure 5As shown, the electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0113] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0114] The processor 110 can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0115] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of an electronic device. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

[0116] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0117] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.

[0118] The electronic device can realize the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0119] The electronic device can realize the camera function through the camera module 193, ISP, video codec, GPU, display screen 194, application processor AP, neural network processor NPU, etc.

[0120] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The internal memory 121 can be used to store computer executable program code, which includes instructions. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device (such as audio data, a phone book, etc.), etc.

[0121] The electronic device can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0122] The key 190 may include a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device may receive key input and generate key signal input related to user settings and function control of the electronic device.

[0123] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. Indicator 192 can be an indicator light, which can be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0124] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device by inserting the SIM card interface 195 or pulling the SIM card out of the SIM card interface 195.

[0125] It should be noted that the above Figure 5 The hardware structure of the electronic device shown is only exemplary. In practice, the electronic device may have more Figure 5 More or less structures. Taking the electronic device as cloud 220 as an example, the electronic device may mainly include a processor and a memory.

[0126] The query method provided in the embodiment of the present application can be implemented in a communication system composed of a first device and a second device having the above hardware structure. The following still takes the first device as a mobile phone 210 and the second device as a cloud 220 as an example, and combines the above scenario 1 to explain the embodiment of the present application in detail.

[0127] In scenario 1, the condition to be queried is the contact number. In the condition-value correspondence in cloud 220 (as shown in Table 1 above), if the condition is the registration number, then the target condition is also the registration number (the registration number used as the target condition may be referred to as the target number). If the value is information indicating the service function activated by the registration number (referred to as service function information), then the target value is also the service function information (the service function information used as the target value may be referred to as the target function information).

[0128] In the embodiment of the present application, the form of the service function information is not specifically limited. Taking the service functions including the video call function, the voice call function, the SMS sending function and the file transfer function as an example, the service function information can be a text description, such as the service function information is "video call function: enabled; voice call function: enabled; SMS sending function: enabled; file transfer function: not enabled", indicating that the video call function, the voice call function and the SMS sending function are all enabled, while the file transfer function is not enabled. Alternatively, the service function information can be a sequence of strings, and each character of the string represents the activation status of the corresponding service function. For example, the four characters of the string represent the activation status of the video call function, the voice call function, the SMS sending function and the file transfer function from front to back, and the character "1" indicates activation, and the character "0" indicates not activation. Then, the corresponding relationship table between the registration number and the service function information shown in Table 3 below can be recorded in the cloud 220:

[0129] Table 3

[0130]

[0131] Taking the service capability information "1011" corresponding to number y2 as an example, it indicates that the video call function, SMS sending function and file transfer function are all activated, but the voice call function is not activated.

[0132] See also Figure 6 The query method provided in the embodiment of the present application includes the following four stages:

[0133] Phase 1, cloud 220 data initialization phase.

[0134] In stage 1, cloud 220 uses key b to encrypt multiple (eg, n, n≥1, n is an integer) registration numbers in its registration number-business function information to obtain n ciphertexts 1, which correspond one-to-one to the n registration numbers.

[0135] In stage 1, cloud 220 uses the information of the registration number to encrypt the service capability information corresponding to the registration number, and obtains n ciphertexts 2, and the n ciphertexts 2 correspond to the n service capability information one by one. Among them, the information of the registration number can be any information that can be determined after the registration number is determined. In this way, later (such as in stage 4), after the mobile phone 210 determines the specific value of the registration number (such as the target number), it can use the information of the registration number (such as the target number) to decrypt the service capability information (such as the target capability information).

[0136] After encrypting the registration number and its service capability information, Cloud 220 can send the target number and target function information in ciphertext to avoid privacy leakage.

[0137] In some embodiments, the cloud 220 can complete phase 1 offline to avoid initialization operations during the query process and reduce query latency.

[0138] Phase 2, mobile phone 210 request phase.

[0139] In stage 2, in response to the query event, the mobile phone 210 may use key a to encrypt one or more (e.g., m, m≥1, m is an integer) contact numbers to obtain ciphertext 3 (i.e., the first ciphertext), and send a query request to the cloud 220, the query request carrying ciphertext 3. Exemplarily, in stage 2, the mobile phone 210 may complete the above step S401.

[0140] Phase 3, cloud 220 query response phase.

[0141] In stage 3, cloud 220 may respond to the query request from mobile phone 210 and return a query response to mobile phone 210. Exemplarily, in stage 3, cloud 220 may complete the above steps S402 and S403.

[0142] As shown in S403 above, the query response includes a third ciphertext and a fourth ciphertext. The third ciphertext is the ciphertext 1 of the target number that may be the same as the contact number. The fourth ciphertext is the ciphertext 2 of the target function information corresponding to the target number. Then, in stage 3, cloud 220 needs to determine the third ciphertext and the fourth ciphertext. Based on this, in stage 1, for any registered number, cloud 220 can also establish the hash value feature of the registered number (such as recorded as hash value feature 1) and the corresponding relationship between ciphertext 1 and ciphertext 2 (such as recorded as corresponding relationship 1). And, in stage 2, for any contact number, mobile phone 210 can also establish the hash value feature of the contact number (such as recorded as hash value feature 2) and the corresponding relationship between ciphertext 3 (such as recorded as corresponding relationship 2). In this way, in stage 3, cloud 220 can determine the ciphertext 1 corresponding to the hash value feature 1 equal to the hash value feature 2 as the third ciphertext, and determine the ciphertext 2 corresponding to the hash value feature 1 equal to the hash value feature 2 as the fourth ciphertext. That is, if the hash value characteristics of the contact number and the registration number are the same, then the contact number and the registration number may be the same.

[0143] Stage 4, mobile phone 210 comparison stage.

[0144] In stage 4, the mobile phone 210 compares the query response sent by the cloud 220 to obtain the target function information, thereby obtaining the query result. Exemplarily, in stage 4, the mobile phone 210 can complete the above S404.

[0145] The specific implementation of the above-mentioned stages 1 to 4 is described in detail below.

[0146] Combined with the corresponding relationship between registration number and service function information shown in Table 3 above, see Figure 7 In phase 1, cloud 220 can complete the following steps to encrypt the registration number and business function information, and establish the corresponding relationship 1.

[0147] S701. The cloud 220 calculates hash values ​​for n registration numbers respectively to obtain n hash values.

[0148] The cloud 220 may calculate the hash value of each registration number using a hash algorithm (HA), such as Message-Digest Algoorithm 4 (MD4), Message-Digest Algoorithm 5 (MD5), Secure Hash Algorithm 256 (SHA-256), and the like.

[0149] For example, the cloud 220 calculates the hash values ​​of number y1, number y2, number y3, etc. respectively, and can obtain the hash values ​​0002E11A0C0E...51A1518, 000341AA6176...C300081, 000C497DE639...4BB1298...

[0150] S702. Cloud 220 encrypts the n registration numbers using key b respectively to obtain n ciphertexts 1.

[0151] In a specific implementation, the cloud 220 may encrypt the number values ​​of the n registration numbers themselves to encrypt the n registration numbers. Figure 7 This implementation is not shown in the figure. For example, the cloud 220 can encrypt the registration number itself. It should be noted that if this implementation is adopted, there is no strict order restriction between S701 and S702, and S701 and S702 only need to be completed before S704.

[0152] In another specific implementation, the cloud 220 may encrypt n hash values ​​corresponding to the n registration numbers to encrypt the n registration numbers. Figure 7 This is the implementation shown. For example, the cloud 220 can encrypt the hash values ​​of the registration numbers 0002E11A0C0E…51A1518, 000341AA6176…C300081, 000C497DE639…4BB1298 respectively to obtain the ciphertext y1 b ,y2 b ,y3 b .

[0153] S703. Cloud 220 encrypts the n business function information corresponding to the n registration numbers using the information of the registration numbers corresponding to the business function information, and obtains n ciphertexts 2.

[0154] That is, the encryption key is the registration number information, and the encrypted object is the business function information.

[0155] Among them, the information of the registration number can be any information that can be obtained when the registration number is known. In a specific implementation, the information of the registration number can be the number value of the registration number itself or the reverse value of the number value of the registration number. When the registration number is known, the number value itself or the reverse value can naturally be obtained. In a specific implementation, the information of the registration number can be the value of some bits (the first bit) or all bits of the hash value of the registration number. When the registration number is known, the hash value can naturally be calculated to obtain the value of its bits or all bits. The following mainly takes the example that the information of the registration number is the value of some bits (such as the last k1 bits) in the hash value of the registration number. k1≥2, k1 is an integer.

[0156] Taking k1=16 as an example, number y1 corresponds to the service function information "1110", cloud 220 can use the value "1518" of the last 16 bits in the hash value of number y1 to encrypt "1110" to obtain ciphertext z1; number y2 corresponds to the service function information "1011", cloud 220 can use the value "0081" of the last 16 bits in the hash value of number y2 to encrypt "1011" to obtain ciphertext z2; number y3 corresponds to the service function information "1101", cloud 220 can use the value "1298" of the last 16 bits in the hash value of number y3 to encrypt "1101" to obtain ciphertext z3...

[0157] In the embodiment of the present application, the encryption algorithm for the service function information is not specifically limited. For example, the encryption algorithm for the service function information can be AES encryption, XOR encryption, etc. Taking XOR encryption as an example, the ciphertext z1 obtained by encrypting "1110" using the binary representation of "1518" "0001 0101 0001 1000" is The ciphertext z2 obtained by encrypting "1011" using the binary representation of "0081" "1000 0001" is The ciphertext z3 obtained by encrypting "1101" using the binary representation of "1298" "0001 0010 1001 1000" is:

[0158] It should be noted that the encryption algorithm for the service function information is a symmetric encryption algorithm. In this way, after the mobile phone 210 determines the registration number (such as the target number), it can construct the information of the registration number (such as the target number) and decrypt it to obtain the service function information (such as the target function information) corresponding to the registration number.

[0159] In the description of S703, the business function information is represented by a binary string. In practice, the business function information may not be represented by a binary string. In this case, in order to facilitate encryption operations, before encrypting the business function information, the cloud 220 may first convert the business function information into a binary representation, obtain a binary representation result, and then encrypt the binary representation result using algorithms such as AES encryption and XOR encryption.

[0160] S704. Cloud 220 establishes a corresponding relationship 1 between hash value feature 1 and ciphertext 1 of each registration number, and ciphertext 2 of the business function information corresponding to the registration number.

[0161] The hash value feature 1 of the registration number may be the value of the first k2 bits, the middle k2 bits, or the last k2 bits (collectively referred to as the third bits) in the hash value of the registration number. k2≥2, k2 is an integer. The following mainly uses the first k2 bits as an example for explanation.

[0162] Taking k2=16 as an example, the hash values ​​of number y1, number y2, and number y3 are 0002E11A0C0E…51A1518, 000341AA6176…C300081, 000C497DE639…4BB1298 respectively, then the hash value feature 1 of number y1, number y2, and number y3 are 0002, 0003, and 000C respectively.

[0163] For the sake of convenience, ciphertext 1 and ciphertext 2 corresponding to the same hash value feature 1 may be referred to as a ciphertext set.

[0164] In some embodiments, before S704, cloud 220 may represent different buckets according to possible values ​​of the first k2 bits. For example, k2=16, that is, different buckets are represented according to possible values ​​of the first 16 bits, and buckets 0x 0000, 0x 0001, ..., 0x ffff may be obtained. 0x represents hexadecimal. It should be understood that 0x will be omitted in the following text and figures for simplicity.

[0165] For any registration number (such as number yj), after the previous S701, the hash value of number yj is processed; and after the previous S702, the ciphertext 1 of number yj is processed. In S703, the ciphertext 2 of the business function information corresponding to number yj is processed. Then, in S704, cloud 220 can divide the ciphertext 1 of number yj and the ciphertext 2 of the business function information corresponding to number yj into the bucket represented by the hash value feature 1 of number yj. Thus, the corresponding relationship 1 between the hash value feature 1 of number yj and the ciphertext 1, and the ciphertext 2 of the business function information corresponding to number yj is established.

[0166] Taking k2=16 as an example, the hash value feature 1 of number y1 is 0002, and the ciphertext 1 is y1 b , the ciphertext 2 of the service function information "1110" corresponding to number y1 is z1, then y1 can be b and z1 as a set of data divided into bucket 0002; the hash value feature 1 of number y2 is 0003, and the ciphertext 1 is y2 b , the ciphertext 2 of the service function information corresponding to number y2 is z2, then y2 b and z2 as a group of data are divided into bucket 0003; the hash value feature 1 of number y3 is 000C, and the ciphertext 1 is y3 b , the ciphertext 2 of the service function information corresponding to number y3 is z3, then y3 can be b and z3 are divided into bucket 000C as a set of data. Thus, the corresponding relationship 1 shown in Table 4 can be obtained:

[0167] Table 4

[0168]

[0169] At this point, cloud 220 can determine the correspondence 1 between hash value feature 1, ciphertext 1, and ciphertext 3 of the n registration numbers to facilitate determining the third ciphertext and the fourth ciphertext in stage 3.

[0170] It should be noted that in the corresponding relationship 1 shown in Table 4 above, the bucket represented by the same hash value feature 1 only corresponds to a set of ciphertext 1 and ciphertext 2. For example, the hash value feature 1 "0002" only corresponds to y1 b In practice, the hash value feature 1 of several registration numbers may be the same, that is, the ciphertext 1 and ciphertext 2 of several registration numbers may correspond to the bucket represented by the same hash value feature 1. For example, the corresponding relationship 1 is shown in Table 5 below:

[0171] Table 5

[0172]

[0173] In Table 5 above, the bucket represented by hash value feature 1 “0002” is the same as y1 b and z1, y5 b and z5, y7 b and z7, y8 b There are 4 groups of ciphertext 1 and ciphertext 2 corresponding to z8. Hash value feature 1 "0003" and y2 b and z2, y4 b There are two groups of ciphertext 1 and ciphertext 2 corresponding to z4. Hash value feature 1 "000C" corresponds to y3 b and z3, y6 b There are 2 groups of ciphertext 1 and ciphertext 2 corresponding to z6.

[0174] Take the contact numbers in the mobile phone 210 as an example, see Figure 8 ,In stage 2, the mobile phone 210 can complete the following steps to encrypt the registration number, establish the corresponding relationship 2, and send a query request.

[0175] Table 6

[0176] Contact Number Number x1 Number x2

[0177] S801. In response to a query event, the mobile phone 210 calculates hash values ​​for m contact numbers respectively to obtain m hash values.

[0178] Exemplarily, hash values ​​are calculated for number x1 and number x2, respectively, to obtain hash values ​​0002936ED794...8921B4B and 0002E11A0C0E...51A1518.

[0179] For the specific implementation of S801, please refer to the relevant description of S701 above, which will not be repeated here. It should be noted that in order to make the hash value of the contact number and the hash value of the registration number comparable, in S801, the hash algorithm used by the mobile phone 210 is the same as the hash algorithm used by the cloud 220 in S701 above. Furthermore, in order to quickly obtain the query result after receiving the query event, both the cloud 220 and the mobile phone 210 can use a hash algorithm with a faster computing speed to calculate the hash value, such as MD5, SHA256, etc.

[0180] S802. Mobile phone 210 encrypts m contact numbers using key a to obtain m ciphertexts 3.

[0181] Similar to the above S702: In a specific implementation, the mobile phone 210 can encrypt the m contact numbers themselves to achieve encryption of the m contact numbers. Figure 8This implementation is not shown. For example, the mobile phone 210 can encrypt the number x1 itself. It should be noted that if this implementation is adopted, there is no strict order restriction between S801 and S802, and S801 and S802 only need to be completed before S803. In another specific implementation, the mobile phone 210 can also encrypt the m hash values ​​corresponding to the m contact numbers to encrypt the m contact numbers. Figure 8 This is the implementation method shown. For example, the mobile phone 210 can encrypt the hash value 0002936ED794…8921B4B of the number x1 to obtain the ciphertext x1 a ; and encrypt the hash value 0002E11A0C0E…51A1518 of number x2 to obtain ciphertext x2 a .

[0182] It should be noted that, in order to ensure the comparability of the ciphertext 1 of the n registration numbers in the cloud 220 and the ciphertext 3 of the m contact numbers in the mobile phone 210, if the registration number itself is encrypted in S702, the contact number itself should also be encrypted in S802. If the hash value of the registration number is encrypted in S702, the hash value of the contact number should also be encrypted in S802.

[0183] S803. The mobile phone 210 establishes a corresponding relationship 2 between the hash value feature 2 and the ciphertext 3 of each contact number.

[0184] Similar to the hash value feature 1 of the registration number mentioned above: the hash value feature 2 of the contact number can be the value of the first k2 bits, the middle k2 bits, or the last k2 bits of the hash value of the contact number.

[0185] Taking k2=16 as an example, the hash values ​​of number x1 and number x2 are 0002936ED794…8921B4B and 0002E11A0C0E…51A1518 respectively, then the hash value feature 2 of number x1 and number x2 is both 0002.

[0186] For any contact number (such as number xi), after processing S801 in the previous text, the hash value of number xi is obtained; and after processing S802 in the previous text, the ciphertext 3 of number xi (such as xi a Then, in S803, the mobile phone 210 can establish the hash value feature 2 and the ciphertext xi of the number xi. a The corresponding relationship of , we get the corresponding relationship 2.

[0187] Taking k2=16 as an example, the hash value feature 2 of number x1 is 0002, and the ciphertext 3 is x1 a; The hash value feature 2 of number x2 is 0002, and the ciphertext 3 is x2 a , we can get the corresponding relationship 2 shown in Table 7 below:

[0188] Table 7

[0189]

[0190] S804 . The mobile phone 210 sends a query request to the cloud 220 . The query request includes the corresponding relationship 2 .

[0191] Exemplarily, the mobile phone 210 may send a query request to the cloud 220 in a secure and encrypted manner, such as https, to ensure information security.

[0192] Combined with the corresponding relationship 1 shown in Table 5 and the corresponding relationship 2 shown in Table 7, see Fig. 9 In phase 3, the cloud 220 can complete the following steps to determine the third ciphertext and the fourth ciphertext, and return a query response including the third ciphertext and the fourth ciphertext to the mobile phone 210. The ciphertext 1 of all n registered numbers and the ciphertext 2 of the corresponding service function information will not be sent to the mobile phone 210, thereby saving communication overhead.

[0193] See also Fig. 9 In stage 3, cloud 220 may complete the following steps:

[0194] S901. Cloud 220 uses key b to re-encrypt m ciphertexts 3 in correspondence 2 to obtain m ciphertexts 4.

[0195] Exemplarily, the two ciphertexts 3 in the corresponding relationship 2 shown in Table 7 are encrypted twice to obtain the two ciphertexts 4 shown in Table 8 below:

[0196] Table 8

[0197] Ciphertext 4 <![CDATA[x1 ab ]]> <![CDATA[x2 ab ]]>

[0198] It should be understood that the m ciphertexts 4 correspond one-to-one to the m contact numbers.

[0199] S902: Cloud 220 sends a query response to mobile phone 210, the query response including: ciphertext 1 and ciphertext 2 corresponding to the target hash value feature in correspondence 1, and m ciphertexts 4. The target hash value feature is hash value feature 2 in correspondence 2.

[0200] For example, if the hash value feature 2 is "0002" in Table 7, then the target hash value feature is "0002". In Table 5, the ciphertext 1 and ciphertext 2 corresponding to the target hash value feature are shown in Table 9 below:

[0201] Table 9

[0202]

[0203]

[0204] It should be understood that the ciphertext 1 corresponding to the target hash value feature in the correspondence 1 is: the ciphertext 1 corresponding to the hash value feature 1 that is the same as the hash value feature 2 in the correspondence 1. That is, the third ciphertext of the registration number that may be the same as the contact number. And, the ciphertext 2 corresponding to the target hash value feature in the correspondence 1 is: the ciphertext 2 corresponding to the hash value feature 1 that is the same as the hash value feature 2 in the correspondence 1. That is, the fourth ciphertext of the business capability information corresponding to the registration number that may be the same as the contact number. It can be seen that through S902, the third ciphertext and the fourth ciphertext can be sent to the mobile phone 210.

[0205] The cloud 220 may also send the ciphertext 1 and ciphertext 2 corresponding to the target hash value feature in the correspondence 1, as well as m pieces of ciphertext 4 to the mobile phone 210 in a secure encryption manner, such as https, to ensure information security.

[0206] Obviously, in S902, only ciphertext 1 and ciphertext 2 of the target hash value feature in correspondence relationship 1 need to be sent, and there is no need to send n ciphertext 1 and ciphertext 2 corresponding to all n registered numbers. In this way, the amount of data sent by cloud 220 to mobile phone 210 can be reduced, reducing communication overhead.

[0207] At this point, it should be noted that different values ​​of k2 will reduce the communication overhead to different degrees. The larger the value of k2, the greater the degree of reduction in communication overhead. The following will explain in detail the impact of the value of k2 on communication overhead:

[0208] The larger the value of k2 is, the finer the bucketing is. Then, in stage 1, when the ciphertext 1 of the registration number in the cloud 220 and the corresponding ciphertext 2 are divided into buckets, the ciphertexts can be distributed into more buckets, making the ciphertext bucketing finer.

[0209] Exemplarily, the registration number and its hash value, ciphertext 1 and ciphertext 2 in cloud 220 are shown in Table 10 below:

[0210] Table 10

[0211] Registration Number Hash value Ciphertext 1 Ciphertext 2 Number y1 0002E11A0C0E…51A1518 <![CDATA[y1 b ]]> z1 Number y2 000341AA6176…C300081 <![CDATA[y2 b ]]> z2 Number y3 000C497DE639…4BB1298 <![CDATA[y3 b ]]> z3 Number y4 0002DF235902…D6B71BD <![CDATA[y4 b ]]> z4

[0212] Taking the data in Table 10 above as an example, see Fig.10 , the following compares the buckets to which the 4 registration numbers in Table 10 belong when k2=8 and k2=16:

[0213] When k2=8, buckets 00, 01, ... ff can be obtained, for a total of 256 buckets; and when k2=16, buckets 0000, 0001, ... ffff can be obtained, for a total of 65536 buckets. Obviously, compared with k2=8, when k2=16, more buckets can be obtained, and the buckets are more refined.

[0214] The first 8 bits of the 4 hash values ​​in Table 10 are all 00. In phase 1, if k2=8 buckets are used, the 4 groups of ciphertext 1 and ciphertext 2 in Table 10, i.e., y1 b and z1, y2 b and z2, y3 b and z3 and y4 b and z4 will be divided into bucket 00. That is, bucket 00 includes 4 ciphertexts. The first 16 bits of the 4 hash values ​​in Table 10 are 0002, 0003, 000C and 0002 respectively. In stage 1, if k2=16 buckets are used, the 4 groups of ciphertext 1 and ciphertext 2 in Table 10, i.e. y1 b and z1, y2 b and z2, y3 b and z3 and y4 b and z4 will be divided into bucket 0002, bucket 0003, bucket 000C and bucket 0002 in sequence. That is, 4 groups of ciphertext 1 and ciphertext 2 are dispersed into 3 buckets, of which bucket 0002 includes 2 groups of ciphertext 1 and ciphertext 2, bucket 0003 includes 1 group of ciphertext 1 and ciphertext 2, and bucket 000C includes 1 group of ciphertext 1 and ciphertext 2. Obviously, compared with k2=8: k2=16 can make the ciphertext bucketing more refined.

[0215] Accordingly, in stage 3, the ciphertext 1 and ciphertext 2 corresponding to the target hash value feature determined by cloud 220 are less. Fig.10 The contact numbers in the mobile phone 210 and their hash values ​​and ciphertext 3 are shown in Table 11 below:

[0216] Table 11

[0217]

[0218]

[0219] k2=8, then the hash value feature 2 of the hash value 0002936ED794…8921B4B in Table 11 is 00. Then, in stage 3, cloud 220 can determine that the target hash value feature is 00, and thus will convert ciphertext 1 and ciphertext 2 in bucket 00, such as y1 b and z1, y2 b and z2, y3 band z3 and y4 b and z4 are sent to mobile phone 210. k2=16, then the hash value feature 2 of the hash value 0002936ED794…8921B4B in Table 11 is 0002. Then, in stage 3, cloud 220 can determine that the target hash value feature is 0002, and thus will send ciphertext 1 and ciphertext 2 in bucket 0002, that is, y1 b and z1, and y4 b and z4 are sent to the mobile phone 210. Obviously, compared with k2=8, when k2=16, the ciphertext 1 and ciphertext 2 sent by the cloud 220 to the mobile phone 210 will be less, thereby reducing the communication overhead to a greater extent.

[0220] Therefore, in order to further reduce the communication overhead, k2 can be set to a larger value.

[0221] However, the larger the value of k2, the more bits of the hash value will be used to represent the bucket, that is, more bits in the hash value will be exposed. Correspondingly, the number of remaining unexposed bits will be smaller, and the degree of privacy protection will be lower.

[0222] Taking the example of a hash value with 128 bits in total, if k2=16, the first 16 bits of the hash value of the contact number will be sent to the cloud 220 as the hash value prefix feature 2 in the corresponding relationship 2, that is, exposed to the cloud 220. The remaining unexposed hash value bits are 128-16=112 bits. If k2=64, the first 64 bits of the hash value of the contact number will be sent to the cloud 220 as the hash value feature 2 in the corresponding relationship 2, that is, exposed to the cloud 220. The remaining unexposed hash value bits are only 128-64=64 bits. Obviously, compared with k2=16: when k2=64, there are fewer unexposed bits, the possibility of cloud 220 predicting the contact number is higher, and the degree of privacy protection is lower.

[0223] In summary, in actual implementation, the appropriate k2 value can be set based on the demand for communication overhead and the demand for privacy protection.

[0224] In stage 4, the mobile phone 210 compares the query response sent by the cloud 220 to obtain the target function information, thereby obtaining the query result. Next, the specific implementation of stage 4 is explained in combination with the ciphertext 4 shown in Table 8 above and the ciphertext 1 and ciphertext 2 of the target hash value characteristics shown in Table 9.

[0225] In some embodiments, the mobile phone 210 may first encrypt the ciphertext 1 corresponding to the target hash value feature, and then compare it with the ciphertext 4 to obtain the query result. Fig.11 In stage 4, the mobile phone 210 can complete the following steps:

[0226] S1101. The mobile phone 210 uses the key a to double-encrypt each ciphertext 1 of the target hash value feature to obtain multiple (represented as r, r≥1, r is a positive number) ciphertexts 5.

[0227] Exemplarily, the mobile phone 210 encrypts the four ciphertexts 1 shown in Table 9 to obtain the four ciphertexts 1 and the four encrypted ciphertexts 5 shown in Table 12 below:

[0228] Table 12

[0229] Ciphertext 1 Ciphertext 5 <![CDATA[y1 b ]]> <![CDATA[y1 ba ]]> <![CDATA[y5 b ]]> <![CDATA[y5 ba ]]> <![CDATA[y7 b ]]> <![CDATA[y7 ba ]]> <![CDATA[y8 b ]]> <![CDATA[y8 ba ]]>

[0230] S1102. Mobile phone 210 compares m ciphertexts 4 and r ciphertexts 5 to obtain a registration number that is the same as the contact number.

[0231] It should be understood that ciphertext 4 is obtained by encrypting the contact number using key a by mobile phone 210 and then encrypting it using key b by cloud 220. Ciphertext 5 is obtained by encrypting the registration number using key b by cloud 220 and then encrypting it using key a by mobile phone 210. Then, according to the first principle of the interchangeable encryption algorithm (for details, please refer to the terminology of "PSI encryption algorithm" in the previous text), if the contact number xi and the registration number yj are the same, then the ciphertext 4xi of the contact number xi is ab The ciphertext 5yj with the registration number yj ba same.

[0232] Therefore, the mobile phone compares the m ciphertexts 4 with the r ciphertexts 5 and can find the registration number that is the same as each of the m contact numbers. ab Equal to y7 in Table 12 above ba , it means that the number x1 in the contact number is equal to the number y7 in the registration number; x2 in Table 8 above ab Equal to y1 in Table 12 above ba , it means that the number x2 in the contact number is equal to the number y1 in the registration number.

[0233] S1103. Mobile phone 210 decrypts the service capability information in ciphertext 2 according to the contact number.

[0234] Since the ciphertext 2 of the business capability information corresponding to the registration number yj is encrypted by the information of the registration number yj, after the mobile phone 210 obtains that the contact number xi is the same as the registration number yj, it can use the information of the contact number xi as a key to decrypt the ciphertext 2 of the business function information corresponding to the registration number yj and obtain the business capability information corresponding to the registration number yj.

[0235] Taking the example that the information of contact number xi is the value of the last 16 bits of the hash value of contact number xi, after mobile phone 210 obtains that number x1 in the contact number is equal to number y7 in the registration number, it can use the value of the last 16 bits of the hash value of number x1, such as "1B4B", to decrypt the ciphertext 2 of the business capability information corresponding to number y7, such as z7, and obtain the business capability information corresponding to decrypted number y7, such as "1111". After mobile phone 210 obtains that number x2 in the contact number is equal to number y1 in the registration number, it can use the value of the last 16 bits of the hash value of number x2, such as "1518", to decrypt the ciphertext 2 of the business capability information corresponding to number y1, such as z1, and obtain the business capability information corresponding to decrypted number y1, such as "1110".

[0236] In other embodiments, the mobile phone 210 may first decrypt the m ciphertexts 4 and then compare them with the ciphertext 1 of the target hash value feature to obtain the query result. Fig.12 In stage 4, the mobile phone 210 can complete the following steps:

[0237] S1201. Mobile phone 210 uses key a to decrypt m ciphertexts 4 to obtain m ciphertexts 6 (fifth ciphertexts).

[0238] Among them, the m ciphertexts 6 correspond to the m contact numbers one by one.

[0239] Exemplarily, the mobile phone 210 decrypts the two ciphertexts 4 shown in Table 8 to obtain the two ciphertexts 4 and the two ciphertexts 6 after decryption shown in Table 13 below:

[0240] Table 13

[0241] Ciphertext 4 Ciphertext 6 <![CDATA[x1 ab ]]> <![CDATA[x1 b ]]> <![CDATA[x2 ab ]]> <![CDATA[x2 b ]]>

[0242] It should be noted that the number of contact numbers (ie, m) in the mobile phone 210 is usually small. Therefore, the amount of computation required to decrypt the m ciphertexts corresponding to the m contact numbers is also small, thus saving computational resources of the mobile phone 210.

[0243] S1202. The mobile phone 210 compares the m ciphertexts 6 with the r ciphertexts 1 to obtain a registration number that is the same as the contact number.

[0244] It should be understood that ciphertext 6 is obtained by encrypting the contact number by mobile phone 210 using key a, then by cloud 220 using key b, and finally by mobile phone 210 using key a to decrypt it. Then, according to the first principle of the exchangeable encryption algorithm (for details, please refer to the terminology introduction of the "PSI encryption algorithm" in the previous text), ciphertext 6 can be regarded as encrypted using key b. At the same time, ciphertext 1 is obtained by encrypting the registration number by cloud 220 using key b. Then, if the contact number xi and the registration number yj are the same, then the ciphertext 6xi of the contact number xi is b The ciphertext 1yj with the registration number yj b same.

[0245] Therefore, the mobile phone compares the m ciphertexts 6 with the r ciphertexts 1 and can find the registration number that is the same as each of the m contact numbers. b Equal to y7 in Table 9 above b , it means that the number x1 in the contact code is equal to the number y7 in the registration number; x2 in Table 13 above b Equal to y1 in Table 9 above b , it means that the number x2 in the contact number is equal to the number y1 in the registration number.

[0246] S1203. Mobile phone 210 decrypts the service capability information in ciphertext 2 according to the contact number.

[0247] For the specific implementation of S1203, please refer to the description of S1103 above, which will not be repeated here.

[0248] By adopting this embodiment, the mobile phone 210 can perform ciphertext comparison and obtain the query result after a small amount of decryption operation. In practice, when the query request end is the C end (such as the mobile phone 210), its computing power is often very limited. It can be seen that by adopting this embodiment, the query delay caused by insufficient computing power of the query request end can be significantly reduced. In the following, this embodiment will be mainly used for explanation.

[0249] It should be noted that the mobile phone 210 can obtain the ciphertext 1 and ciphertext 2 corresponding to the target hash value feature, and the target hash value feature is the same as the hash value feature 2. Then, if the registration number information used in the process of encrypting the ciphertext 2 is the same as the hash value feature 2 (such as the value of the first k2 bits in the hash value), then after the mobile phone 210 obtains the ciphertext 2, it can decrypt it according to the hash value feature 2 to obtain the business capability information corresponding to each ciphertext 2. However, in practice, the cloud 220 does not want the mobile phone 210 to obtain the business capability information corresponding to numbers other than the contact number. For example, the number x1 in the contact number is the same as the number y7 in the registration number, and the number x2 in the contact number is the same as the number y1 in the registration number. The cloud 220 also only wants the mobile phone 210 to decrypt the ciphertext 2 of the business capability information corresponding to the registration number y7 in Table 9, that is, z7, and the ciphertext 2 of the business capability information corresponding to the registration number y1, that is, z1, and does not want the mobile phone 210 to decrypt other ciphertexts 2 in Table 9, such as ciphertexts z5 and z8.

[0250] Therefore, for the information security in the cloud 220, the registration number information used by the cloud 220 when encrypting the service capability information is different from the bits used in the hash value features 1 and 2. For example, the value of the last k1 bits of the hash value of the registration number is used when encrypting the service capability information, while the hash value feature 1 and the hash value feature 2 are both the values ​​of the first k2 bits.

[0251] In the previous stage 3-stage 4, we take the case where there is only one target hash value feature (such as "0002") as an example. When there is only one target hash value feature, it is necessary to compare the ciphertext 4 of each contact number with the ciphertext 1 corresponding to the hash value feature to find the registration number that is the same as the contact number.

[0252] In practice, the hash values ​​of the m contact numbers in the mobile phone 210 may involve multiple hash value features 2. Then, in stage 3, the target hash value features also involve multiple.

[0253] Exemplarily, based on the correspondence relationship 2 shown in Table 7 above, as shown in Table 14 below, the correspondence relationship 2 also includes the hash value feature 0003:

[0254] Table 14

[0255]

[0256] That is, if the hash value feature 2 of the m contact numbers in the mobile phone 210 involves 0002 and 0003, then the target hash value feature also includes 0002 and 0003.

[0257] In this case, in order to reduce the workload of comparison, in stage 3, the mobile phone 210 can establish a corresponding relationship 3 between each ciphertext 4 and the ciphertext 1 and ciphertext 2 in the target hash value feature. Then, in stage 4, for any ciphertext 4 (such as xi ab ), the mobile phone 210 only needs to convert xi ab Compare with the ciphertext 1 in the corresponding target hash value feature, thereby reducing the workload of comparison and improving query efficiency.

[0258] Combined with the corresponding relationship 1 shown in Table 5 and the corresponding relationship 2 shown in Table 14, see Fig.13 In stage 3, cloud 220 may complete the following steps:

[0259] S1301, cloud 220 uses key b to re-encrypt m ciphertexts 3 in correspondence 2 to obtain m ciphertexts 4. For details, please refer to the description of S901 above.

[0260] Exemplarily, the three ciphertexts 3 in the correspondence 2 shown in Table 14 are encrypted twice to obtain the three ciphertexts 4 shown in Table 15 below:

[0261] Table 15

[0262]

[0263]

[0264] S1302 , cloud 220 establishes a correspondence 3 between ciphertext 1 and ciphertext 2 corresponding to each ciphertext 4 and the target hash value feature in correspondence 1 , and the target hash value feature is hash value feature 2 in correspondence 2 .

[0265] The correspondence relationship 3 includes the ciphertext 4 of the ciphertext 3 corresponding to the hash value feature 1a in the correspondence relationship 1, and the correspondence between the ciphertext 1 and the ciphertext 2 corresponding to the hash value feature 2b in the correspondence relationship 2. The hash value feature 1a and the hash value feature 2b are equal.

[0266] For example, the corresponding relationship 1 shown in Table 5 and the corresponding relationship 2 shown in Table 14 both include hash value features 0002 and 0003, that is, the hash value feature 1a and the hash value feature 2b are 0002, and the hash value feature 1a and the hash value feature 2b are 0002. Then, the mobile phone 210 can establish the corresponding relationship 3 shown in the following Table 16A:

[0267] Table 16A

[0268]

[0269] In Table 16A above, x1 ab and x2 abis the ciphertext 4 of the ciphertext 3 corresponding to the hash value feature 1a "0002" in the corresponding relationship 2, y1 b and z1, y5 b and z5, y7 b and z7 and y8 b and z8 are the ciphertext 1 and ciphertext 2 corresponding to the hash value feature 2b "0002" in the corresponding relationship 1. And, x3 ab is the ciphertext 4 of the ciphertext 3 corresponding to the hash value feature 1a "0003" in the corresponding relationship 2, y2 b and z2 and y4 b and z4 are the ciphertext 1 and ciphertext 2 corresponding to the hash value feature 2b “0003” in correspondence 1.

[0270] S1303. The cloud 220 sends a query request to the mobile phone 210, where the query request includes the corresponding relationship 3.

[0271] Exemplarily, the cloud 220 sends the corresponding relationship 3 shown in Table 16A above to the mobile phone 210 .

[0272] Combined with the corresponding relationship 3 shown in Table 16A above, see Fig.14 In stage 4, the mobile phone 210 can complete the following steps:

[0273] S1401. The mobile phone 210 uses the key a to decrypt the m ciphertexts 4 in the corresponding relationship 3 to obtain m ciphertexts 6. For details, please refer to the description of S1201 above.

[0274] Exemplarily, the mobile phone 210 decrypts the three ciphertexts 4 shown in Table 16A to obtain the three ciphertexts 4 and the three ciphertexts 6 after decryption shown in Table 16B below:

[0275] Table 16B

[0276] Ciphertext 4 Ciphertext 6 <![CDATA[x1 ab ]]> <![CDATA[x1 b ]]> <![CDATA[x2 ab ]]> <![CDATA[x2 b ]]> <![CDATA[x3 ab ]]> <![CDATA[x3 b ]]>

[0277] S1402. The mobile phone 210 compares each ciphertext 6 with the ciphertext 1 corresponding to the ciphertext 4 of the ciphertext 6 in the corresponding relationship 3, and obtains a registration number that is the same as the contact number.

[0278] Ciphertext 6"x2 from Table 16B above b "For example, mobile phone 210 only needs x2 b The corresponding relationship 3 shown in Table 16A is x2 ab (i.e. x2 b The corresponding ciphertext 4) is y1 b ,y5 b ,y7 b and y8 b Compare without x2 bCompared with y2 in Table 16A b and y4 b Compare.

[0279] Ciphertext 6"x3 in Table 16B above b "For example, mobile phone 210 only needs x3 b The corresponding relationship 3 shown in Table 16A is x3 ab (i.e. x3 b The corresponding ciphertext 4) is y2 b and y4 b Compare without x3 b Compared with y1 in Table 16A b ,y5 b ,y7 b and y8 b Compare.

[0280] For the parts not described in detail in S1402, please refer to the description of S1202 above, which will not be repeated here.

[0281] S1403, the mobile phone 210 decrypts the service capability information in the ciphertext 2 according to the contact number. For details, please refer to the description of S1103 above, which will not be repeated here.

[0282] Furthermore, in stage 1, cloud 220 may also compress ciphertext 1. In subsequent stage 3, cloud 220 may send the compressed result to mobile phone 210. It should be understood that the amount of data after compression is smaller than that before compression. This can further reduce the amount of data transmitted from cloud 220 to mobile phone 210 and reduce communication overhead.

[0283] Combined with the corresponding relationship 1 shown in Table 5 and the corresponding relationship 2 shown in Table 7, see Fig.15 , in stage 1, S704 further includes:

[0284] S1501. Cloud 220 compresses the ciphertext 1 of each registration number to obtain the compressed result of the ciphertext 1.

[0285] For example, cloud 220 performs the following ciphertext 1 in Table 5: y1 b ,y2 b ,y3 b ,y4 b ,y5 b ,y6 b ,y7 b and y8 b Compress them respectively and get the compressed result y1 of ciphertext 1 in turn b’ ,y2 b’ ,y3 b’ ,y4 b’ ,y5b’ ,y6 b’ ,y7 b’ and y8 b’ .

[0286] In a specific implementation, cloud 220 can use fingerprint compression to compress ciphertext 1. Fingerprint compression refers to using the "fingerprint" of the ciphertext to represent the ciphertext, thereby compressing the ciphertext. It should be understood that the "fingerprint" here represents information that can uniquely represent the ciphertext, and is not a fingerprint in the conventional sense.

[0287] For example, the specific implementation of fingerprint compression may be: cloud 220 uses a portion of bits (the second bit) of ciphertext 1 as the result of ciphertext compression. Fig.16 In the compression method 1 shown, the ciphertext 1 includes DC9CA4E4602…204B3, 60E9A9315AB…E4F5E, 294DE95CBCD…C1D91 and A61DF617262…79A1F. Cloud 220 can take the first 32 bits of the ciphertext 1 and obtain the compressed results of DC9CA4E4, 60E9A931, 294DE95C and A61DF617 in sequence.

[0288] As another example, the specific implementation of fingerprint compression may be: cloud 220 calculates the hash value of ciphertext 1, and then takes part of the bits (the second bit) of the hash value as the result of ciphertext compression. Fig.16 In the compression method 2 shown, the ciphertext 1 includes DC9CA4E4602…204B3, 60E9A9315AB…E4F5E, 294DE95CBCD…C1D91, and A61DF617262…79A1F. Cloud 220 can hash these ciphertexts 1 respectively, and obtain hash values ​​51A15180…002E11A0C0E, C3000810…00341AA6176, 4BB12980…00C497DE639, and D6B71BD0…002DF235902. Then, cloud 220 takes the first 32 bits of these hash values ​​and obtains the compressed results 51A15180, C3000810, 4BB12980, and D6B71BD0.

[0289] S1502. Cloud 220 establishes a corresponding relationship 1 between the hash value feature 1 of each registration number and the compressed result of the ciphertext 1, and the ciphertext 2 of the business function information corresponding to the registration number.

[0290] Take the following ciphertext 1 in Table 5:y1 b ,y2 b ,y3 b ,y4 b,y5 b ,y6 b ,y7 b and y8 b , the compressed results are y1 b’ ,y2 b’ ,y3 b’ 、y4 b’ ,y5 b’ ,y6 b’ ,y7 b’ and y8 b’ For example, the corresponding relationship 1 shown in Table 5 above can be updated to the corresponding relationship 1 shown in Table 17 below:

[0291] Table 17

[0292]

[0293]

[0294] And, S902 in Phase 3 is replaced by S1503:

[0295] S1503. Cloud 220 sends a query response to mobile phone 210. The query response includes: the compressed result of ciphertext 1 and ciphertext 2 corresponding to the target hash value feature in correspondence 1, and m ciphertexts 4. The target hash value feature is hash value feature 2 in correspondence 2.

[0296] Using the example in Table 17, the target hash value feature is "0002", then the compressed result of ciphertext 1 and ciphertext 2 corresponding to the target hash value feature are shown in Table 18 below:

[0297] Table 18

[0298] The result after compression of ciphertext 1 Ciphertext 2 <![CDATA[y1 b’ ]]> z1 <![CDATA[y5 b’ ]]> z5 <![CDATA[y7 b’ ]]> z7 <![CDATA[y8 b’ ]]> z8

[0299] In this embodiment, since the cloud 220 sends the compressed result of the ciphertext 1, in stage 4, after the mobile phone 210 decrypts and obtains m ciphertexts 6, that is, after S1201, it also includes S1504 to make the data comparable:

[0300] S1504. Mobile phone 210 compresses the m ciphertexts 6 respectively to obtain the compressed results of the m ciphertexts 6.

[0301] It should be understood that the compression algorithm used in S1504 is the same as the compression algorithm used in S1501.

[0302] And, S1202 in stage 4 is replaced by S1505:

[0303] S1505. The mobile phone 210 compares the compressed result of the m ciphertexts 6 with the compressed result of the r ciphertexts 1 to obtain a registration number that is the same as the contact number.

[0304] If the result of the ciphertext 6 compression corresponding to the contact number xi (such as xi b’ ) and the ciphertext 1 of the registration number yj (denoted as yj b’ ) are the same, then the contact number xi and the registration number yj are the same.

[0305] Since the mobile phone 210 only compares the compressed results and does not need to restore the ciphertext before compression, the cloud 220 or the mobile phone 210 can use an irreversible compression algorithm when compressing to further reduce the amount of data.

[0306] The present application also provides an electronic device, which may include: a memory and one or more processors. The memory and the processor are coupled. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can execute the various functions or steps executed by the mobile phone in the above method embodiment.

[0307] The present application also provides a chip system, such as Fig.17 As shown, the chip system 1700 includes at least one processor 1701 and at least one interface circuit 1702. The processor 1701 and the interface circuit 1702 can be interconnected via lines. For example, the interface circuit 1702 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 1702 can be used to send signals to other devices (such as processor 1701). Exemplarily, the interface circuit 1702 can read instructions stored in the memory and send the instructions to the processor 1701. When the instructions are executed by the processor 1701, the electronic device can perform the various steps in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in the embodiments of the present application.

[0308] This embodiment further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes each function or step executed by the mobile phone in the above method embodiment.

[0309] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer executes each function or step executed by the mobile phone in the above method embodiment.

[0310] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory so that the chip executes each function or step performed by the mobile phone in the above method embodiment.

[0311] Among them, the electronic device, communication system, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.

[0312] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0313] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0314] The unit described as a separate component may or may not be physically separated, and the component shown as a unit may be one physical unit or multiple physical units, that is, it may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.

[0315] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0316] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

[0317] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.

Claims

1. A query method, characterized in that: The method comprises: In response to the query event, the first device sends a query request to the second device, wherein the query request includes a first ciphertext obtained by encrypting the query condition using the first key; The first device receives a query response from the second device, the query response including a second ciphertext and a first ciphertext set, the second ciphertext being obtained by encrypting the first ciphertext using a second key, the first ciphertext set including at least one ciphertext group, one ciphertext group corresponding to a matching condition and result information of the matching condition, one ciphertext group including a third ciphertext obtained by encrypting the matching condition using the second key and a fourth ciphertext obtained by encrypting the result information using feature information of the matching condition; The first device decrypts the fourth ciphertext corresponding to the target ciphertext in the first ciphertext set by using the characteristic information of the condition to be queried to obtain result information of the condition to be queried; The target ciphertext is a ciphertext in the third ciphertext of the first ciphertext set that is equal to the fifth ciphertext, and the fifth ciphertext is a ciphertext obtained by decrypting the second ciphertext using the first key.

2. The method according to claim 1, characterized in that The characteristic information includes information of a first characteristic in a hash value of corresponding data.

3. The method according to claim 2, characterized in that The first bits are one or more bits in the hash value from low to high.

4. The method according to any one of claims 1 to 3, characterized in that The third ciphertext in the first ciphertext set is a compressed ciphertext obtained by encrypting the matching condition using the second key and then compressing it, and the fifth ciphertext is a compressed ciphertext obtained by decrypting the second ciphertext using the first key and then compressing it.

5. The method according to claim 4, characterized in that , the compressed ciphertext includes the information of the second bit in the ciphertext before compression; or, the compressed ciphertext includes the information of the second bit in the hash value of the ciphertext before compression.

6. The method according to any one of claims 1 to 3, characterized in that The first ciphertext set is a ciphertext set having a hash feature identical to the hash feature of the condition to be queried among multiple ciphertext sets; A ciphertext set includes at least one ciphertext group, a ciphertext group corresponds to a matching condition and result information of the matching condition, the hash feature of at least one matching condition corresponding to the at least one ciphertext group is the same, and the hash feature of a ciphertext set is the hash feature of the at least one matching condition.

7. The method according to claim 6, characterized in that The hash feature includes information of the third bit in the hash value of the corresponding data.

8. The method according to claim 6, characterized in that The query request also includes the hash feature of the condition to be queried.

9. A query method, characterized in that: The method comprises: The second device receives a query request from the first device, wherein the query request includes a first ciphertext obtained by encrypting the query condition using the first key; The second device sends a query response to the first device, the query response including a second ciphertext and a first ciphertext set, the second ciphertext being obtained by encrypting the first ciphertext using a second key, the first ciphertext set including at least one ciphertext group, one ciphertext group corresponding to a matching condition and result information of the matching condition, one ciphertext group including a third ciphertext obtained by encrypting the matching condition using the second key and a fourth ciphertext obtained by encrypting the result information using feature information of the matching condition; Among them, the query response is used by the first device to obtain result information of the condition to be queried, and the result information is a decryption result of decrypting the fourth ciphertext corresponding to the target ciphertext in the first ciphertext set using the characteristic information of the condition to be queried, and the target ciphertext is the ciphertext in the third ciphertext of the first ciphertext set that is equal to the fifth ciphertext, and the fifth ciphertext is the ciphertext obtained by decrypting the second ciphertext using the first key.

10. The method according to claim 9, characterized in that The query request also includes a hash feature of the condition to be queried; Before the second device sends a query response to the first device, the method further includes: The second device searches for the first ciphertext set whose hash feature is equal to the hash feature of the condition to be queried from multiple ciphertext sets; Among them, a ciphertext set includes at least one ciphertext group, a ciphertext group corresponds to a matching condition and the result information of the matching condition, the hash feature of at least one matching condition corresponding to the at least one ciphertext group is the same, and the hash feature of a ciphertext set is the hash feature of the at least one matching condition.

11. The method according to claim 9 or 10, characterized in that: The third ciphertext is obtained by encrypting the matching condition using the second key and then compressing it.

12. An electronic device, characterized in that: The device comprises a memory and a processor, wherein the memory and the processor are coupled; wherein the memory stores a computer program code, wherein the computer program code comprises a computer instruction; Wherein, the electronic device is a first device, and when the computer instruction is executed by the processor, the electronic device executes the steps executed by the first device in the method according to any one of claims 1 to 11; Alternatively, the electronic device is a second device, and when the computer instructions are executed by the processor, the electronic device executes the steps executed by the second device in the method as described in any one of claims 1-11.

13. A communication system, characterized in that: The communication system comprises the first device and the second device according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: including computer instructions; Wherein, when the computer instruction is executed on the first device, the first device is caused to execute the steps executed by the first device in the method according to any one of claims 1 to 11; Alternatively, when the computer instruction runs on the second device, the second device executes the steps executed by the second device in the method according to any one of claims 1 to 11.

15. A chip system, characterized in that: The chip system is applied to an electronic device including a processor and a memory, the chip system includes one or more interface circuits and one or more processors, the interface circuit and the processor are interconnected through a line, the interface circuit is used to receive a signal from the memory of the electronic device and send the signal to the processor, the signal includes a computer instruction stored in the memory; The electronic device is a first device, and when the processor executes the computer instruction, the electronic device executes the steps executed by the first device in the method according to any one of claims 1 to 11; Alternatively, the electronic device is a second device, and when the processor executes the computer instructions, the electronic device executes the steps executed by the second device in the method as described in any one of claims 1-11.