A quality-constrained shortest path query method, device and computer-readable storage medium for encrypted graphs

By constructing a ciphertext index locally and outsourcing it to a cloud server for quality-constrained shortest path query of graph data, the storage and security issues caused by the expansion of graph data are solved, and data privacy protection and query efficiency are improved.

CN118410067BActive Publication Date: 2024-09-10SHANDONG COMP SCI CENTNAT SUPERCOMP CENT IN JINAN +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410874030.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-09-10
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

In the existing technology, the expansion of the scale of graph data makes it difficult for local storage to meet the requirements. Outsourcing to cloud servers involves the risk of data leakage and security vulnerabilities, and the query efficiency is low.

Method used

The client constructs a ciphertext index locally, converts the graph data into a ciphertext index through homomorphic encryption, and sends it to the server. The server performs quality-constrained shortest path query to ensure data privacy protection and improve query efficiency.

Benefits of technology

It effectively prevents cloud servers from stealing private information of graph data, reduces index storage space, improves query efficiency, and solves the problems of data leakage and security vulnerabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118410067B
    Figure CN118410067B
Patent Text Reader

Abstract

The present invention belongs to the technical field of confidential communication, and more specifically, relates to a method, device and computer-readable storage medium for quality-constrained shortest path query for encrypted graphs. The method includes the client constructing graph data as a ciphertext index locally and sending it to the server; the client uses the sha3 hash function to calculate the query start point and the query end point to obtain the corresponding hash value, calculates the quality threshold using homomorphic encryption, combines the calculation results into a triple, i.e., a query token, and the client sends the query token to the server; the server performs a quality-constrained shortest path query based on the query start and end point information in the query token, and sends the query result to the client after the query is completed; the client performs decryption to obtain the final query result. The present invention solves the problem in the prior art that graph data is converted into multiple indexes according to different constraints, which increases the storage space of the index and has low query efficiency.
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 a quality-constrained shortest path query method, device and computer-readable storage medium for an encrypted graph. Background Art

[0002] Knowledge graph is a systematic method that uses graph structure to organically organize and display information. In knowledge graph, shortest path query is an important operation, which is used to find the shortest path between two nodes and provide the distance value of the path. The constrained shortest path problem refers to finding a path in the graph so that the path is the shortest path required and satisfies certain constraints. Common constraints are: 1. Constraining nodes, such as passing through specific nodes or not passing through certain nodes; 2. Constraining edges, such as the edge weight on the path cannot exceed a certain limit.

[0003] Chinese invention patent CN114707012A discloses a graph encryption shortest path query method and system that supports k unordered nodes, including an application in an environment consisting of a user module and a cloud service module; the user module processes 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 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] Since graph data structures can effectively represent and manage complex relationships between entities, such as road networks and network routing, real-world graph data usually contains a large amount of information. As user demand grows, the scale of graph data is also expanding, and local storage often cannot meet this growth. Therefore, users prefer to outsource large-scale data to cloud servers to reduce the burden of local storage and computing, because cloud servers have larger storage space and more powerful computing power than local devices. However, user data is stored on third-party servers, which may bring risks of data leakage and security vulnerabilities; secondly, converting graph data into multiple indexes according to different constraints increases the storage space of the index and has the problem of low query efficiency. Summary of the invention

[0005] The present invention aims to overcome at least one defect of the above-mentioned prior art and provide a quality constrained shortest path query method, device and computer-readable storage medium for an encrypted graph to solve the risks of data leakage and security vulnerabilities and the problem of low query efficiency in the prior art.

[0006] The detailed technical scheme of the present invention is as follows:

[0007] S1. The client saves the graph data locally Constructed as a ciphertext index , and send it to the server;

[0008] S2. The client uses the sha3 hash function to query the start and end points. , query end point Calculate and get , the quality threshold Computing with Homomorphic Encryption , combine the calculation results into triples , that is, query token, the client will query the token Send to the server;

[0009] S3. After receiving the query token, the server performs a quality-constrained shortest path query based on the query start and end point information in the query token, and sends the query result to the client after the query is completed;

[0010] S4. After receiving the query result, the client uses the homomorphic encryption decryption key Decrypt and get the final query result.

[0011] Furthermore, the S1 specifically includes:

[0012] S1.1. Generate a key pair using a key generation algorithm , the key is used to homomorphically encrypt information between nodes in the graph data, the information between the nodes including but not limited to distance and quality;

