A shortest path query method for encrypted graphs satisfying K-hop constraints

Through intermediate point segmentation and pseudo-edge filling technology, combined with asymmetric encryption and homomorphic encryption, the problem of data leakage and inefficiency in encrypted graph data in cloud computing environments is solved, and efficient and secure shortest path query is achieved.

CN119696907BActive Publication Date: 2025-09-02QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411890563.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-09-02
Estimated Expiration
2044-12-20

AI Technical Summary

Technical Problem

Existing encrypted graph data retrieval technology poses the risk of data leakage in cloud computing environments and is inefficient in querying, especially when meeting the shortest path query under specific constraints. The existing methods need to traverse all vertices, resulting in inefficient and inability to effectively locate the shortest path.

Method used

The intermediate point segmentation technology is used to simplify the graph data, generate LP and RP adjacency tables, and use pseudo-edge fill technology to obfuscate the graph structure, combining asymmetric encryption and homomorphic encryption technology to ensure data privacy and accelerate the query process.

Benefits of technology

It realizes the shortest path query of encrypted graph data efficiently and securely when meeting the K-hop constraints, ensures data privacy and improves query efficiency, and can quickly perform path analysis and result return on cloud servers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119696907B_ABST
    Figure CN119696907B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of secure communications, and more specifically, relates to a method for querying the shortest path on an encrypted graph that satisfies a K-hop constraint. The method comprises: a graph data owner generates an authorization token and sends it to a graph data queryer via a secure channel; the graph data queryer encrypts a query request and sends it to the graph data owner; the graph data owner decrypts the query request, processes the original graph data, and encrypts the graph data information, sending it to a cloud server; the cloud server receives the encrypted data, processes the shortest path query, and sends it to the data querying user; the graph data queryer receives the query result and decrypts it using the sk in the authorization token to obtain a plaintext result. This invention solves the problems of data leakage and low query efficiency in existing technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of secure communications, and more specifically, relates to a shortest path query method for an encrypted graph that satisfies a K-hop constraint. Background Art

[0002] In the cloud computing sector, data outsourcing often raises privacy concerns. Graph data encryption has emerged as an effective strategy to address this challenge. By encrypting graph data, cloud service providers can, to a certain extent, prevent it from being stolen or misused. However, encrypting graph data also presents new challenges, particularly in efficiently performing graph queries, such as shortest path queries.

[0003] Chinese patent document CN114707012A discloses a graph encryption shortest path query method and system that supports k unordered nodes. The method is applied to an environment consisting of a user module and a cloud service module; the user module processes the original graph data to calculate the security index of the graph encryption, and generates a query token based on the k unordered nodes queried, uploads the security index and query token to the cloud service module, waits for the query result to be sent back, and then decrypts to obtain the shortest path, otherwise it waits for the query result; the cloud service module receives the security index and query token from the user module, uses the query token to search the security index and return the shortest path passing through the k unordered nodes.

[0004] In some application scenarios, users may need to perform graph retrieval while meeting specific constraints. Existing encrypted graph data retrieval technologies usually need to traverse all vertices in the graph to find the shortest path. These methods are usually unable to effectively locate possible shortest path candidate nodes, so every node and edge in the graph must be checked to determine whether they are part of the shortest path. At the same time, when the existing technology processes data in the cloud, the data content is easily leaked. In response to the shortcomings of the existing technology, the present invention proposes an encrypted graph shortest path query method that meets K-hop constraints. It uses midpoint splitting to ensure that each node and edge meets the constraints, and at the same time uses "pseudo-edge" filling technology to confuse the real graph structure to prevent the cloud server from obtaining graph structure information.

[0005] In view of this, the present invention designs an encrypted graph shortest path query method that satisfies the K-hop constraint to solve the problems of easy data leakage and low query efficiency in the existing technology. Summary of the Invention

[0006] The present invention aims to overcome at least one defect of the above-mentioned prior art and provide an encrypted graph shortest path query method that satisfies the K-hop constraint, so as to solve the problems of easy data leakage and low query efficiency in the prior art.

[0007] The detailed technical solutions of the present invention are as follows:

[0008] A shortest path query method for an encrypted graph satisfying a K-hop constraint, the method comprising:

[0009] S1. The graph data owner generates an authorization token δ and sends it to the graph data queryer through a secure channel;

[0010] δ=(sk,pk,k1,k2,v u ) (1)

[0011] In formula (1), sk is the private key in the key pair (sk, pk) generated by the asymmetric encryption algorithm RSA. sk must be kept secret and only the holder of the key pair can know it and use it to decrypt data; pk is the public key in the key pair (sk, pk) generated by the asymmetric encryption algorithm RSA, which is used to encrypt the query request; k1 and k2 are two keys k1 and k2 generated by a pseudo-random function. k1 is used to encrypt the subsequent encrypted path adjacency list, and k2 is used to encrypt the weight in the homomorphic encryption process. u It is a virtual node that fills the edge and is used to confuse encryption;

[0012] S2. After receiving the authorization token δ, the graph data queryer encrypts its query request query = (k, s, t) using the public key pk in the authorization token and sends it to the graph data owner;

[0013] S3. The graph data owner receives the encrypted query request from the graph data queryer and decrypts it using the private key sk to obtain the original query request query = (k, s, t). Then, based on the decrypted query request, the graph data owner constructs a simple path st in the graph that satisfies the k-hop constraint and determines the adjacency tables that need to be sent to the cloud server LP and RP. Finally, the LP and RP adjacency tables are encrypted and sent to the cloud server.

