Homomorphic encryption-based anonymous query method and device and computer equipment
By generating public-private key pairs through homomorphic encryption algorithms and filtering feature fields to generate query sets and ciphertext vectors, the problems of high resource consumption and communication overhead in existing technologies are solved, and efficient data query with privacy protection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-10
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies suffer from resource consumption and high communication overhead when sharing data, making it difficult to efficiently query data while protecting client privacy.
A public-private key pair is generated using a homomorphic encryption algorithm. A query set and ciphertext vector are generated by filtering feature fields. The client uses the public key to encrypt the query information. The server performs homomorphic scalar multiplication and encrypts the result to return the ciphertext. The client uses the private key to decrypt and obtain the plaintext message.
It reduces resource consumption and communication overhead, enables anonymous querying that protects client privacy during the query process, and prevents the server from recognizing the feature fields to be queried, thereby improving query efficiency.
Smart Images

Figure CN116346310B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information security technology, and in particular to a method, apparatus and computer device for stealth querying based on homomorphic encryption. Background Technology
[0002] With the development of the big data era, the value of data in various industries is becoming increasingly important. Breaking down data silos and sharing data information are crucial prerequisites for realizing the value of data. When users query data, the server can easily record the user's query conditions and may infer the user's business and interests based on these conditions, leading to privacy leaks. How to ensure client privacy while sharing data has become a major challenge for internet companies.
[0003] In existing technologies, privacy retrieval technology based on unintentional transmission can protect the privacy of the querying party to a certain extent. For example, when there are n data items on the server, the server generates n public-private key pairs accordingly. When the client needs to retrieve the t-th data item, the client encrypts the key with the t-th public key, and the server decrypts the key sequentially with the n private keys to obtain n decryption results. The server then encrypts each of the n decryption results to obtain a ciphertext set. The client receives the ciphertext set and decrypts it with the key to obtain the plaintext message of the t-th data item.
[0004] However, the above methods require a large number of public-private key pairs, and still suffer from significant resource consumption and communication overhead. Summary of the Invention
[0005] Therefore, it is necessary to provide a method, apparatus, and computer device for stealth querying based on homomorphic encryption that can reduce resource consumption and communication overhead, in order to address the above-mentioned technical problems.
[0006] Firstly, this application provides a method for anonymous querying based on homomorphic encryption for use on a client side.
[0007] The method includes:
[0008] At least two feature fields are selected from the feature set on the server side, and a query set is generated based on the feature fields; one of the feature fields is the feature field to be queried.
[0009] A public-private key pair is generated based on a homomorphic encryption algorithm. A ciphertext vector is generated based on the query set and the public key in the public-private key pair. The public key, the query set, and the ciphertext vector are then sent to the server.
[0010] The server receives the encrypted result, which is determined by the query set and the encrypted vector; the encrypted result is decrypted using the private key in the public-private key pair to obtain the plaintext message corresponding to the feature field to be queried.
[0011] In one embodiment, at least two feature fields are filtered out from the feature set of the service end, and a query set is generated according to the feature fields; wherein one of the feature fields is a to-be-queried feature field, and the method further comprises:
[0012] The number of the feature fields in the query set is less than the number of the feature fields in the feature set.
[0013] In one embodiment, the generating of the ciphertext vector according to the query set and the public key in the public-private key pair comprises:
[0014] According to the total number of the feature fields in the query set, the dimension of the ciphertext vector is determined.
[0015] According to the position of the to-be-queried feature field in the query set, the position of the to-be-queried element in the ciphertext vector is determined.
[0016] Based on the Paillier encryption algorithm, the public key in the public-private key pair is used to encrypt the number 1, and the encrypted result is taken as the content of the to-be-queried element; the public key is used to encrypt the number 0, and the encrypted result is taken as the content of the remaining elements in the ciphertext vector, so as to obtain the ciphertext vector.
[0017] In a second aspect, the application provides a homomorphic encryption-based anonymous query method, which is used for a service end.
[0018] The method comprises:
[0019] Receiving a query set, a ciphertext vector and a public key sent by a client;
[0020] Obtaining feature fields in the query set, querying attribute fields according to the feature fields, and obtaining attribute information in the order of the query set elements based on the attribute fields;
[0021] Encrypting the attribute information by using the ciphertext vector and the public key to obtain a ciphertext result, and sending the ciphertext result to the client.
[0022] In one embodiment, before the receiving of the query set, the ciphertext vector and the public key sent by the client, the method further comprises:
[0023] Storing plaintext data in the form of a dictionary, wherein the plaintext data comprises feature fields and attribute fields corresponding to the feature fields one by one;
[0024] Extracting all the feature fields to generate a feature set.
[0025] In one of the embodiments, the encrypting the attribute information by using the ciphertext vector and the public key to obtain a ciphertext result comprises:
[0026] The homomorphic number multiplication calculation is performed on the ciphertext vector and the attribute information by using the public key to obtain a ciphertext result.
[0027] In a third aspect, the application provides an anonymous query device based on homomorphic encryption, which is used for a client and comprises:
[0028] A query set generation module is configured to filter at least two feature fields from a feature set of a server and generate a query set according to the feature fields, one of the feature fields being a to-be-queried feature field.
[0029] A ciphertext vector generation module is configured to generate a public-private key pair based on a homomorphic encryption algorithm, generate a ciphertext vector according to the query set and a public key in the public-private key pair, and send the public key, the query set and the ciphertext vector to the server.
[0030] A ciphertext decryption module is configured to receive a ciphertext result of the server, the ciphertext result being determined by the query set and the ciphertext vector, decrypt the ciphertext result by using a private key in the public-private key pair to obtain a plaintext message corresponding to the to-be-queried feature field.
[0031] In a fourth aspect, the application provides an anonymous query device based on homomorphic encryption, which is used for a server and comprises:
[0032] A receiving module is configured to receive a query set, a ciphertext vector and a public key sent by a client.
[0033] A query module is configured to acquire feature fields in the query set, query attribute fields according to the feature fields, and obtain attribute information in accordance with an element order of the query set based on the attribute fields.
[0034] An encryption module is configured to encrypt the attribute information by using the ciphertext vector and the public key to obtain a ciphertext result, and send the ciphertext result to the client.
[0035] In a fifth aspect, the application provides a computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing steps of the anonymous query method based on homomorphic encryption according to any one of the above aspects when executing the computer program.
[0036] In a sixth aspect, the application provides a computer readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement steps of the anonymous query method based on homomorphic encryption according to any one of the above aspects.
[0037] The homomorphic encryption-based anonymous query method, device and computer equipment ensure that the client user completes the query and decryption on the premise that the query information is not perceived and leaked when submitting a query request to the server data source side, and all data is queried and decrypted using a pair of public and private keys, thereby reducing resource consumption and communication overhead. BRIEF DESCRIPTION OF DRAWINGS
[0038] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and serve to explain the principles of the application. In the drawings:
[0039] Figure 1 FIG. 1 is a structural block diagram of a homomorphic encryption-based anonymous query system in one embodiment;
[0040] Figure 2 FIG. 2 is a flowchart of a homomorphic encryption-based anonymous query method in one embodiment;
[0041] Figure 3 FIG. 3 is a flowchart of a homomorphic encryption-based anonymous query method in another embodiment;
[0042] Figure 4 FIG. 4 is a flowchart of a homomorphic encryption-based anonymous query method in one preferred embodiment;
[0043] Figure 5 FIG. 5 is a structural block diagram of a homomorphic encryption-based anonymous query device in one embodiment;
[0044] Figure 6 FIG. 6 is a structural block diagram of a homomorphic encryption-based anonymous query device in another embodiment. DETAILED DESCRIPTION
[0045] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application. Based on the embodiments provided by the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of the present application.
[0046] It is apparent that the drawings in the following description merely show some examples or embodiments of the present application, and the present application can be applied to other similar situations without creative labor by those skilled in the art according to these drawings. In addition, it can be understood that, although the efforts made in the development process can be complex and lengthy, some design, manufacture or production changes made on the basis of the technical content disclosed in the present application are only routine technical means for those skilled in the art related to the content disclosed in the present application, and should not be understood as insufficient disclosure of the content disclosed in the present application.
[0047] Reference to "an embodiment" in this application means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. It is explicitly contemplated that embodiments described herein can be combined with each other, if such embodiments do not conflict.
[0048] Unless otherwise defined, technical terms or scientific terms used in the present application shall have the ordinary meaning of those skilled in the art to which the present application pertains. The terms "a", "an", "one", "this", and similar terms in the present application do not denote a quantity limitation, but can denote a single or a plurality. The terms "include", "comprise", "have", and any variations thereof in the present application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device including a series of steps or modules (units) is not limited to the listed steps or units, but can further include other steps or units not listed or can further include other steps or units inherent to such a process, method, product, or device. The terms "connect", "connected", "couple", and similar terms in the present application are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. The term "plurality" in the present application means two or more. The term "and / or" describes the association relationship of the associated objects, which means that there can be three relationships, for example, "A and / or B" can mean that A exists alone, A and B exist together, and B exists alone. The character " / " generally means that the associated objects before and after are in an "or" relationship. The terms "first", "second", "third", and the like in the present application are merely to distinguish similar objects, and do not represent a specific order of the objects.
[0049] The following embodiments can be applied to Figure 1 the homomorphic encryption-based anonymous query system shown in Figure 1The illustrated homomorphic encryption-based anonymous query system includes a client 10 and a server 20 connected through a network.
[0050] The client 10 can be a mobile terminal, a fixed terminal, or a portable terminal such as a mobile phone, a station, a unit, a device, a multimedia computer, a multimedia tablet, an Internet node, a communicator, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an electronic book device, a game device, or any combination thereof, including accessories and peripherals of these devices or any combination thereof.
[0051] The server 20 can be a conventional server, a cloud server, a cloud host, a virtual center, or the like. The server device mainly includes a processor, a hard disk, a memory, a system bus, and the like, and has a general computer architecture type. The server 20 can be a server device, and can also be a server cluster including a plurality of servers.
[0052] In the embodiment, a homomorphic encryption-based anonymous query method is provided for a client, such as Figure 2 As shown, the method includes the following steps:
[0053] In step S210, at least two feature fields are filtered out from a feature set of a server, and a query set is generated according to the feature fields. One of the feature fields is a to-be-queried feature field.
[0054] The feature set of the server includes a plurality of feature fields. Specifically, each feature field is stored in a database in a one-to-one corresponding relationship with a plaintext data. In order to facilitate the client to query the plaintext data, the server extracts the feature fields corresponding to all the plaintext data to generate a feature set, and publishes the feature set to the client. When a client user wants to query a certain plaintext data, the user combines a to-be-queried feature field corresponding to the plaintext data and at least one randomly selected feature field to generate a new query set. The number of elements and the order of elements in the query set can be determined by the client. The query set can hide the real query intention of the user, and multiple feature fields are queried together.
[0055] In step S220, a public-private key pair is generated based on a homomorphic encryption algorithm, a ciphertext vector is generated according to the query set and the public key in the public-private key pair, and the public key, the query set, and the ciphertext vector are sent to the server.
[0056] The client generates a public-private key pair (h PK ,hSK ), and the specific process is as follows:
[0057] 1) Randomly select two large prime numbers p and q, which satisfy gcd(pq,(p-1)(q-1))=1, where gcd is the maximum common divisor algorithm;
[0058] 2) Calculate the composite modulus n=pq, and λ=lcm(p-1,q-1), where lcm represents the minimum common multiple;
[0059] 3) Randomly select an integer where represents the multiplicative group of the 2-power residue ring modulo n;
[0060] 4) Define the function and calculate μ=(L(g λ mod n 2 ))-1mod n; where mod n represents the modulo n operation, for example, 23mod 7=2;
[0061] 5) Generate a public-private key pair (h PK ,h SK ), where the public key h PK is (n,g), and the private key h SK is (λ,μ).
[0062] In addition, the query set corresponds to the ciphertext vector. Specifically, if the feature field to be queried is the tth item in the query set, then in the generation of the ciphertext vector, the tth item of the ciphertext vector is the result of using the public key h PK to encrypt the number 1, and the non-tth item of the ciphertext vector is the result of using the public key h PK to encrypt the number 0.
[0063] Step S230, receiving the ciphertext result of the server, which is determined by the query set and the ciphertext vector; using the private key in the public-private key pair to decrypt the ciphertext result to obtain the plaintext message corresponding to the feature field to be queried.
[0064] Specifically, the server obtains a group of plaintext data through the query set, and performs homomorphic number multiplication calculation on the plaintext data and the ciphertext vector to obtain the ciphertext result. After receiving the ciphertext result, the client uses the private key to decrypt the ciphertext result based on the homomorphic number multiplication decryption method to obtain the plaintext message to be searched.
[0065] Compared with the prior art, the embodiment filters a group of feature fields from the feature set of the service end, one of which is a to-be-queried feature field, and the rest of which can be selected at will to form a query set, generates a pair of public key and private key by using a homomorphic encryption algorithm, calculates a ciphertext vector by using the public key and the query set to obtain a ciphertext result, decrypts the ciphertext result based on homomorphic decryption after the service end queries the plaintext and returns the ciphertext result, and obtains the to-be-queried plaintext message, so that the user can complete the query on the premise that the query information is not perceived and leaked when submitting the query request to the service end, and the client needs only a pair of public and private keys to complete the anonymous query by means of the homomorphic operation property of the ciphertext, thereby reducing resource consumption and communication overhead.
[0066] In one embodiment, in the above step S210, at least two feature fields are filtered from the feature set of the service end, and a query set is generated according to the feature fields; one of the feature fields is a to-be-queried feature field, and the method further comprises the following steps:
[0067] The number of feature fields in the query set is less than the number of feature fields in the feature set.
[0068] In the embodiment, it is not necessary to send all the feature fields to the service end for query, and part of the fields are extracted from the feature set to form a query set, so that the data transmission amount can be reduced and the query efficiency can be improved.
[0069] In one embodiment, based on the above step S220, a ciphertext vector is generated according to the query set and the public key in the pair of public and private keys, and the method comprises the following steps:
[0070] Step S221: The dimension of the ciphertext vector is determined according to the total number of feature fields in the query set.
[0071] Specifically, it is assumed that the query set (k1,…k t ,…k j ) includes j feature fields in total, and the generated ciphertext vector (s1,…s t ,…,s j ) corresponds to j dimensions including j elements.
[0072] Step S222: The position of the to-be-queried element in the ciphertext vector is determined according to the position of the to-be-queried feature field in the query set.
[0073] Specifically, the tth feature field k t in the query set (k1,…k j ,…k t ) is the to-be-queried feature field, and then the j-dimensional ciphertext vector (s1,…s t ,…,s jThe tth element s in the set t The ciphertext of the element to be queried.
[0074] In step S223, based on the Paillier encryption algorithm, the public key in the public-private key pair is used to encrypt the number 1, the encrypted result is taken as the content of the element to be queried, and the public key is used to encrypt the number 0, the encrypted result is taken as the content of the remaining elements in the ciphertext vector, and the ciphertext vector is obtained.
[0075] The encryption process of the Paillier encryption algorithm is as follows:
[0076] 1) Select a random number r, satisfying 0 < r < n; wherein n is taken from the public key h PK (n, g);
[0077] 2) Calculate the encrypted ciphertext c = g m r n mod n 2 ; wherein m is the plaintext
[0078] Specifically, based on the Paillier encryption algorithm, the public key h PK is used to encrypt the plaintext number 1, and the result is taken as s t , and the public key h PK is used to encrypt the plaintext number 0, and the result is taken as the non-t element.
[0079] The above steps S221 to S223 guarantee that all ciphertexts are not repeated through the random number of the Paillier encryption algorithm, and further make the server unable to distinguish the different distributions of 0 and 1 from the encryption result, thereby obtaining a ciphertext vector with an anonymous effect.
[0080] The embodiment also provides an anonymous query method based on homomorphic encryption, which is used for a server, as shown in Figure 3 The method comprises the following steps:
[0081] In step S310, the query set, the ciphertext vector and the public key sent by the client are received.
[0082] Among them, the client generates a query set based on a feature field, generates a public key and a ciphertext vector based on a homomorphic encryption algorithm, and sends them to the server for querying the plaintext message. Specifically, the query set sent is (k1, …k t ,…k j ), the ciphertext vector is (s1, …s t ,…,s j ), and the public key is h PK (n, g).
[0083] Step S320: Obtain the feature fields in the query set, query the attribute fields based on the feature fields, and obtain the attribute information that conforms to the order of elements in the query set based on the attribute fields.
[0084] The server stores several attribute fields v, with a one-to-one correspondence between the attribute fields and feature fields. The attribute fields represent the plaintext to be queried. Based on the query set (k1,…k…), t ,…k j You can retrieve a set of corresponding attribute fields, and then combine these attribute fields into attribute information (v1,...,v) according to the order of the elements in the query set. t ,…,v j ).
[0085] Step S330: Encrypt the attribute information using the ciphertext vector and public key to obtain the ciphertext result, and send the ciphertext result to the client.
[0086] Specifically, the attribute information (v1,…,v) t ,…,v j ) and ciphertext vector (s1,…s t ,…,s j Perform a homomorphic scalar multiplication to obtain the ciphertext result R. The calculation formula is as follows:
[0087]
[0088] Where n is taken from the public key h PK (n,g).
[0089] In this embodiment, the server retrieves multiple plaintext data entries based on the query set sent by the client, and encrypts the plaintext data using a ciphertext vector to obtain ciphertext results. The server can be considered "invisible" to the client's query conditions. The server can only know what feature fields exist, but does not know which feature field is to be queried, thus achieving anonymous querying of data.
[0090] In one embodiment, before receiving the query set, ciphertext vector, and public key sent by the client in step S310 above, the method further includes:
[0091] Step S310a: Store plaintext data in dictionary form. Plaintext data includes feature fields and attribute fields that correspond one-to-one with the feature fields.
[0092] Specifically, the server records the feature field k and attribute field v as a dictionary (k, v). When the server has n queryable records, the storage format is ((k1, v1), ..., (k... t ,v t ),…(k n ,v n )).
[0093] Step S310b, extracting all feature fields to generate a feature set.
[0094] Specifically, a feature set (k1,…k t ,…k j ) is generated and published to the client.
[0095] The above steps S310a to S310b can avoid storing data through data index information. In the prior art, plaintext data is often stored in the form of an index, such as ((1,v1),…(t,v t ),…(n,v n )). Based on the index-based storage mode, the server needs to maintain the index at a large cost, and after data is added, deleted, or the like, the client needs to know the latest index information to perform accurate query. By storing the feature field and the attribute field in the form of a dictionary, the server has a higher fault tolerance rate after the database is updated.
[0096] The present embodiment will be described and explained below through a preferred embodiment.
[0097] Figure 4 is a flowchart of the homomorphic encryption-based anonymous query method of the preferred embodiment.
[0098] Step S401, the client generates a public-private key pair.
[0099] Specifically, the client generates a public-private key pair (h PK ,h SK ) based on the Paillier homomorphic encryption algorithm, and the process is as follows:
[0100] 1) Two large prime numbers p and q are randomly selected, satisfying gcd(pq,(p-1)(q-1))=1, where gcd is the greatest common divisor algorithm;
[0101] 2) Calculate the composite modulus n=pq, and λ=lcm(p-1,q-1), where lcm represents the least common multiple;
[0102] 3) Randomly select an integer where represents the multiplicative group of the 2-power residue ring modulo n;
[0103] 4) Define the function and calculate μ=(L(g λ mod n 2 ))-1mod n; where mod n represents the modulus n operation, for example, 23mod 7=2;
[0104] 5) Generate a public-private key pair (hPK ,h SK ), where the public key h PK For (n, g), the private key h SK It is (λ,μ).
[0105] In step S402, the server stores the data in the form of a dictionary and publishes the feature set in the data.
[0106] Specifically, when the server has n data entries, they are represented in dictionary form as ((k1, v1), ..., (k...). t ,v t ),…(k n ,v n The feature field k and attribute field v of n data entries are stored, and the feature set (k1, ..., k2) is published to the client. t ,…k j ).
[0107] In step S403, the client extracts the query set from the feature set and generates a ciphertext vector based on the homomorphic encryption algorithm; the public key, query set, and ciphertext vector in the public-private key pair are sent to the server.
[0108] Specifically, the client starts from the feature set (k1,…k t ,…k j ) Filtering feature fields yields the query set (k1,…k t ,…k j The order and number of elements in the query set can differ from those in the feature set, and can be combined according to retrieval needs, where k t These are the feature fields corresponding to the data that need to be retrieved.
[0109] Based on the Paillier encryption algorithm, the public key is used to encrypt the number 1 in the public-private key pair, and the encrypted result is used as the t-th element of the ciphertext vector. Then, the public key is used to encrypt the number 0, and the encrypted result is used as the non-t-th element of the ciphertext vector. This yields the ciphertext vector (s1,…s). t ,…,s j The dimension of the ciphertext vector corresponds to the total number of elements in the query set.
[0110] In step S404, the server obtains the plaintext set based on the query set, performs a homomorphic scalar multiplication between the ciphertext vector and the queried plaintext set to obtain the ciphertext result, and sends the ciphertext result to the client.
[0111] Specifically, the corresponding attribute fields are retrieved based on the feature fields in the query set. The set of attribute fields is a plaintext set. The attribute fields are then integrated into attribute information (v1,...,v) according to the element order in the query set. t ,…,v j), and combine the attribute information with the ciphertext vector (s1,…s t ,…,s j Perform a homomorphic scalar multiplication to obtain the ciphertext result R. The calculation formula is as follows:
[0112]
[0113] Where n is taken from the public key h PK (n,g).
[0114] In step S405, the client receives the encrypted result, decrypts it using the private key in the public-private key pair, and obtains the plaintext data.
[0115] Specifically, based on the principle of homomorphic scalar multiplication, the following transformation can be made:
[0116] R = E((v1*0) + ... + (v t *1)…+(v j *0))=E(v t );
[0117] The client decrypts the ciphertext result R using D(E(v)). t ))=v t *1, obtain plaintext data v t .
[0118] In this preferred embodiment, homomorphic encryption is used to achieve "computable but not visible" data, protecting the privacy of client users. Compared with the retrieval of privacy information transmitted unintentionally, it does not require a large number of public-private key pairs, reducing resource consumption and communication overhead. The server stores data in a dictionary manner, so it does not need to know the data index information to be queried.
[0119] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0120] Based on the same inventive concept, in the embodiment, a homomorphic encryption-based anonymous query device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and details are not repeated. The terms "module", "unit", "sub-unit" and the like used below can be a combination of software and / or hardware that implements a predetermined function. Although the system described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware is also possible and contemplated.
[0121] In one embodiment, as shown in Figure 5 a homomorphic encryption-based anonymous query device for a client is provided, comprising: a query set generation module 51, a ciphertext vector generation module 52, and a ciphertext decryption module 53, wherein:
[0122] The query set generation module 51 is configured to filter at least two feature fields from a feature set of a server, and generate a query set according to the feature fields; one of the feature fields is a to-be-queried feature field;
[0123] The ciphertext vector generation module 52 is configured to generate a public-private key pair based on a homomorphic encryption algorithm, generate a ciphertext vector according to the query set and a public key in the public-private key pair, and send the public key, the query set, and the ciphertext vector to the server;
[0124] The ciphertext decryption module 53 is configured to receive a ciphertext result of the server, the ciphertext result being determined by the query set and the ciphertext vector; and decrypt the ciphertext result using a private key in the public-private key pair to obtain a plaintext message corresponding to the to-be-queried feature field.
[0125] In one embodiment, the number of feature fields in the query set generated by the query set generation module 51 is less than the number of feature fields in the feature set.
[0126] In one embodiment, the ciphertext vector generation module 52 is further configured to determine the dimension of the ciphertext vector according to the total number of feature fields in the query set;
[0127] According to the position of the to-be-queried feature field in the query set, the position of the to-be-queried element in the ciphertext vector is determined;
[0128] Based on the Paillier encryption algorithm, the public key in the public-private key pair is used to encrypt the number 1, and the encrypted result is used as the content of the to-be-queried element; the public key is used to encrypt the number 0, and the encrypted result is used as the content of the remaining elements in the ciphertext vector, thereby obtaining the ciphertext vector.
[0129] In one embodiment, as shown in Figure 6 a homomorphic encryption-based anonymous query device for a server is provided, comprising: a receiving module 61, a query module 62, and an encryption module 63, wherein:
[0130] The receiving module 61 is configured to receive the query set, the ciphertext vector, and the public key sent by the client.
[0131] The query module 62 is configured to obtain a feature field in the query set, query an attribute field according to the feature field, and obtain attribute information in the order of the query set elements based on the attribute field.
[0132] The encryption module 63 is configured to encrypt the attribute information by using the ciphertext vector and the public key to obtain a ciphertext result, and send the ciphertext result to the client.
[0133] In an embodiment, the homomorphic encryption-based anonymous query device applied to the service segment further includes an extraction module 64, which is configured to store plaintext data in a dictionary form, the plaintext data including a feature field and an attribute field corresponding to the feature field in one-to-one manner.
[0134] All the feature fields are extracted to generate a feature set.
[0135] In an embodiment, the encryption module 63 is further configured to perform homomorphic number multiplication calculation on the ciphertext vector and the attribute information by using the public key to obtain the ciphertext result.
[0136] The above-mentioned modules in the homomorphic encryption-based anonymous query device can be realized by software, hardware, and combinations thereof, in whole or in part. The above-mentioned modules can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in a computer device in software form, so as to be called and executed by a processor to perform the operations corresponding to the above-mentioned modules.
[0137] In an embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps in any of the above-mentioned homomorphic encryption-based anonymous query method embodiments.
[0138] In an embodiment, a computer readable storage medium is provided, storing a computer program, and the computer program is executed by a processor to implement the steps in any of the above-mentioned homomorphic encryption-based anonymous query method embodiments.
[0139] In an embodiment, a computer program product is provided, including a computer program, and the computer program is executed by a processor to implement the steps in any of the above-mentioned homomorphic encryption-based anonymous query method embodiments.
[0140] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties.
[0141] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiments. Any reference to memory, database or other medium used in the embodiments provided by the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided by the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided by the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0142] The technical features of the above embodiments can be combined in any way. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described, but as long as the combinations of the technical features do not exist contradictory, it should be considered as the scope of the present application.
[0143] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.
Claims
1. A method for stealth querying based on homomorphic encryption, used on a client side, characterized in that, The method includes: At least two feature fields are selected from the feature set on the server side, and a query set is generated based on the feature fields; one of the feature fields is the feature field to be queried, and the other at least one feature field is randomly selected by the client; the server side stores plaintext data; the plaintext data includes feature fields and attribute fields that correspond one-to-one with the feature fields; the feature set is generated by the server side by extracting the feature fields corresponding to all plaintext data. A public-private key pair is generated based on a homomorphic encryption algorithm. A ciphertext vector is generated based on the query set and the public key in the public-private key pair. The public key, the query set, and the ciphertext vector are then sent to the server. The client receives the encrypted result from the server. The encrypted result is determined by the server querying attribute fields based on feature fields in the query set, assembling attribute information according to the element order in the query set based on the queried attribute fields, and performing homomorphic scalar multiplication on the attribute information and the encrypted vector using the public key. The element order in the query set is determined by the client. The encrypted result is decrypted using the private key in the public-private key pair to obtain the plaintext message corresponding to the feature field to be queried; Generate a ciphertext vector based on the query set and the public key in the public-private key pair, including: The dimension of the ciphertext vector is determined based on the total number of the feature fields in the query set. The position of the element to be queried in the ciphertext vector is determined based on the position of the feature field to be queried in the query set; Based on the Paillier encryption algorithm, the public key in the public-private key pair is used to encrypt the number 1, and the encrypted result is used as the content of the element to be queried. The public key is used to encrypt the number 0, and the encrypted result is used as the content of the remaining elements in the ciphertext vector to obtain the ciphertext vector.
2. The anonymous query method based on homomorphic encryption according to claim 1, characterized in that, Filter at least two feature fields from the feature set on the server, and generate a query set based on the feature fields; After one of the feature fields is the feature field to be queried, it also includes: The number of feature fields in the query set is less than the number of feature fields in the feature set.
3. A stealth query method based on homomorphic encryption, used on the server side, characterized in that, The method includes: The server receives a query set, a ciphertext vector, and a public key sent by a client. The query set is generated by the client selecting at least two feature fields from the feature set on the server, and based on these feature fields. One of the at least two feature fields is the feature field to be queried, and the remaining at least one feature field is randomly selected by the client. The server stores plaintext data. The plaintext data includes feature fields and attribute fields that correspond one-to-one with the feature fields. The feature set is generated by the server extracting the feature fields corresponding to all plaintext data. The system retrieves feature fields from the query set, queries attribute fields based on the feature fields, and obtains attribute information that conforms to the element order in the query set based on the attribute fields; the element order in the query set is determined by the client. The attribute information is encrypted using the ciphertext vector and the public key to obtain the ciphertext result, and the ciphertext result is sent to the client. The attribute information is encrypted using the ciphertext vector and the public key to obtain the ciphertext result, including: Using the public key, a homomorphic scalar multiplication is performed on the ciphertext vector and the attribute information to obtain the ciphertext result; The ciphertext vector is obtained by the client determining the dimension of the ciphertext vector based on the total number of the feature fields in the query set; determining the position of the element to be queried in the ciphertext vector based on the position of the feature field to be queried in the query set; and using the Paillier encryption algorithm, encrypting the number 1 with the public key in the public-private key pair, using the encrypted result as the content of the element to be queried, and encrypting the number 0 with the public key, using the encrypted result as the content of the remaining elements in the ciphertext vector.
4. The anonymity query method based on homomorphic encryption according to claim 3, characterized in that, Before receiving the query set, ciphertext vector, and public key sent by the client, the following is also included: Store plaintext data in dictionary format; Extract all the aforementioned feature fields to generate a feature set.
5. A stealth query device based on homomorphic encryption, used on a client side, characterized in that, The device includes: A query set generation module is used to filter at least two feature fields from the feature set on the server side, and generate a query set based on the feature fields; one of the at least two feature fields is the feature field to be queried; the remaining at least one feature field is randomly selected by the client; the server side stores plaintext data; the plaintext data includes feature fields and attribute fields stored in one-to-one correspondence with the feature fields; the feature set is generated by the server side by extracting the feature fields corresponding to all plaintext data. The ciphertext vector generation module is used to generate a public-private key pair based on a homomorphic encryption algorithm, generate a ciphertext vector based on the query set and the public key in the public-private key pair, and send the public key, the query set and the ciphertext vector to the server. The ciphertext decryption module is used to receive the ciphertext result from the server. The ciphertext result is determined by the server querying attribute fields based on feature fields in the query set, assembling attribute information according to the element order in the query set based on the queried attribute fields, and performing homomorphic scalar multiplication on the attribute information and the ciphertext vector using the public key. The ciphertext result is decrypted using the private key in the public-private key pair to obtain the plaintext message corresponding to the queried feature field. The element order in the query set is determined by the client. Generate a ciphertext vector based on the query set and the public key in the public-private key pair, including: The dimension of the ciphertext vector is determined based on the total number of the feature fields in the query set. The position of the element to be queried in the ciphertext vector is determined based on the position of the feature field to be queried in the query set; Based on the Paillier encryption algorithm, the public key in the public-private key pair is used to encrypt the number 1, and the encrypted result is used as the content of the element to be queried. The public key is used to encrypt the number 0, and the encrypted result is used as the content of the remaining elements in the ciphertext vector to obtain the ciphertext vector.
6. A stealth query device based on homomorphic encryption, used on a server side, characterized in that, The device includes: A receiving module is used to receive a query set, a ciphertext vector, and a public key sent by a client. The query set is generated by the client selecting at least two feature fields from the feature set of the server, and based on these feature fields. One of the at least two feature fields is the feature field to be queried, and the remaining at least one feature field is randomly selected by the client. The server stores plaintext data. The plaintext data includes feature fields and attribute fields that correspond one-to-one with the feature fields. The feature set is generated by the server extracting the feature fields corresponding to all plaintext data. The query module is used to obtain feature fields from the query set, query attribute fields based on the feature fields, and obtain attribute information that conforms to the element order in the query set based on the attribute fields; the element order in the query set is determined by the client. An encryption module is used to encrypt the attribute information using the ciphertext vector and the public key to obtain a ciphertext result, and then send the ciphertext result to the client. The attribute information is encrypted using the ciphertext vector and the public key to obtain the ciphertext result, including: Using the public key, a homomorphic scalar multiplication is performed on the ciphertext vector and the attribute information to obtain the ciphertext result; The ciphertext vector is obtained by the client determining the dimension of the ciphertext vector based on the total number of the feature fields in the query set; determining the position of the element to be queried in the ciphertext vector based on the position of the feature field to be queried in the query set; and using the Paillier encryption algorithm, encrypting the number 1 with the public key in the public-private key pair, using the encrypted result as the content of the element to be queried, and encrypting the number 0 with the public key, using the encrypted result as the content of the remaining elements in the ciphertext vector.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the stealth query method based on homomorphic encryption as described in any one of claims 1 to 4.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the stealth query method based on homomorphic encryption as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Lightweight outsourcing file multi-keyword retrieval method and system with privacy protection function
CN110727951A