[0013] S1.2, Initialize a A two-dimensional array of size , used to store the information of the graph data; then, a flag bit D(0) and a four-tuple ( , );

[0014] The four-tuple ( , ) is to convert the node Calculated using a hash function ; The second item represents the current computing node and node The third item represents the number of hops between the current computing node and the node The distance between the current computing node and the node is calculated using homomorphic encryption. Among all the paths with a distance of 0, a path with path advantage is calculated, and the minimum quality of the path is set to the fourth item of the four-tuple, node The starting point for constructing the index;

[0015] Among them, the minimum quality is to compare the quality of all edges on a path, and the minimum value of all edge qualities is taken as the minimum quality of the path; path advantage refers to the existence of two paths between two nodes. and , if the distance between the two paths is satisfied , and the minimum mass satisfies ,but Have path advantage.

[0016] S1.3. Calculate all nodes of the graph data using the sha3 hash function to generate hash values ,Will In order as the horizontal and vertical coordinates of the two-dimensional array; a hash function is a function that maps input data of any length to output data of a fixed length. Its characteristic is that the input cannot be deduced from the output. This feature can protect the identity information of the node on the server side.

[0017] S1.4. Use the hash value obtained by hashing the node as the index key, and use the distance, number of hops, and quality of the node to other nodes as the information under the node index key to build a ciphertext index. , so that data can be searched and found quickly;

[0018] S1.5. After all nodes are traversed by the BFS breadth-first traversal algorithm, the ciphertext index is output , the client indexes the ciphertext Sent to the server.

[0019] Furthermore, the hash value obtained by hashing the node is used as the index key, and the distance, number of hops, and quality of the node to other nodes are used as the information under the node index key to construct a ciphertext index, which specifically includes:

[0020] S1.4.1. Select nodes , search through the BFS breadth-first traversal algorithm The next hop node ;

[0021] S1.4.2. Node Calculated using hash function , and then the node With Node The number of hops, nodes With Node The distance between nodes With Node The minimum quality of the path is calculated using a homomorphic encryption algorithm, and three encrypted results are obtained ( ), and compare it with The four-tuple ( ) is stored in a two-dimensional array, and the coordinates of the two-dimensional array are ( ), the four-tuple ( ) delete and change the flag bit D(0) to D(1);

[0022] S1.4.3. If the node If there is more than one next-hop node, repeat S1.4.2 to calculate all the next-hop nodes and store them in the corresponding positions of the two-dimensional array;

[0023] S1.4.4、Node The next hop nodes of all nodes are calculated, and the judgment node Whether there are two next-hop nodes;

[0024] If there are two next-hop nodes, continue to execute S1.4.2 and S1.4.3, and store the corresponding quadruple of the next two-hop nodes in the corresponding position of the two-dimensional array until all nodes in the graph are traversed and the nodes are The relevant information calculation is completed, and the calculation result is the node The outgoing label of the slave node The quality-constrained shortest distance from the start to each other node;

[0025] If there are no next two-hop nodes, proceed to S1.4.5;

[0026] S1.4.5. Determine the computing node After that, check whether there are still nodes. If so, repeat S1.4.1-S1.4.4 for the remaining nodes until all nodes in the graph are calculated.

[0027] Furthermore, the S3 specifically includes:

[0028] S3.1. The server will query the token triple Decompose it and get , the server will query the hash function of the starting point Find the starting node by comparing the horizontal coordinates of the two-digit group In the ciphertext index The corresponding position in ; then traverse All triples in the column are the out labels corresponding to the starting node in the two-dimensional array. The out label is used to store data information from the current node to other nodes. When traversing, the quality of all paths found by the out label is first compared with the quality threshold in the query token. Compare and filter, the minimum quality is less than the quality threshold The paths will be filtered out and the filtered paths will be stored in the path array among;

[0029] S3.2. The server will query the hash function of the end point Find the terminal node by comparing the vertical coordinate of the two-dimensional array In the ciphertext index The corresponding position in , and then traverse All triples in the row are terminal nodes The corresponding in tag in the two-dimensional array is used to store data information from other nodes to the current node. The quality of all paths found by the in tag is also compared with the quality threshold in the query token. Compare and filter, less than the quality threshold The paths will be filtered out and the filtered paths will be stored in the path array among;

[0030] S3.3. Path array With path array Compare the paths in the array one by one to determine whether there is a common node. A path and an array of paths A path of is connected into a common path;