[0014] S4. The cloud server receives the encrypted adjacency table sent by the data owner. The cloud server then compares the weights in the path information with the received adjacency table data and sends the path with the smallest weight in the path information to the data query user.

[0015] S5. The graph data queryer receives the query result and decrypts it using the authorization token sk to obtain the plaintext result.

[0016] Preferably, according to the present invention, the specific steps of S3 are:

[0017] S31. The data owner uses sk to perform a decryption query request query = (k, s, t) to obtain the jump constraint k, the starting point s, and the end point t;

[0018] S32. Prune the original graph G according to the decrypted jump constraint k, starting point s, and end point t to generate a simplified graph G'.

[0019] S33. Perform midpoint segmentation on the newly generated simplified graph G'. In the simplified graph, scan all nodes to determine which nodes serve as midpoints vc. Each midpoint vc divides the path into two parts, including the path lp from the starting point s to the midpoint vc and the path rp from the end point t to the midpoint vc:

[0020] lp = {s,...,vc},rp ={t,...,vc} (2)

[0021] Correspondingly, the path index is divided into two adjacency lists, LP and RP. LP is used to store the path from the starting point s to the intermediate point vc, and RP is used to store the path from the end point t to the intermediate point vc.

[0022] The path for LP storage must meet the following conditions:

[0023]

[0024] In formula (3), len(lp) represents the length of the path lp from the starting point s to the intermediate point vc, Distt[vc] represents the distance from vc to the end point t, and k represents the jump constraint;

[0025] The RP storage path must meet the following conditions:

[0026]

[0027] In formula (4), len(rp) represents the length of the path rp from the intermediate point vc to the end point t, and Dists(vc) represents the distance from the starting point s to the intermediate point vc;

[0028] For each intermediate point vc, LP stores the number of bytes starting from the starting point s and ranging from 1 to RP stores all paths starting from the end point t, with lengths from 1 to For all paths, the adjacency table structures of LP and RP are as follows:

[0029]

[0030] In formula (5) and formula (6), LP i (vc) represents the path set used to store the path of length i from s to vc; RP j(vc) represents the path set used to store paths of length j from an intermediate point vc to an endpoint t. All intermediate points vc are then broken down and stored according to their specific lengths and conditions, ensuring efficient path segmentation and indexing. The LP and RP adjacency tables now store the intermediate nodes vc and their corresponding path sets.

[0031] S34. The data owner sends the encrypted adjacency lists LP and RP to the cloud server. These encrypted adjacency lists contain all the necessary information for the cloud server to perform the path join operation and find the shortest path st within the k-hop constraint without decryption. The server considers all possible combinations and finds the shortest path that satisfies the conditions.

[0032] Preferably, according to the present invention, the generating of the simplified graph G' is as follows:

[0033] First, create two minimum path edge mapping tables: Dists and Distt. Dists records the minimum path edges from the starting point s to each vertex u, and Distt records the minimum path edges from each vertex u to the end point t.

[0034] Next, use the bidirectional k-1-step breadth-first search algorithm BFS to start from the starting point s and the end point t at the same time, and perform a bidirectional search in opposite directions until k-1 steps are reached or all possible paths are found;

[0035] During the search process, two queues are maintained, one for searching the starting point s and the other for searching the end point t. For each vertex u visited, its value in the Dists and Distt mapping tables is updated. When the bidirectional search is completed, all vertices u participating in the k-step path are determined according to the Dists and Distt mapping tables, that is, the vertex set V':

[0036] V'={u|u∈ V(G)∧Dists[u]+ Distt[u]≤ k} (7)

[0037] In formula (7), V' represents the final vertex set; u represents the vertex in the original graph G; V(G) represents the set of all vertices in the original graph G; Dists[u] represents the minimum number of path edges from the starting point s to the vertex u; Distt[u] represents the minimum number of path edges from the end point t to the vertex u; k represents the jump constraint;

[0038] Construct a simplified graph G' based on the vertex set V'. The simplified graph G' contains all vertices that satisfy the jump constraint k and is a subgraph induced by these vertices and the edges connecting them;

[0039] In the process of constructing the simplified graph G', when reaching the vertex u through a certain path p, it is necessary to evaluate whether the potential path length from the starting point s to the vertex u, and then from the vertex u to the end point t satisfies the given jump constraint k. To this end, it is necessary to check all the outgoing adjacent points v of the vertex u. For each outgoing adjacent point v, calculate the potential path length len_u+1 from the starting point s to v, plus the length Distt[v] of the known shortest path edges from v to the end point t; len_u represents the current path length from s to u; if the total length len_u+1+Distt[v] is less than or equal to k, then this potential path satisfies the jump constraint k, then the path from s through u to v is retained and allowed to appear in the simplified graph G'. On the contrary, if len_u+1+Distt[v] is greater than k, it means that this potential path exceeds the jump constraint k, and this path will not be retained to ensure that it does not appear in the simplified graph G'.

[0040] Preferably, according to the present invention, when constructing the LP and RP adjacency tables, first, a BFS traversal is performed using the starting point s and the end point t as the starting point, respectively: when the BFS traversal starts from the starting point s, each time a new intermediate point is reached, the path from the starting point s to the intermediate point vc and the level information of the intermediate point vc are recorded, and this process is repeated until the specified level is reached; when the BFS traversal starts from the end point t, each time a new intermediate point is reached, the path from the intermediate point vc to the end point t and the level information of the intermediate point vc are recorded, and the level information and path information of each intermediate point vc obtained during the traversal are stored in the adjacency tables LP and RP;

