Encrypted graph shortest path query method meeting K-hop constraint

The simplified graph is generated through intermediate point segmentation and pseudo-edge filling techniques, which solves the problems of low data retrieval efficiency and data leakage under K-hop constraints in the prior art, and realizes efficient and secure data retrieval of encrypted graphs.

CN119696907AActive Publication Date: 2025-03-25QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1

Patent Information

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

AI Technical Summary

Technical Problem

The existing encrypted graph data retrieval technology meets the K-hop constraint, the query efficiency is low and the data is easily leaked.

Method used

The intermediate point segmentation technology is used to generate a simplified graph, and the graph structure is obfuscated through pseudo-edge filling technology to ensure that each node and edge meets the constraints, and encrypted path query is performed on the cloud server side.

Benefits of technology

Improve the query efficiency of encrypted graph data retrieval, ensure data security, avoid data leakage, and perform path connection operations without decryption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119696907A_ABST
    Figure CN119696907A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of secret communication, and particularly relates to an encrypted graph shortest path query method meeting K-hop constraint. The method comprises the following steps: a graph data owner generates an authorization token and sends the authorization token to a graph data querier through a secure channel; the graph data querier encrypts the query request and sends the query request to the graph data owner; the graph data owner decrypts the query request, processes the original graph data, encrypts graph data information and sends the encrypted graph data information to the cloud server; the cloud server receives the encrypted data processing query shortest path and sends the path to a data query user; and the graph data querier receives a query result and decrypts the query result by using sk of the authorization token to obtain a plaintext result. The problems of easy data leakage and low query efficiency in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the field of cloud computing, data outsourcing often raises privacy protection issues. To address this challenge, graph data encryption has become an effective strategy. By encrypting graph data, cloud service providers can be prevented from stealing or abusing this data to a certain extent. However, encrypted graph data also brings new challenges, especially when performing graph query operations, such as how to efficiently perform 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 the 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 returns the shortest path passing through the k unordered nodes.

[0004] In some application scenarios, users may need to perform graph retrieval while satisfying specific constraints. Existing encrypted graph data retrieval technologies usually need to traverse all vertices in the graph to find the shortest path. These methods usually cannot effectively locate possible shortest path candidate nodes, so each 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 prior art processes data in the cloud, the data content is easily leaked. In view of the shortcomings of the prior art, the present invention proposes an encrypted graph shortest path query method that satisfies K-hop constraints. It uses midpoint segmentation to ensure that each node and edge satisfies the constraints, and 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 prior art. 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 scheme of the present invention is 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 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 by a pseudo-random function. k1 is used to encrypt the subsequent encrypted path adjacency table, and k2 is used to encrypt the weights in the homomorphic encryption process. u Virtual nodes are used to fill edges and 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, decrypts it using the private key sk, and obtains the original query request query = (k, s, t); then, the graph data owner constructs a simple path of st that satisfies the k-hop restriction in the graph based on the decrypted query request, and determines the adjacency tables LP and RP that need to be sent to the cloud server, and finally encrypts the LP and RP adjacency tables and sends them to the cloud server;

[0014] S4, the cloud server receives the encrypted adjacency table sent by the data owner; then, the cloud server 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, 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, pruning the original graph G according to the decrypted jump constraint k, the starting point s and the 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 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:

[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 middle point vc, and RP is used to store the path from the end point t to the middle 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 middle point vc to the end point t, and Dists(vc) represents the distance from the starting point s to the middle point vc;

[0028] For each intermediate point vc, LP stores the length from 1 to RP stores all paths starting from the end point t, with lengths ranging 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 a path set used to store paths of length i from s to vc; RP j(vc) represents the path set used to store the path of length j from the intermediate point vc to the end point t; in this way, all intermediate points vc will be refined and stored according to specific lengths and conditions to ensure efficient management of path segmentation and indexing. At this time, the LP and RP adjacency tables store the intermediate nodes vc and the corresponding path sets.

[0031] S34, the data owner sends the encrypted adjacency lists LP and RP to the cloud server, which contain all the necessary information so that the cloud server can perform path connection operations and find the shortest path of st within the k-hop constraint without decryption. The server will consider all possible combinations and find the shortest path that meets the conditions.

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

[0033] First, create two minimum path edge number mapping tables: Dists and Distt. Dists records the minimum path edge number from the starting point s to each vertex u, and Distt records the minimum path edge number 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 visited vertex u, 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 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, 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 k, and this path will not be retained to ensure that it does not appear in the simplified graph G'.

[0040] Preferably, 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 performing 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 is repeated until the specified level is reached; when performing 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 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 a key k1 to encrypt each intermediate point identifier in the path; for the weights of the edges in the graph, using a homomorphic encryption algorithm and a key k2 to encrypt the weights of the edges in the graph, homomorphic encryption allows arithmetic operations to be performed on the weights in an encrypted state without the need for decryption, and the encrypted weights are expressed as [n]pkp, where pkp represents the result of encryption using a homomorphic encryption algorithm and a 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 two 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 of 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 filling: the virtual nodes vu are only used for filling 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 key k1 is used to encrypt the path containing the actual nodes and the virtual nodes 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] Preferably, 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, and traverses each intermediate point vc in LP to find an intermediate point that matches with that 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 adds LP to the encrypted adjacency list. 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 paths on the left and right sides, 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, where the adjacency table path includes the simple paths from the starting point s to the end point t, and 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 path information received by the graph data queryer from the cloud server is encrypted, and the 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) The present invention proposes an innovative shortest path query method, which is based on the k-jump constraint of midpoint cutting and 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, the present invention introduces a pseudo-node filling technology, which 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 safely encrypt local graph data and outsource it to the cloud server, thereby ensuring data security. In the process of outsourcing to the cloud server, the method of the present invention can more quickly and efficiently perform shortest path queries on graph data and safely return the query results to the data queryer. In this way, the query request of the data queryer not only receives an accurate answer, but also the security and efficiency of the entire query process are significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 It is a flow chart of a method for querying the shortest path of an encrypted graph that satisfies K-hop constraints 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 the embodiment of the present invention.