[0031] If it exists, all paths that can be connected into one are stored in the path array Among them, the distance value of any common path is the corresponding array and arrays The distance values ​​of the two paths are added together, and the mass of the common path is the smaller mass of the two paths. The formula for calculating the mass-constrained shortest distance is as follows:

[0032] (1);

[0033] In formula (1), is at the quality threshold Next Node and The quality-constrained shortest path distance between Is a node The out tag, Is a node in label; u is an intermediate node , used to connect and Connect the two paths to form a complete path; Is a node To Node The quality threshold of this path, Is a node To Node The quality threshold of this path, Yes and The smaller value of the two is used as the quality threshold;

[0034] The shortest distance of the quality constraint is: when the quality threshold constraint is met, the path array The minimum value of the sum of the distance values ​​of the two paths connected as a common path;

[0035] If it does not exist, the query fails.

[0036] S3.4. The server sends the calculated path distance value and path quality to the client.

[0037] This article also provides a quality-constrained shortest path query device for an encrypted graph, the device comprising:

[0038] processor;

[0039] a memory having stored thereon a computer program executable on the processor;

[0040] Wherein, when the computer program is executed by the processor, the steps of the quality-constrained shortest path query method for an encrypted graph are implemented.

[0041] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a quality-constrained shortest path query method for an encrypted graph.

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

[0043] (1) The present invention proposes a quality-constrained shortest path query method, device and computer-readable storage medium for an encrypted graph. The quality-constrained shortest path problem can be solved by converting graph data into an index according to different constraint conditions, thereby reducing the storage space of the index, improving the query efficiency and solving the quality-constrained shortest path problem.

[0044] (2) The present invention proposes a quality-constrained shortest path query method, device and computer-readable storage medium for an encrypted graph. The graph data is converted into a ciphertext index through encryption technology, and the ciphertext index is then outsourced to a cloud server. This can effectively prevent the cloud server from stealing the privacy information of the graph data, thereby ensuring the security of the data. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a flow chart of the shortest path query method described in the present invention.

[0046] Figure 2 This is a schematic diagram of the graph data structure described in Example 1 of the present invention.

[0047] Figure 3 The graph data described in Example 1 of the present invention Generate ciphertext index Schematic diagram of . DETAILED DESCRIPTION

[0048] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0049] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.

[0050] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0051] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0052] Example 1

[0053] This embodiment provides a quality-constrained shortest path query method for an encrypted graph, which can satisfy the user's query for the quality-constrained shortest path in a specific scenario, while protecting the data privacy of users in the cloud platform. The specific process is as follows: Figure 1 As shown:

[0054] S1. Generate ciphertext index and upload ciphertext index: The client uploads the graph data locally. Constructed as a ciphertext index , and sent to the server, graph data like Figure 2 As shown:

[0055] The construction method includes converting the graph data into a corresponding adjacency list, and then converting the adjacency list into a corresponding ciphertext index through encryption technology; or converting the graph data into a corresponding unencrypted two-hop cover label index, and then converting it into a corresponding encrypted two-hop cover label index through encryption technology. The preferred method in this article is:

[0056] S1.1. Generate a key pair using a key generation algorithm , the key is used to homomorphically encrypt the distance and quality information between nodes in the graph data.

[0057] S1.2, Initialize a A two-dimensional array of size , used to store relevant information of graph data. Preferably, n is 6. In computer programming, a two-dimensional array is usually represented as a table or grid structure consisting of rows and columns. The meaning of is the number of nodes in the graph data, which means Figure 2 The total number of nodes in the graph data is 6: , , , , , ; Then generate a flag D (0) and a four-tuple ( , ); Preferably, the flag is specified by the client and cannot be identified by the server to protect the security of the data. Here, 0 means no path and 1 means there is a path.

[0058] The four-tuple ( , ) is to convert the node Calculated using a hash function ; The second item represents the current computing node and node The third item represents the number of hops between the current computing node and the node The distance between the current computing node and the node is calculated using homomorphic encryption. Among all the paths with a distance of 0, a path with path advantage is calculated, and the minimum quality of the path is set to the fourth item of the four-tuple, node is the starting point for constructing the index. In this embodiment, the node That is, the starting point for constructing the index is also the starting point for the query;

[0059] Among them, the minimum quality is to compare the quality of all edges on a path, and the minimum value of all edge qualities is taken as the minimum quality of the path; path advantage refers to the existence of two paths between two nodes. and , if the distance between the two paths is satisfied , and the minimum mass satisfies ,but Have path advantage.