[0041] Preferably, according to the present invention, the encryption of the LP and RP adjacency lists refers to using a hash function H to encrypt each traversed intermediate point vc, converting the unique identifier of the intermediate point into a hash value of a fixed length, and obtaining an encrypted intermediate point identifier H(vc); for path encryption, using the key k1 to encrypt each intermediate point identifier in the path; for the weight of the edge in the graph, using the homomorphic encryption algorithm and the key k2 to encrypt the weight of the edge in the graph, homomorphic encryption allows arithmetic operations on the weight in the encrypted state without the need for decryption, and the encrypted weight is expressed as [n]pkp, where pkp represents the result of encryption using the homomorphic encryption algorithm and the key k2, and n represents the unencrypted weight;

[0042] Preferably, according to the present invention, when constructing the LP and RP adjacency tables, in the process of calculating the path information of all vc and points s and t layer by layer, due to the structure of the graph, the path information of each layer may contain a different number of edges. In order to unify the number of edges contained in the path information of each layer, virtual nodes are used to supplement the number of edges to ensure that the number of edges in each layer is the same, as follows:

[0043] Calculate the path information of each intermediate point vc layer by layer for the vertex set V' to determine the number of edges in each layer of edge information. If the number of edges in a layer is less than the given maximum value Add virtual nodes vu for padding: The virtual nodes vu are only used for padding to make the number of edges in each layer consistent. The virtual nodes vu are given the same identifier as the actual intermediate points vc, but do not represent nodes in the actual graph. The weights of the virtual nodes are set to 0, indicating that they do not increase the path weight. At the same time, the path containing the actual nodes and the virtual nodes is encrypted using the key k1 to ensure the security of the path information.

[0044] The final LP and RP adjacency tables include encrypted vertex identifiers, encrypted path information, and encrypted weights. This structure allows path query and analysis without decryption while protecting the privacy of graph data.

[0045] According to the preferred embodiment of the present invention, the specific steps of S4 are as follows:

[0046] S41, the cloud server receives two encrypted adjacency lists LP and RP sent by the owner of the graph data. The cloud server traverses each intermediate point vc in LP and searches for an intermediate point that matches with one in RP. The matching means that the value of the hash function H(vc) is the same. Once a matching intermediate node is found, the cloud server will i Side Information and RP in (vc) j The side information in (vc) is connected to form a simple path; the connection operation includes merging the left and right paths and adding the weights in the side information using homomorphic encryption technology;

[0047] S42. The cloud server stores the connected simple paths and the calculated weights in a new adjacency table path. The adjacency table path contains the simple paths from the starting point s to the end point t, as well as the total weight of each path.

[0048] S43. The cloud server needs to compare all connected simple paths, retain only the paths that meet the k-hop constraint, and compare the weights of the paths that meet the condition, and select the path with the smallest weight.

[0049] S44. The cloud server sends all the selected path information with the smallest weight to the graph data queryer.

[0050] Preferably, according to the present invention, the S5 comprises the following steps:

[0051] S51. The graph data queryer receives encrypted path information from the cloud server. This information includes each node in the path. The graph data queryer uses its own private key sk to decrypt the received encrypted path information.

[0052] S52. After decryption, the graph data queryer obtains the plaintext path information, including all nodes on the path; the graph data queryer analyzes the decrypted path information to determine all possible paths from s to t;

[0053] The graph data query removes duplicate nodes from the decrypted path to ensure that each intermediate node appears only once. At the same time, the graph data query removes duplicate paths to ensure the accuracy of the results.

[0054] S53. Finally, the graph data queryer obtains one or more shortest paths that meet the query conditions.

[0055] Compared with the prior art, the present invention has the following beneficial effects:

[0056] (1) This paper proposes an innovative shortest path query method based on the k-jump constraint of midpoint cutting, which is specifically used for path query between two points st. In order to ensure that sensitive information such as nodes and paths in graph data is effectively protected and to speed up the retrieval of simple path construction, this paper introduces a pseudo-node filling technology. This technology normalizes the structure of the graph by adding pseudo-nodes, realizes graph obfuscation encryption, and ensures that all nodes have the same degree.

[0057] (2) The present invention proposes a method for generating a simplified graph, which further optimizes the encryption and query process of graph data.

[0058] (3) Using the method of the present invention, users can securely encrypt their local graph data and outsource it to a cloud server, thereby ensuring data security. During the outsourcing process to the cloud server, the method of the present invention can more quickly and efficiently perform shortest path queries on graph data and securely return the query results to the data queryer. In this way, the queryer's query request not only receives an accurate answer, but also significantly improves the security and efficiency of the entire query process. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 This is a flowchart of a method for querying the shortest path in an encrypted graph that satisfies a K-hop constraint, as described in the present invention.

[0060] Figure 2 It is a system model diagram of the method described in the present invention.

[0061] Figure 3 It is the original graph data in the embodiment of the present invention.

[0062] Figure 4 It is a mapping table with the least number of edges in the simplified graph used in the embodiment of the present invention.

[0063] Figure 5It is a simplified graph generated after pruning in an embodiment of the present invention.