[0064] Figure 6 The simplified graph in the embodiment of the present invention generates LP and RP adjacency lists by midpoint segmentation.

[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 is further described below in conjunction with the accompanying drawings and embodiments.

[0068] Embodiment 1,

[0069] Ginseng Figure 1 This embodiment provides a shortest path query method for 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 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 by a pseudo-random function. k1 is used to encrypt the subsequent encrypted path adjacency table, and k2 is used to encrypt the weights in the homomorphic encryption process. u Virtual nodes are used to fill edges and 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. Decrypt and process 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, the graph data owner constructs a simple path of st that satisfies the k-hop restriction in the graph based on the decrypted query request, and determines the adjacency tables LP and RP that need to be sent to the cloud server, and finally encrypts the LP and RP adjacency tables and sends them to the cloud server;

[0076] S4, cloud server processing query:

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

[0078] 2. The cloud server 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;

[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, 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, the starting point s and the end point t to generate a simplified graph G', as follows:

[0084] First, create two minimum path edge number mapping tables: Dists and Distt. Dists records the minimum path edge number from the starting point s to each vertex u, and Distt records the minimum path edge number 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 visited vertex u, 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, which 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 vertex u through a certain path p, it is necessary to evaluate whether the potential path length from the starting point s to vertex u, and then from vertex u to the end point t satisfies the given jump constraint k. To this end, it is necessary to check all outgoing adjacent points v of 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 middle point vc, and RP is used to store the path from the end point t to the middle 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 length from 1 to RP stores all paths starting from the end point t, with lengths ranging 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 a path set used to store paths 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, use the starting point s and the end point t as the starting point, and perform layer-by-layer traversal. This process records the level information and path of each intermediate point vc. Starting from the starting point s, perform BFS traversal. Every time a new vertex is reached, the path from s to the vertex is recorded. This process is repeated until the specified level or condition is reached;

[0104] Similarly, starting from the end point t, perform BFS traversal and record the path from the vertex to t. Store the hierarchical information and path of each vertex vc obtained during the traversal in the adjacency lists LP and RP, which are used to store all paths related to each intermediate point vc. At the same time, encrypt the adjacency lists LP and RP. Specifically, use the hash function H to encrypt each traversed vertex vc to obtain the encrypted vertex identifier H(vc). The hash function can convert the unique identifier of the vertex 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. Encrypt the edge weights in the graph using the 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 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;

[0105] When constructing the adjacency lists LP and RP, virtual nodes are used to make up the number of edges in order to ensure that the number of edges in each layer of edge information is equal. 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 different numbers 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. The details are as follows: 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 node vu for filling: the virtual node vu is only used for filling to make the number of edges in each layer consistent. The virtual node vu is given the same identifier as the actual intermediate point vc, but does not represent the node in the actual graph. The weight of the virtual node is set to 0, indicating that they do not increase the path weight. At the same time, the path containing the actual node and the virtual node 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 consistency of the edge information structure of each layer is ensured, 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, which contain all the necessary information so that the cloud server can perform path connection operations and find the shortest path of st within the k-hop constraint without decryption. The server will consider all possible combinations and find the shortest path that meets 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, and 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, and the information includes each node in the path. The user uses his own 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, and 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 to ensure 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] Embodiment 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 in the figure, 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, and finally receives the ciphertext result sent by the cloud server, decrypts 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 query request for the original graph data 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} according to the given security parameter λ , Generate a key pair (sk, pk) according to the homomorphic encryption algorithm;