[0060] S1.3. Calculate all nodes of the graph data using the sha3 hash function to generate hash values , Represents the identity information of the node in the ciphertext index. In order as the horizontal and vertical coordinates of the two-dimensional array.

[0061] S1.4. Use the hash value obtained by hashing the node as the index key, and use the distance, number of hops, and quality of the node to other nodes as the information under the node index key to build a ciphertext index. , so that you can quickly search and find data; the specific methods are as follows:

[0062] S1.4.1, preferably, Figure 3 As shown in (1) in the figure, first select the node , find the node through the BFS breadth-first traversal algorithm The next hop nodes found include , , , ;

[0063] S1.4.2. Node Calculated using hash function , and then the node With Node The number of hops (the number of hops between two nodes is 1), the number of nodes With Node The distance between the two nodes is 2, and the node With Node The minimum quality of the path (the minimum quality of two nodes is 4) is calculated through the homomorphic encryption algorithm, and three encrypted results are obtained , , ; and The four-tuple ( ) is stored in a two-dimensional array, and the coordinates of the two-dimensional array are ( ), the four-tuple ( ) delete and change the flag bit D(0) to D(1);

[0064] S1.4.3. Node There is more than one next hop node, including node , , ; The node , , Repeat S1.4.2 to perform calculations and store the calculation results in the corresponding positions of the two-dimensional array;

[0065] S1.4.4、Node The next hop nodes of all nodes are calculated, and the judgment node Whether there are two next-hop nodes:

[0066] Figure data in this example Midpoint The next two hop nodes are , , , there are two next-hop nodes, then continue to execute S1.4.2 and S1.4.3, store the corresponding quadruple of the next two-hop nodes in the corresponding position of the two-dimensional array, and repeat this process until the node All nodes under the calculation are completed, and the calculation result is the node The process is as follows: Figure 3 As shown;

[0067] If there are no next two-hop nodes, proceed to S1.4.5;

[0068] S1.4.5. Determine the current computing node After that, whether there are still nodes, if so, the remaining nodes , , , , Repeat S1.4.1-1.4.4 to complete the calculation of all nodes in the graph.

[0069] S1.5. After all nodes are traversed by the BFS breadth-first traversal algorithm, the ciphertext index The construction is completed, as shown in Table 1 and Table 2, and the ciphertext index is output , the client indexes the ciphertext Sent to the server.

[0070] Table 1 Ciphertext index -1

[0071]

[0072] Table 2 Ciphertext index -2

[0073]

[0074] S2. The client generates a query token and sends the query token: The client uses the sha3 hash function to convert the query start point to the end point , query end point Calculate and get , preferably, the quality threshold is set to 2, and homomorphic encryption is used for calculation , combine the calculation results into triples , that is, query token, the client will query the token Send to the server.

[0075] S3. The server executes the query algorithm, i.e., the quality-constrained shortest path query algorithm, and sends the query result: After receiving the query token, the server performs a quality-constrained shortest path query based on the query start and end point information in the query token, and sends the query result to the client after the query is completed, including:

[0076] S3.1. After receiving the query token, the server first sends the query token triple Decompose it and get ; The server will query the hash function of the starting point Find the starting node by comparing the horizontal coordinates of the two-dimensional array In the ciphertext index The corresponding position in , and then traverse All triples in the column, that is, the out label corresponding to the starting node in the two-dimensional array. The out label is used to store data information from the current node to other nodes. When traversing, first compare the quality of all paths found by the out label with the quality threshold in the query token. Compare and filter, the minimum quality is less than the quality threshold The paths will be filtered out. The filtered paths are ( , ), because the quality 1 of the path is less than the quality threshold 2, it is filtered. Finally, the filtered path is stored in the path array At this time, the path array for:

[0077] ( ),( , ),

[0078] ( , ), , ,

[0079] ( , ),( , ),

[0080] ( , ).

[0081] S3.2. The server will query the hash function of the end point Find the terminal node by comparing the vertical coordinate of the two-dimensional array In the ciphertext index The corresponding position in , and then traverse All triples in the row, i.e. the terminal node The corresponding in tag in the two-dimensional array is used to store data information from other nodes to the current node. Similarly, the quality of all paths found by the in tag is compared with the quality threshold in the query token. Compare and filter, less than the quality threshold The paths will be filtered out and the filtered paths will be stored in the path array At this time, the path array for:

[0082] ( , , ),( , ).

[0083] S3.3. Path array With path array Compare the paths in the array one by one to determine whether there is a common node. A path and an array of paths A path is connected into a common path; all paths that can be connected into one are stored in the path array Among them, the distance value of the path is an array and arrays The distance values ​​of the two paths are added together, and the quality of the path is the smaller quality of the two paths. At this time, the path array for:

[0084] ( , , ),( , );

[0085] Calculate the mass-constrained shortest distance , the formula is as follows:

[0086] (1);

[0087] In formula (1), is at the quality threshold Next Node and The quality-constrained shortest path distance between Is a node The out tag, Is a node in label; u is an intermediate node , used to connect and Connect the two paths to form a complete path; Is a node To Node The quality threshold of this path, Is a node To Node The quality threshold of this path, Yes and The smaller value of the two is used as the quality threshold;

[0088] The shortest distance of the quality constraint is: when the quality threshold constraint is met, the path array The minimum value of the sum of the distance values ​​of the two paths connected as a common path;

[0089] If it does not exist, the query fails.

[0090] S3.4. The server will query the result, that is, the calculated path array The minimum distance value in Its corresponding path and its path distance value and path quality Sent to the client.

[0091] S4. Obtain query results;

[0092] After receiving the query result, the client uses the homomorphically encrypted decryption key Decrypt and obtain the final query result, and the shortest distance of the query quality constraint is 4.

[0093] Example 2

[0094] This embodiment also provides a quality-constrained shortest path query device for an encrypted graph, the device comprising:

[0095] processor;

[0096] a memory having stored thereon a computer program executable on the processor;

[0097] Wherein, when the computer program is executed by the processor, the quality-constrained shortest path query method for an encrypted graph is implemented.

[0098] In this embodiment, the device includes but is not limited to: personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile computing devices, smart phones, tablet computers, cellular phones, personal digital assistants (PDAs), handheld devices, messaging devices, wearable computing devices, consumer electronic devices, etc.

[0099] Example 3

[0100] This embodiment also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the quality-constrained shortest path query method for an encrypted graph.

[0101] Specifically, a system or device equipped with a readable storage medium can be provided, on which software program codes that implement the functions of any of the above-mentioned embodiments are stored, and a computer or processor of the system or device can read and execute instructions stored in the readable storage medium.

[0102] In this case, the program code itself read from the machine-readable medium can realize the function of any one of the above embodiments, and thus the machine-readable code and the machine-readable storage medium storing the machine-readable code constitute part of this specification.

[0103] Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tapes, non-volatile memory cards, and ROMs. Optionally, the program code may be downloaded from a server computer or a cloud via a communication network.

[0104] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0105] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0106] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0107] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0108] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solution of the present invention, and are not intended to limit the specific implementation methods of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the claims of the present invention shall be included in the protection scope of the claims of the present invention.

Claims

1. A quality-constrained shortest path query method for an encrypted graph, characterized in that: include: S1. The client saves the graph data locally Constructed as a ciphertext index , and send it to the server; S2. The client uses the sha3 hash function to query the start and end points. , query end point Calculate and get , the quality threshold Computing with Homomorphic Encryption , combine the calculation results into triples , that is, query token, the client will query the token Send to the server; S3. After receiving the query token, the server performs a quality-constrained shortest path query based on the query start and end point information in the query token, and sends the query result to the client after the query is completed; S4. After receiving the query result, the client uses the homomorphic encryption decryption key Decrypt and get the final query result; The image data Constructed as a ciphertext index Specifically include: S1.

1. Generate a key pair using a key generation algorithm , the key is used to homomorphically encrypt information between nodes in the graph data, the information between the nodes including but not limited to hash value, hop point, distance and quality; S1.2, Initialize a A two-dimensional array of size , used to store the information of the graph data; then, a flag bit D(0) and a four-tuple ( , ); The four-tuple ( , ) is to convert the node Calculated using a hash function ; The second item represents the current computing node and node The third item represents the number of hops between the current computing node and the node The distance between the current computing node and the node is calculated using homomorphic encryption. Among all the paths with a distance of 0, a path with path advantage is calculated, and the minimum quality of the path is set to the fourth item of the four-tuple, node The starting point for constructing the index; S1.

3. Calculate all nodes of the graph data using the sha3 hash function to generate hash values ,Will In order as the horizontal and vertical coordinates of the two-dimensional array; S1.