[0064] Figure 6 In the embodiment of the present invention, the simplified graph is segmented by midpoints to generate LP and RP adjacency lists.

[0065] Figure 7 The encryption form of the LP and RP adjacency tables in the embodiment of the present invention.

[0066] Figure 8 The path table generated in the embodiment of the present invention. DETAILED DESCRIPTION

[0067] The present disclosure will be further described below with reference to the accompanying drawings and embodiments.

[0068] Example 1

[0069] Ginseng Figure 1 This embodiment provides a method for querying the shortest path in an encrypted graph that satisfies a K-hop constraint, the method comprising:

[0070] S1. Send authorization token: The graph data owner generates an authorization token δ and sends it to the graph data queryer through a secure channel;

[0071] δ=(sk,pk,k1,k2,v u ) (1)

[0072] In formula (1), sk is the private key in the key pair (sk, pk) generated by the asymmetric encryption algorithm RSA. sk must be kept secret and only the holder of the key pair can know it and use it to decrypt data; pk is the public key in the key pair (sk, pk) generated by the asymmetric encryption algorithm RSA, which is used to encrypt the query request; k1 and k2 are two keys k1 and k2 generated by a pseudo-random function. k1 is used to encrypt the subsequent encrypted path adjacency list, and k2 is used to encrypt the weight in the homomorphic encryption process. u It is a virtual node that fills the edge and is used to confuse encryption;

[0073] S2. The user encrypts the query request and sends it to the graph data owner:

[0074] After receiving the authorization token δ, the graph data queryer encrypts its query request query = (k, s, t) using the public key pk in the authorization token and sends it to the graph data owner. Specifically, the public key pk in the key pair (sk, pk) generated by the asymmetric encryption algorithm RSA is used to encrypt the jump constraint k, the starting point s, and the end point t and send it to the graph data owner.

[0075] S3. Decrypting and processing the query request: The graph data owner receives the encrypted query request from the graph data queryer and decrypts it using the private key sk to obtain the original query request query = (k, s, t). Then, based on the decrypted query request, the graph data owner constructs a simple path st in the graph that satisfies the k-hop constraint and determines the adjacency tables that need to be sent to the cloud server LP and RP. Finally, the LP and RP adjacency tables are encrypted and sent to the cloud server.

[0076] S4. Cloud server processes the query:

[0077] 1. The cloud server receives the encrypted adjacency list sent by the data owner.

[0078] 2. The cloud server compares the received adjacency table data with the weights in the path information and sends the path with the smallest weight to the data query user;

[0079] S5. User decrypts the final result:

[0080] The graph data queryer receives the query result and decrypts it using the sk of the authorization token to obtain the plaintext result.

[0081] Preferably, according to the present invention, the specific steps of S3 are:

[0082] S31. The data owner uses sk to perform a decryption query request query = (k, s, t) to obtain the jump constraint k, the starting point s, and the end point t;

[0083] S32. Prune the original graph G according to the decrypted jump constraint k, starting point s, and end point t to generate a simplified graph G', as follows:

[0084] First, create two minimum path edge mapping tables: Dists and Distt. Dists records the minimum path edges from the starting point s to each vertex u, and Distt records the minimum path edges from each vertex u to the end point t.

[0085] Next, use the bidirectional k-1-step breadth-first search algorithm BFS to start from the starting point s and the end point t at the same time, and perform a bidirectional search in opposite directions until k-1 steps are reached or all possible paths are found;

[0086] During the search process, two queues are maintained, one for searching the starting point s and the other for searching the end point t. For each vertex u visited, its value in the Dists and Distt mapping tables is updated. When the bidirectional search is completed, all vertices u that may participate in the k-step path are determined according to the Dists and Distt mapping tables, that is, the vertex set V':

[0087] V'={u|u∈ V(G)∧Dists[u]+ Distt[u]≤ k} (2)

[0088] In formula (2), V' represents the final vertex set, which are the vertices that meet the jump constraint k determined in the bidirectional search process from the starting point s and the end point t; u represents a vertex in the original graph G. In the formula, u represents any vertex that needs to meet specific conditions to be included in the vertex set V'; V(G) represents the set of all vertices in the original graph G; Dists[u] represents the minimum number of path edges from the starting point s to the vertex u, and this value is updated during the search process of the starting point s; Distt[u] represents the minimum number of path edges from the end point t to the vertex u, and this value is updated during the search process of the end point t; k represents the jump constraint, which is a limit value given by the data queryer. k stipulates the maximum limit on the number of steps in the path from the starting point s to the end point t; Dists[u]+Distt[u]≤k is a condition that means that the minimum number of path edges from the starting point s to the vertex u plus the minimum number of path edges from the end point t to the vertex u must be less than or equal to the jump constraint k. Only vertices that meet this condition will be included in the vertex set V'.

[0089] Construct a simplified graph G' based on the vertex set V'. The simplified graph G' contains all vertices that satisfy the jump constraint k and is a subgraph induced by these vertices and the edges connecting them;

[0090] In the process of constructing the simplified graph G', when reaching the vertex u through a certain path p, it is necessary to evaluate whether the potential path length from the starting point s to the vertex u, and then from the vertex u to the end point t satisfies the given jump constraint k. To this end, it is necessary to check all the outgoing adjacent points v of the vertex u. For each outgoing adjacent point v, calculate the potential path length len(lp)+1 from the starting point s to v, plus the length Distt[v] of the known shortest path edges from v to the end point t; len_u represents the current path length from s to u; if the total length len_u+1+Distt[v] is less than or equal to k, then this potential path satisfies the jump constraint, and the path from s through u to v is retained, allowing it to appear in the simplified graph G'. On the contrary, if len_u+1+Distt[v] is greater than k, it means that this potential path exceeds the jump constraint, and this path will not be retained to ensure that it does not appear in the simplified graph G'.