[0127] S1.2. The keys generated above are used to form an authorization token δ = (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 uses the public key pk to encrypt the query request query = (5, s, t):

[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 uses the private key sk to decrypt the query = (5, s, t);

[0134] S3.2. The data owner makes the original image 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 from the starting point s to each vertex u, and Distt records the number of edges from each vertex u to the end point t, such as 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 4 steps are reached 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 outgoing 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 two parts: LP and RP adjacency tables, and set the table to 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, such as Figure 6 As shown;

[0139] S3.5. At the same time, the vertices traversed layer by layer are encrypted using a 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 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, the virtual node vu is filled 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 the 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 is 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. 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 We get 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 of 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 a K-hop constraint, characterized in that: The method comprises: S1. The graph data owner generates an authorization token δ and sends it to the graph data queryer through a secure channel; δ=(sk,pk,k1,k2,v u ) (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 secret and only the holder of the key pair can know 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 by a pseudo-random function. k1 is used to encrypt the subsequent encrypted path adjacency table, and k2 is used to encrypt the weights in the homomorphic encryption process. u Virtual nodes are used to fill edges and confuse encryption; 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; S3, the graph data owner receives the encrypted query request from the graph data queryer, decrypts it using the private key sk, and obtains the original query request query = (k, s, t); then, the graph data owner constructs a simple path of st that satisfies the k-hop restriction in the graph based on the decrypted query request, and determines the adjacency tables LP and RP that need to be sent to the cloud server, and finally encrypts the LP and RP adjacency tables and sends them to the cloud server; S4, the cloud server receives the encrypted adjacency table sent by the data owner; then, the cloud server 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; 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 specific steps of S3 are: 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; S32, pruning the original graph G according to the decrypted jump constraint k, the starting point s and the end point t to generate a simplified graph G'; S33, perform midpoint segmentation on the newly generated simplified graph G'. In the simplified graph, scan all nodes to 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: lp = {s,...,vc},rp ={t,...,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: 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: In formula (4), len(rp) represents the length of the path rp from the middle point vc to the end point t, and Dists(vc) represents the distance from the starting point s to the middle point vc; For each intermediate point vc, LP stores the length from 1 to RP stores all paths starting from the end point t, with lengths ranging from 1 to For all paths, the adjacency table structures of LP and RP are as follows: In formula (5) and formula (6), LP i (vc) represents a path set used to store paths of length i from s to vc; RP j (vc) 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 node vc and the corresponding path set; S34. The data owner sends the encrypted adjacency lists LP and RP to the cloud server.

3. The method for querying the shortest path of an encrypted graph satisfying a K-hop constraint according to claim 2, characterized in that: The generating of the simplified graph G' is as follows: First, create two minimum path edge number mapping tables: Dists and Distt. Dists records the minimum path edge number from the starting point s to each vertex u, and Distt records the minimum path edge number 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 visited vertex u, 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': V'={u|u∈ V(G)∧Dists[u]+ Distt[u]≤ k} (7) 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; 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; In the process of constructing the simplified graph G', check all out-neighboring points v of vertex u. For each out-neighboring 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'. If len_u+1+Distt[v] is greater than k, this path will not be retained to ensure that it does not appear in the simplified graph G'.

4. The method for querying the shortest path of an encrypted graph satisfying a K-hop constraint according to claim 2, characterized in that: When constructing the LP and RP adjacency tables, first, use the starting point s and the end point t 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 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.

5. The method for querying the shortest path of an encrypted graph satisfying a K-hop constraint according to claim 1, characterized in that: The encrypting 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, 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.

6. The method for querying the shortest path of an encrypted graph satisfying a K-hop constraint according to claim 4, characterized in that: 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, 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: 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 or Add virtual node vu for filling: the virtual node vu is only used for filling to make the number of edges in each layer consistent. The virtual node vu is given the same identifier as the actual middle 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.

7. The method for querying the shortest path of an encrypted graph satisfying a K-hop constraint according to claim 1, characterized in that: The specific steps of S4 are as follows: 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 to find an intermediate point that matches with the 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 paths on the left and right sides, and adding the weights in the side information using homomorphic encryption technology; S42, the cloud server stores the connected simple paths and the calculated weights in a new adjacency table path, where the adjacency table path includes the simple paths from the starting point s to the end point t, and 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 the selected path information with the smallest weight to the graph data queryer.

8. The method for querying the shortest path of an encrypted graph satisfying a K-hop constraint according to claim 1, characterized in that: The specific steps of S5 are as follows: S51, the path information received by the graph data queryer from the cloud server is encrypted, and the 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

  • Encrypted graph oriented constrained approximate shortest distance search method

    CN107291861A

  • Neighbor node query method and device of encrypted graph and electronic equipment

    CN114417073A

  • 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

Cited By

  • Encrypted graph shortest path query method meeting label and hop count double constraints

    CN120090863A