4. Use the hash value obtained by hashing the node as the index key, and use the distance, number of hops, and quality from the current node to other nodes as the information under the node index key to build a ciphertext index. ; S1.

5. After the BFS breadth-first traversal algorithm is completed for all nodes, the ciphertext index is output , the client indexes the ciphertext Sent to the server.

2. A quality-constrained shortest path query method for an encrypted graph according to claim 1, characterized in that: The method of using quality as the granularity of the index, extracting the index key, and then constructing the ciphertext index according to the hash function and the hash value specifically includes: S1.4.

1. Select nodes , search through the BFS breadth-first traversal algorithm The next hop node ; S1.4.

2. Node Calculated using hash function , and then the node With Node The number of hops, nodes With Node The distance between nodes With Node The minimum quality of the path is calculated using a homomorphic encryption algorithm, and three encrypted results are obtained ( ), and compare it with The four-tuple ( ) is stored in a two-dimensional array, and the coordinates of the two-dimensional array are ( ), the four-tuple ( ) delete and change the flag bit D(0) to D(1); S1.4.

3. If the node If there is more than one next-hop node, repeat S1.4.2 to calculate all next-hop nodes and store them in the corresponding positions of the two-dimensional array; S1.4.4、Node The next hop nodes of all nodes are calculated, and the judgment node Whether there are two next-hop nodes; If there are two next-hop nodes, continue to execute S1.4.2 and S1.4.3, and store the corresponding quadruple of the next two-hop nodes in the corresponding position of the two-dimensional array until all nodes in the graph are traversed and the nodes are The relevant information calculation is completed, and the calculation result is the node The outgoing label of the slave node The quality-constrained shortest distance from the start to each other node; If there are no next two-hop nodes, proceed to S1.4.5; S1.4.

5. Determine the current computing node After that, check whether there are still nodes. If so, repeat S1.4.1-S1.4.4 for the remaining nodes to complete the calculation of all nodes in the graph.

3. A quality-constrained shortest path query method for an encrypted graph according to claim 1 or 2, characterized in that: The S3 specifically includes: S3.

1. The server will query the token triple Decompose it and get , the server will query the hash function of the starting point Find the starting node by comparing the horizontal coordinates of the two-digit group In the ciphertext index The corresponding position in ; then traverse All triples in the column are the out labels corresponding to the start node in the two-dimensional array. When traversing, first compare the quality of all paths found by the out label with the quality threshold in the query token. Compare and filter, the minimum quality is less than the quality threshold The paths will be filtered out and the filtered paths will be stored in the path array among; S3.

2. The server will query the hash function of the end point Find the terminal node by comparing the vertical coordinate of the two-dimensional array In the ciphertext index The corresponding position in , and then traverse All triples in the row are terminal nodes The corresponding in tag in the two-dimensional array also compares the quality of all paths found by the in tag with the quality threshold in the query token. Compare and filter, less than the quality threshold The paths will be filtered out and the filtered paths will be stored in the path array among; S3.

3. Path array With path array Compare the paths in the array one by one to determine whether there is a common node. A path and an array of paths A path of is connected into a common path; If it exists, the paths that can be connected into a common path are stored in the path array Among them, the distance value of any common path is the corresponding array and arrays The distance values ​​of the two paths in the equation are added together, and the mass of the common path is the smaller mass of the two paths. Calculate the mass-constrained shortest distance , the formula is as follows: (1); In formula (1), is at the quality threshold Next Node and The quality-constrained shortest path distance between Is a node The out tag, Is a node in label; u is an intermediate node , used to connect and Connect the two paths to form a complete path; Is a node To Node The quality threshold of this path, Is a node To Node The quality threshold of this path, Yes and The smaller value of the two is used as the quality threshold; The shortest distance of the quality constraint is: when the quality threshold constraint is met, the path array The minimum value of the sum of the distance values ​​of the two paths connected as a common path; If it does not exist, the query fails. S3.

4. The server sends the query result, i.e., the path corresponding to the calculated quality-constrained shortest distance and its path distance value and path quality, to the client.

4. A quality-constrained shortest path query device for an encrypted graph, characterized in that: The device comprises: processor; a memory having stored thereon a computer program executable on the processor; Wherein, when the computer program is executed by the processor, the steps of a quality-constrained shortest path query method for an encrypted graph as described in any one of claims 1 to 3 are implemented.

5. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.