[0091] S33. Perform midpoint segmentation on the newly generated simplified graph G', find all possible midpoints vc in the simplified graph G', and use each midpoint vc to divide the path into two parts, lp and rp:

[0092] lp = {s,...,vc},rp ={t,...,vc} (3)

[0093] Correspondingly, the path index is divided into two adjacency lists, LP and RP. LP is used to store the path from the starting point s to the intermediate point vc, and RP is used to store the path from the end point t to the intermediate point vc.

[0094] The path for LP storage must meet the following conditions:

[0095]

[0096] In formula (4), len(lp) represents the length of the path lp from the starting point s to the intermediate point vc, Distt[vc] represents the distance from vc to the end point t, and k represents the jump constraint;

[0097] The RP storage path must meet the following conditions:

[0098]

[0099] In formula (5), len(rp) represents the length of the path rp from the intermediate point vc to the end point t, and Dists(vc) represents the distance from the starting point s to vc;

[0100] For each intermediate point vc, LP stores the number of bytes starting from the starting point s and ranging from 1 to RP stores all paths starting from the end point t, with lengths from 1 to For all paths, the adjacency table structures of LP and RP are as follows:

[0101]

[0102] In formula (6) and formula (7), LP i (vc) represents the path set used to store the path of length i from s to vc; RP j (vc) represents the path set used to store the path of length j from vc to t;

[0103] When constructing the adjacency lists LP and RP, we use the starting point s and the ending point t as the starting point and perform a layer-by-layer traversal. This process records the level information and path of each intermediate point vc. Starting from the starting point s, we perform a BFS traversal. Every time we reach a new vertex, we record the path from s to that vertex. This process repeats until the specified level or condition is reached.

[0104] Similarly, starting from the endpoint t, perform a BFS traversal and record the path from that vertex to t. The hierarchical information and path of each vertex vc obtained during the traversal are stored in the adjacency lists LP and RP. These tables are used to store all paths associated with each intermediate vertex vc. Simultaneously, the adjacency lists LP and RP are encrypted. Specifically, each traversed vertex vc is encrypted using the hash function H, resulting in an encrypted vertex identifier H(vc). The hash function converts the unique vertex identifier into a fixed-length hash value, which is used as the encrypted representation of the vertex in the index. For path encryption, the path should be encrypted using the key k1. This may involve encrypting each vertex identifier in the path to ensure the security of the path information. Edge weights in the graph are encrypted using a homomorphic encryption algorithm and the key k2. Homomorphic encryption allows arithmetic operations on weights in an encrypted state without decryption. The encrypted weights are represented as [n]pkp, where pkp represents the result of encryption using the homomorphic encryption algorithm and the key k2. The final LP and RP adjacency tables contain encrypted vertex identifiers, encrypted path information, and encrypted weights. This structure allows path query and analysis without decryption while protecting the privacy of the graph data.

[0105] When constructing the adjacency lists LP and RP, in order to ensure that the number of edges in the edge information of each layer is equal, virtual nodes are used to supplement the number of edges. The edge information of all vc and points s and t is calculated layer by layer. Due to the structure of the graph, the edge information of each layer may contain a different number of edges. In order to unify the structure of the edge information, it is necessary to ensure that the number of edges in each layer is the same. Specifically: for the vertex set V', the path information of each intermediate point vc is calculated layer by layer to determine the number of edges in the edge information of each layer. If the number of edges in a layer is less than the given maximum value, Add virtual nodes vu for padding: The virtual nodes vu are only used for padding to make the number of edges in each layer consistent. The virtual nodes vu are given the same identifier as the actual intermediate points vc, but do not represent nodes in the actual graph. The weights of the virtual nodes are set to 0, indicating that they do not increase the path weight. At the same time, the path containing the actual nodes and virtual nodes is encrypted using the key k1 to ensure the security of the path information. The above is based on the actual nodes and virtual nodes to unify the number of edges contained in the path information of the adjacency tables LP and RP. By adding virtual nodes, the edge information structure of each layer is ensured to be consistent, which enhances the stability of the path index and the efficiency of data processing.

[0106] S34. The data owner sends the encrypted adjacency lists LP and RP to the cloud server. These encrypted adjacency lists contain all the necessary information for the cloud server to perform the path join operation and find the shortest path st within the k-hop constraint without decryption. The server considers all possible combinations and finds the shortest path that satisfies the conditions.

[0107] The specific steps of S4 are as follows:

[0108] S4.1. The cloud server receives two encrypted adjacency lists LP and RP sent by the data owner, traverses each intermediate node vc in LP, and searches for intermediate nodes that match those in RP. The matching basis is whether the values ​​of the hash function H(vc) are the same. If the H(vc) values ​​in the two tables are the same, it indicates that they may be the same node. Once a matching intermediate node is found, the server connects the path information in LP and RP. The connection operation includes merging the paths on the left and right sides, and adding the weights in the side information using homomorphic encryption technology. Since the weights are encrypted using homomorphic encryption technology, the server can directly perform addition operations on the encrypted weights without decryption.

[0109] S4.2. The server stores the connected simple paths and the calculated weights in a new adjacency table path. This adjacency table path contains the simple paths from s to t and the total weight of each path.

[0110] S4.3. The server needs to compare all connected paths to ensure that only paths that meet the k-hop constraint are retained, compare the weights of the paths that meet the conditions, and select the path with the smallest weight.

[0111] S4.4. The cloud server sends all the selected path information with the smallest weight to the graph data queryer.

[0112] The specific steps of S5 are as follows:

[0113] S51. Data query: The path information received by the user from the cloud server is encrypted, including each node in the path. The user uses his or her private key sk to decrypt the received encrypted path information.

[0114] S52. After decryption, the user obtains the plaintext path information, including all nodes on the path. The user analyzes the decrypted path information to determine all possible paths from s to t.

[0115] The user removes duplicate nodes from the decrypted path, ensuring that each intermediate node appears only once. This is to simplify the path. At the same time, the user needs to remove duplicate paths to ensure the accuracy of the results.

[0116] S53. Finally, the user obtains one or more shortest paths that meet the query conditions.

[0117] Example 2

[0118] This implementation provides a method for querying the shortest path between two points within a 5-hop constraint, including a graph data owner, a cloud server, and a graph data queryer; Figure 2 As shown, the graph data owner is the holder of the graph, and its main function is to send the authorization token to the inquirer, process the inquirer's query request, and send the encrypted data to the cloud server; the cloud server is mainly responsible for receiving the encrypted data, calculating the encryption result and sending it to the data inquirer; the graph data inquirer is mainly responsible for receiving the authorization token and sending the query request to the data owner. Finally, it will receive the ciphertext result sent by the cloud server and decrypt it to obtain the plaintext result of the query request.

[0119] The specific steps are as follows:

[0120] S1. The graph data owner sends an authorization token to the data queryer;

[0121] S2. The data queryer receives the authorization token and sends a query command query = (5, s, t);

[0122] S3. The graph data owner decrypts the query request and constructs a simple path of st that satisfies the 5-hop constraint based on the original graph data according to the query request and sends it to the cloud server segment;

[0123] S4. The cloud server receives the encrypted data and queries the path with the minimum weight.

[0124] S5. The data queryer decrypts and obtains the plaintext result.

[0125] Specifically, the S1 specifically includes:

[0126] S1.1. Set a security parameter λ and generate random values ​​k1, k2 → {0, 1} based on the given security parameter. λ ,Generate a key pair (sk, pk) according to the homomorphic encryption algorithm;

[0127] S1.2. The keys generated above are converted into authorization tokens δ = (sk, pk, k1, k2, v u ) and sent to users with query needs through a secure channel.

[0128] Specifically, the S2 specifically includes:

[0129] S2.1. The data queryer receives the authorization token and encrypts the query request query = (5, s, t) using the public key pk:

[0130] C=Encrypt pk (query)

[0131] S2.2. The data queryer sends the encrypted C to the data user for calculation;

[0132] Specifically, the S3 specifically includes:

[0133] S3.1. The data owner receives the query request sent by the data queryer and decrypts it using the private key sk to obtain query = (5, s, t);

[0134] S3.2. The data owner makes the original image as follows according to k, s, t Figure 3 Prune and generate a simplified graph G'. First, construct two edge number mapping tables Dists and Distt. Dists records the number of edges in the shortest path from the starting point s to each vertex u, and Distt records the number of edges in the shortest path from each vertex u to the end point t, as shown in the following example: Figure 4 As shown in the figure, a bidirectional 4-step breadth-first search BFS algorithm is used to start from the starting point s and the end point t at the same time, and search in opposite directions until it reaches 4 steps or all possible paths are found. When the bidirectional search is completed, all vertices that may participate in the k-step path are determined according to the Dists and Distt mapping tables, that is, the vertex set of the simplified graph:

[0135] V'={u|u∈V(G)∧Dists[u]+Distt[u]≤5}

[0136] The graph contains all vertices that satisfy the jump constraint k and is a subgraph induced by these vertices and their connecting edges.

[0137] S3.3. After eliminating the vertices that do not meet the conditions, the simplified graph needs to be optimized again, that is, the distance is pruned, some invalid paths are deleted, and according to the length len_u of the edge that s passes through to reach a vertex u through a certain path p, all the adjacent points v of u are checked. If len_u+1+Distt[v]≤5 is satisfied, the valid path is retained, otherwise the path is pruned. For example, {s, d, e, a, b, c, t}, at this time u=e's len_u is 2, and the adjacent vertex Distt[a]=3 is checked, so len_u+1+Distt[v]≤5 is not satisfied, and it is pruned. At this time, the generated simplified graph is as follows Figure 5 As shown;

[0138] S3.4. Split the simplified graph G' into the middle point vc, and divide the index into two parts LP and RP adjacency tables, and satisfy len(lp)+Distt(vc)≤5 and Stored as the left partial path and will satisfy len(rp)+Dists(vc)≤5 and Stored as the right partial path, e.g. Figure 6 As shown;

[0139] S3.5. At the same time, the vertices traversed layer by layer are encrypted using the hash function H(vc), and the path information in the adjacency table is encrypted using k1 and the weight is encrypted using homomorphic encryption. The encryption key is k2 and the encryption form is [weight] pkp. The number of edges passed in the path information is calculated according to LP. i (vc) and RP j The maximum value of i and j in (vc) and To fill in the pseudo edge, fill the virtual node vu after vc. The weight of the edge between vc and the virtual node vu is 0 and encrypted using k1. Figure 7 As shown;

[0140] S3.6. The data owner uploads the encrypted LP and RP adjacency tables to the cloud server.

[0141] Specifically, the S4 specifically includes:

[0142] S4.1. The cloud server receives two encrypted adjacency lists LP and RP sent by the data owner. The server traverses each intermediate node vc in LP to find an intermediate node that matches the one in RP. If the H(vc) values ​​in the two tables are the same, it means that a matching intermediate node has been found. The server connects the path information in LP with the path information in RP, that is, merges the paths on the left and right sides. During the connection process, the server uses homomorphic encryption technology to add the weights in the path information. The server stores the connected simple path and the calculated weights in a new adjacency table path. This adjacency table path contains the potential paths from s to t, as well as the total weight of each path, such as Figure 8 As shown;

[0143] S4.2. Compare the weights in the path table and return the path with the smallest weight to the cloud server, that is,

[0144] Enc k1 (s,d,v u ,v u ,d,c,t),(s,d,c,v u ,v u ,c,t);

[0145] Specifically, the S5 specifically includes:

[0146] S5.1. The data queryer receives the path information sent by the cloud server, decrypts it using sk and removes the virtual node v u Derive the simple paths (s, d, d, c, t) and (s, d, c, c, t).

[0147] S5.2. The user needs to check all paths, remove duplicate nodes in the paths, ensure that each intermediate node appears only once, and remove duplicate paths to obtain the final result. The shortest path to st within 5 hops that meets the query request is (s, d, c, t).

Claims

1. A shortest path query method for an encrypted graph satisfying k-hop constraints, characterized by: The method comprises: S1. The graph data owner generates an authorization token and sent to the graph data queryer through a secure channel; (1) In formula (1), sk is the private key in the key pair (sk, pk) generated by the asymmetric encryption algorithm RSA. sk must be kept confidential and only the holder of the key pair can know it and use it to decrypt data; pk is the public key in the key pair (sk, pk) generated by the asymmetric encryption algorithm RSA, which is used to encrypt query requests; k1 and k2 are two keys k1 and k2 generated using a pseudo-random function. k1 is used to encrypt the subsequent encrypted path adjacency list, and k2 is used to encrypt the weights in the homomorphic encryption process. It is a virtual node that fills the edge and is used to confuse encryption; S2. The graph data queryer receives the authorization token Afterwards, send your query request Use the public key pk in the authorization token to encrypt and send it to the graph data owner; S3. The graph data owner receives the encrypted query request from the graph data queryer and decrypts it using the private key sk to obtain the original query request. Then, the graph data owner constructs a simple path of st that meets the k-hop limit in the graph based on the decrypted query request, and determines the LP and RP adjacency tables that need to be sent to the cloud server. Finally, the LP and RP adjacency tables are encrypted and sent to the cloud server. The specific steps include: S31. The graph data owner uses sk to make a decryption query request , get the jump constraint k, starting point s and end point t; S32: Prune the original graph G according to the decrypted jump constraint k, starting point s and end point t to generate a simplified graph. ; S33. Newly generated simplified graph Perform midpoint splitting. In the simplified graph, scan all nodes and determine which nodes are midpoints vc. Each midpoint vc divides the path into two parts, including the path lp from the starting point s to the midpoint vc and the path rp from the end point t to the midpoint vc: (2) Correspondingly, the path index is divided into LP and RP adjacency lists. LP is used to store the path from the starting point s to the intermediate point vc, and RP is used to store the path from the end point t to the intermediate point vc. The path for LP storage must meet the following conditions: (3) In formula (3), len(lp) represents the length of the path lp from the starting point s to the intermediate point vc, Distt[vc] represents the distance from vc to the end point t, and k represents the jump constraint; The RP storage path must meet the following conditions: (4) In formula (4), represents the length of the path rp from the intermediate point vc to the end point t, Represents the distance from the starting point s to the middle point vc; For each intermediate point vc, Storage starts from the starting point s, the length ranges from 1 to All paths of Storage starts from the end point t, with length from 1 to For all paths, the adjacency table structures of LP and RP are as follows: (5) (6) In formula (5) and formula (6), Represents a path set used to store paths of length i from s to vc; It represents the path set used to store the path of length j from the intermediate point vc to the end point t. At this time, the LP and RP adjacency tables store the intermediate point vc and the corresponding path set. S34, the graph data owner sends the encrypted adjacency lists LP and RP to the cloud server; The encryption of the LP and RP adjacency lists refers to encrypting each traversed intermediate point vc using a hash function H, converting the unique identifier of the intermediate point into a hash value of a fixed length, and obtaining an encrypted intermediate point identifier H(vc); for path encryption, each intermediate point identifier in the path is encrypted using a key k1; for the weights of the edges in the graph, the weights of the edges in the graph are encrypted using a homomorphic encryption algorithm and a key k2, and the encrypted weights are expressed as [n]pkp, where pkp represents the result of encryption using the homomorphic encryption algorithm and the key k2, and n represents the unencrypted weight; S4. The cloud server receives the encrypted adjacency list sent by the graph data owner. The cloud server then compares the weights in the path information with the received adjacency list data and sends the path with the smallest weight in the path information to the graph data queryer. The specific steps are as follows: S41. The cloud server receives two encrypted adjacency lists sent by the graph data owner. and , cloud server pair Traverse each intermediate point vc in and find The matching intermediate point in the network, where the matching means that the value of the hash function H(vc) is the same, once a matching intermediate node is found, the cloud server will The side information in The edge information in the is connected to form a simple path; the connection operation includes merging the paths on the left and right sides and adding the weights in the edge information using homomorphic encryption technology; S42. The cloud server stores the connected simple paths and the calculated weights in a new adjacency table path. The adjacency table path contains the simple paths from the starting point s to the end point t, as well as the total weight of each path. S43. The cloud server needs to compare all connected simple paths, retain only the paths that meet the k-hop constraint, and compare the weights of the paths that meet the condition, and select the path with the smallest weight. S44. The cloud server sends all selected path information with the smallest weight to the graph data queryer. S5. The graph data queryer receives the query result and decrypts it using the authorization token sk to obtain the plaintext result.

2. The method for querying the shortest path of an encrypted graph satisfying a k-hop constraint according to claim 1, characterized in that: The generated simplified graph , as follows: First, create two minimum path edge mapping tables: Dists and Distt. Dists records the minimum path edges from the starting point s to each vertex u, and Distt records the minimum path edges from each vertex u to the end point t. Next, use the bidirectional k-1-step breadth-first search algorithm BFS to start from the starting point s and the end point t at the same time, and perform a bidirectional search in opposite directions until k-1 steps are reached or all possible paths are found; During the search process, two queues are maintained, one for searching the starting point s and the other for searching the end point t. For each vertex u visited, its value in the Dists and Distt mapping tables is updated. When the bidirectional search is completed, all vertices u participating in the k-step path are determined according to the Dists and Distt mapping tables, that is, the vertex set : (7) In formula (7), Represents the final set of vertices; u represents a vertex in the original graph G; V(G) represents the set of all vertices in the original graph G; Dists[u] represents the minimum number of path edges from the starting point s to the vertex u; Distt[u] represents the minimum number of path edges from the end point t to the vertex u; k represents the jump constraint; According to the vertex set Constructing a simplified graph , simplified diagram Contains all vertices that satisfy the jump constraint k, and is the subgraph induced by these vertices and the edges connecting them; When building a simplified graph In the process, check all out-adjacent points v of vertex u, and for each out-adjacent point v, calculate the potential path length from the starting point s to v , plus the length of the known shortest path from v to the end point t, Distt[v]; Indicates the current path length from s to u; if the total length is less than or equal to k, then this potential path satisfies the jump constraint k, then the path from s through u to v is retained and allowed to appear in the simplified graph G'. If If it is greater than k, this path will not be retained, ensuring that it will not appear in the simplified graph G'.

3. The method for querying the shortest path of an encrypted graph satisfying a k-hop constraint according to claim 2, wherein: When constructing the LP and RP adjacency tables, first, the starting point s and the end point t are used as the starting points respectively to perform BFS traversal: when starting the BFS traversal from the starting point s, each time a new intermediate point is reached, the path from the starting point s to the intermediate point vc and the level information of the intermediate point vc are recorded, and this process is repeated until the specified level is reached; when starting the BFS traversal from the end point t, each time a new intermediate point is reached, the path from the intermediate point vc to the end point t and the level information of the intermediate point vc are recorded, and the level information and path information of each intermediate point vc obtained during the traversal process are stored in the adjacency lists LP and RP.

4. The method for querying the shortest path of an encrypted graph satisfying a k-hop constraint according to claim 3, characterized in that: When constructing the LP and RP adjacency tables, virtual nodes are used to supplement the number of edges in the process of calculating the path information between all vc and points s and t layer by layer to ensure that the number of edges in each layer is the same, as follows: Vertex Set Calculate the path information of each intermediate point vc layer by layer to determine the number of edges in each layer of edge information. If the number of edges in a layer is less than the given maximum value or , add a virtual node Fill in: the virtual node Only used for filling, so that the number of edges in each layer is consistent, virtual nodes It is assigned the same identity as the actual intermediate point vc, but does not represent a node in the actual graph. The weight of the virtual node is set to 0. At the same time, the path containing the actual node and the virtual node is encrypted using the key k1. The final LP and RP adjacency tables include encrypted vertex identifiers, encrypted path information, and encrypted weights.

5. The method for querying the shortest path of an encrypted graph satisfying a k-hop constraint according to claim 1, wherein: The specific steps of S5 are as follows: S51. The graph data queryer receives encrypted path information from the cloud server. This information includes each node in the path. The graph data queryer uses its own private key sk to decrypt the received encrypted path information. S52. After decryption, the graph data queryer obtains the plaintext path information, including all nodes on the path; the graph data queryer analyzes the decrypted path information to determine all possible paths from s to t; The graph data query removes duplicate nodes from the decrypted path to ensure that each intermediate node appears only once. At the same time, the graph data query removes duplicate paths to ensure the accuracy of the results. S53. Finally, the graph data queryer obtains one or more shortest paths that meet the query conditions.

Citation Information

Patent Citations

  • Graph encryption shortest path query method and system supporting k disordered nodes

    CN114707012A

  • Simple path query system and method under constraint of k-hop between two points on graph based on heterogeneous architecture

    CN114661756A

  • Filling dictionary encryption-based graph structure shortest path query method

    CN117349894A