Storage method, query method and device for encrypted data based on trusted hardware
By generating ciphertext mappings and data mapping relationships in trusted hardware, and combining them with randomized query tokens, the problem of client search pattern leakage in existing ciphertext retrieval methods is solved, thereby improving query security and reducing server load.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
- Filing Date
- 2026-02-10
- Publication Date
- 2026-05-26
AI Technical Summary
Existing keyword-based encrypted retrieval methods are prone to leaking client search patterns, allowing servers to infer client relationships and posing a privacy risk.
A trusted hardware-based encrypted data storage method is adopted. By extracting keywords and randomizing data units, encrypted mapping relationships and data mapping relationships are generated and stored on the server. Random and encrypted query tokens are used for querying, avoiding the storage of keyword and data unit association information on the server.
It effectively avoids client search pattern leakage, improves query security, reduces server resource load, and achieves separation of storage and computing.
Smart Images

Figure CN121723498B_ABST
Abstract
Description
Technical Field
[0001] This application relates to encryption technology, and in particular to a method, method and apparatus for storing and querying encrypted data based on trusted hardware. Background Technology
[0002] Sensitive data records on the client's local machine are often encrypted before being stored on the server to ensure that the client's sensitive data records are not leaked.
[0003] When any client needs to perform a data query, it first generates a trapdoor based on keywords using Searchover Encrypted Data (SoE). The trapdoor is then used to match the ciphertext. This allows for the retrieval of ciphertext based on keyword trapdoors without decrypting the ciphertext stored on the server, thus protecting sensitive data from being spied on by the server and safeguarding privacy.
[0004] However, existing methods of encrypted retrieval based on keyword trapdoors often suffer from problems such as leakage of client search patterns. For example, if a client repeatedly queries data based on the same keyword, the same trapdoor will be generated, and the server can count the frequency of trapdoor occurrences to infer high-frequency keywords (such as medical records, financial data, etc.). Furthermore, if two different clients use the same keyword, such as a trapdoor for a certain disease, to query data, the server will infer that the two different clients are related. Summary of the Invention
[0005] This application provides a method, a query method, and an apparatus for storing encrypted data based on trusted hardware, in order to avoid the technical problems caused by existing keyword-based trapdoor retrieval of encrypted data.
[0006] This application provides a method for storing encrypted data based on trusted hardware. This method is applied to a client and includes:
[0007] Keyword extraction is performed on each data unit to be encrypted to obtain keyword-data unit groups. Each keyword-data unit group includes a keyword and at least one data unit identifier. The data units corresponding to each data unit identifier in the same keyword-data unit group contain the keyword in that keyword-data unit group.
[0008] For each keyword-data unit group, a ciphertext mapping relationship is determined. This ciphertext mapping relationship includes the correspondence between the data unit identifier ciphertext and the location ciphertext. The data unit identifier ciphertext is obtained by encrypting each data unit identifier in the keyword-data unit group using a key SK negotiated with trusted hardware. The location ciphertext includes the randomization result obtained by randomizing the keywords in the keyword-data unit group based on the key SK.
[0009] For each data unit, determine the corresponding data mapping relationship; the data mapping relationship for each data unit includes the correspondence between the data unit identifier and the ciphertext of the data unit;
[0010] Store the encrypted mapping relationship of each keyword-data unit group and the data mapping relationship of each data unit on the server.
[0011] This application provides a method for querying encrypted data based on trusted hardware, which corresponds to the encrypted data storage method described above, and includes:
[0012] Receive a query token; the token is generated by encrypting a random number and the client's query expression; the query expression includes a keyword or an expression consisting of at least two keywords;
[0013] For each keyword in the token, the following steps are performed: The keyword is randomized based on the key SK negotiated with the client to obtain the randomization result corresponding to the keyword; the randomization result corresponding to the keyword is sent to the server so that the server can find the target location ciphertext containing the randomization result in the stored ciphertext mapping relationship corresponding to each keyword-data unit group; the target data unit identifier ciphertext returned by the server is received, where the target data unit identifier ciphertext is the target data unit identifier ciphertext corresponding to the target location ciphertext found by the server from the ciphertext mapping relationship corresponding to each keyword-data unit group; the target data unit identifier ciphertext is decrypted using the key SK to obtain the data unit identifier corresponding to the keyword.
[0014] The target data unit identifier is determined based on the data unit identifier corresponding to each keyword; the target data unit identifier is sent to the server so that the server can find the target data unit ciphertext corresponding to the target data unit identifier from the stored data mapping relationship corresponding to each data unit and send it to the client.
[0015] This application also provides a storage device for encrypted data based on trusted hardware, which is applied to a client and includes:
[0016] The extraction unit is used to extract keywords from each data unit to be encrypted to obtain keyword-data unit groups. Each keyword-data unit group includes a keyword and a data unit identifier of at least one data unit. The keywords in the keyword-data unit group are present in the data units corresponding to the data unit identifiers in the same keyword-data unit group.
[0017] The determining unit is configured to determine the ciphertext mapping relationship corresponding to each keyword-data unit group; the ciphertext mapping relationship corresponding to the keyword-data unit group includes the correspondence between data unit identifier ciphertext and position ciphertext, wherein the data unit identifier ciphertext is obtained by encrypting each data unit identifier in the keyword-data unit group using a key SK negotiated with trusted hardware; the position ciphertext includes: a randomization result obtained by randomizing the keywords in the keyword-data unit group based on the key SK; and...
[0018] For each data unit, determine the corresponding data mapping relationship; the data mapping relationship for each data unit includes the correspondence between the data unit identifier and the ciphertext of the data unit;
[0019] The storage unit is used to store the encrypted mapping relationship corresponding to each keyword-data unit group and the data mapping relationship corresponding to each data unit to the server.
[0020] This application embodiment also provides a secure data query device based on trusted hardware. This device is applied to the secure data storage scenario described above, and is implemented using trusted hardware, comprising:
[0021] The obtaining unit is used to obtain a query token; the token is an encrypted query token generated by encrypting a random number and the client's query expression; the query expression includes a keyword or an expression consisting of at least two keywords;
[0022] The query unit is configured to perform the following steps for each keyword in the token: randomize the keyword based on the key SK negotiated with the client to obtain the randomization result corresponding to the keyword; send the randomization result corresponding to the keyword to the server so that the server can find the target location ciphertext containing the randomization result in the stored ciphertext mapping relationship corresponding to each keyword-data unit group; receive the target data unit identifier ciphertext returned by the server, wherein the target data unit identifier ciphertext is the target data unit identifier ciphertext corresponding to the target location ciphertext found by the server from the ciphertext mapping relationship corresponding to each keyword-data unit group; and decrypt the target data unit identifier ciphertext using the key SK to obtain the data unit identifier corresponding to the keyword.
[0023] The processing unit is configured to determine the target data unit identifier based on the data unit identifier corresponding to each keyword; and send the target data unit identifier to the server so that the server can find the target data unit ciphertext corresponding to the target data unit identifier from the stored data mapping relationship corresponding to each data unit and send it to the client.
[0024] This application also provides an electronic device. The electronic device includes: a processor and a machine-readable storage medium;
[0025] The machine-readable storage medium stores machine-executable instructions that can be executed by the processor;
[0026] The processor is used to execute machine-executable instructions to implement the steps of the disclosed method.
[0027] As can be seen from the above technical solution, this embodiment processes each data unit to be encrypted, so that what is ultimately stored on the server is the ciphertext mapping relationship corresponding to each keyword-data unit group (each keyword-data unit group includes a keyword and at least one data unit identifier), and the data mapping relationship corresponding to the data unit (the data mapping relationship corresponding to the data unit includes the correspondence between the data unit identifier and the ciphertext of the data unit). It does not store any association information between keywords and data unit content on the server, which prevents the server from associating the relationship between query keywords and specific query results during subsequent queries, avoiding problems such as client search pattern leakage that occur when existing keyword-based trapdoor ciphertext retrieval is used.
[0028] Furthermore, by generating random and encrypted query tokens using random numbers and the client's query formula (at this point, the query formula is also equivalent to encryption), the server will not associate the relationship between query keywords and specific query results when querying data, thus avoiding problems such as client search pattern leakage that occur when performing encrypted retrieval based on keyword trapdoors.
[0029] Furthermore, based on this encrypted query formula, the specific query operation will not be leaked, thus improving security and solving the problem of leaking access patterns in existing solutions.
[0030] Furthermore, in this embodiment, relational calculations are performed in trusted hardware, while the server only performs storage, thus separating storage and computation and reducing server resource consumption. Attached Figure Description
[0031] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0032] Figure 1 A flowchart illustrating the method provided in this application embodiment;
[0033] Figure 2 Another method flowchart provided for embodiments of this application;
[0034] Figure 3 This is a structural diagram of the device provided in the embodiments of this application;
[0035] Figure 4 Another device structure diagram provided for embodiments of this application;
[0036] Figure 5 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0037] To enable those skilled in the art to better understand the technical solutions provided in the embodiments of this application, and to make the above-mentioned objectives, features and advantages of the embodiments of this application more apparent and understandable, the technical solutions in the embodiments of this application will be further described in detail below with reference to the accompanying drawings.
[0038] See Figure 1 , Figure 1 This is a flowchart illustrating a method provided in an embodiment of this application, which is applied to a client. Figure 1 As shown, the process may include:
[0039] Step 101: Extract keywords from each data unit to be encrypted to obtain keyword-data unit groups. Each keyword-data unit group includes a keyword and a data unit identifier of at least one data unit. The data units corresponding to the data unit identifiers in the same keyword-data unit group contain the keywords in that keyword-data unit group.
[0040] In this embodiment, the data unit may be a data record or a file, etc., and this embodiment is not specifically limited to this.
[0041] This embodiment can extract keywords from each data unit to be encrypted using conventional keyword extraction methods, and create a corresponding keyword-data unit group for each keyword.
[0042] Here, each keyword-data unit group includes a keyword and at least one data unit identifier; the keyword in the keyword-data unit group exists in the data units corresponding to each data unit identifier within the same keyword-data unit group. For example, a keyword-data unit group includes the keyword Key1 and the following three data unit identifiers record1, record2, and record3, indicating that the keyword Key1 exists in the data units corresponding to record1, record2, and record3 respectively. As another example, a keyword-data unit group includes the keyword Key2 and the following two data unit identifiers record3 and record4, indicating that the keyword Key2 exists in the data units corresponding to record3 and record4 respectively.
[0043] Step 102: For each keyword-data unit group, determine the ciphertext mapping relationship corresponding to the keyword-data unit group; the ciphertext mapping relationship corresponding to the keyword-data unit group includes the correspondence between the data unit identifier ciphertext and the location ciphertext, wherein the data unit identifier ciphertext is obtained by encrypting each data unit identifier in the keyword-data unit group using the key SK negotiated with the trusted hardware; the location ciphertext includes: the randomization result obtained by randomizing the keywords in the keyword-data unit group based on the key SK.
[0044] Optionally, in this embodiment, the aforementioned data unit identifier ciphertext is obtained by encrypting each data unit identifier in the keyword-data unit group using a symmetric encryption algorithm and the key SK negotiated between the client and the trusted hardware. For example, C_recordList = Enc(SK, [record1, record2, record3]), where C_recordList represents the data unit identifier ciphertext. Here, the key SK can be a shared key negotiated between each client and the trusted hardware.
[0045] Optionally, the randomization of the keywords in the keyword-data unit group based on the key SK includes: hashing the keywords in the keyword-data unit group, for example, h = hash(key), where hash is a hash function and h is the hash result. Then, the hash result and the key SK are randomized; for example, P_key = n(SK, h), where n is a random permutation function and P_key represents the randomization result.
[0046] Table 1 illustrates the ciphertext mapping relationships for each keyword-data unit group:
[0047] Table 1
[0048]
[0049] Step 103: For each data unit, determine the data mapping relationship corresponding to that data unit; the data mapping relationship corresponding to that data unit includes the correspondence between the data unit identifier and the ciphertext of that data unit.
[0050] Optionally, the ciphertext of any data unit is obtained by the client encrypting the data unit using a symmetric encryption algorithm and the local key CK. For example, to encrypt the content of each data unit, a symmetric encryption algorithm and its key CK are used: C_record = Enc(CK, record). Table 2 illustrates the data mapping relationship corresponding to each data unit:
[0051] Table 2
[0052]
[0053] Step 104: Store the encrypted mapping relationship corresponding to each keyword-data unit group and the data mapping relationship corresponding to each data unit to the server.
[0054] Ultimately, the storage of encrypted data based on trusted hardware was achieved. As can be seen from steps 101 to 104, this embodiment does not store any associated information of keywords and data unit content on the server during storage.
[0055] This concludes the process. Figure 1 The process is shown below.
[0056] pass Figure 1As can be seen from the process shown, this embodiment processes each data unit to be encrypted so that what is ultimately stored on the server is the ciphertext mapping relationship corresponding to each keyword-data unit group (each keyword-data unit group includes a keyword and at least one data unit identifier), and the data mapping relationship corresponding to the data unit (the data mapping relationship corresponding to the data unit includes the correspondence between the data unit identifier and the ciphertext of the data unit). It does not store any association information between keywords and data unit content on the server. This ensures that the server will not associate the relationship between the query keywords and the specific query results during subsequent queries, avoiding problems such as client search pattern leakage that occur when performing ciphertext retrieval based on keyword trapdoors.
[0057] Correspondingly, this embodiment also provides a method for querying encrypted data based on trusted hardware, see [link to relevant documentation]. Figure 2 This method is applied to scenarios where encrypted data storage is performed using the method described above. This method is applied to trusted hardware, which can be independent of the aforementioned client and server, or deployed on a specified client or server, etc. This embodiment is not specifically limited.
[0058] like Figure 2 As shown, the process may include the following steps:
[0059] Step 201: Obtain a query token; the token is an encrypted query token generated by encrypting a random number and the client's query expression; the query expression includes a keyword or an expression consisting of at least two keywords.
[0060] As one example, the query token here can be generated by the client making the query request and sent to the server, which then forwards it to the trusted hardware; it can also be generated by the trusted hardware or other devices. This example is not specifically limited to any particular device.
[0061] As an example, the token is generated as follows: First, a fixed-length random number r is generated. Then, an encrypted query token is generated by encrypting the random number and the client's query expression using the key SK negotiated with the client. Specifically, an encrypted query token token can be generated according to the following formula: token = PASE_Enc(SK, r||expression). Here, PASE_Enc can be a symmetric encryption algorithm, and expressions represent the query expression. In this embodiment, the expression consisting of at least two keywords is composed of these at least two keywords and logical operators such as logical AND and logical OR. For example, the query expression can be a Boolean expression, such as key1 AND key2 OR key3. key1 to key3 are keywords, and AND and OR are logical operators.
[0062] Step 202: For each keyword in the token, perform the following steps: Randomize the keyword based on the key SK negotiated with the client to obtain the randomization result corresponding to the keyword; send the randomization result corresponding to the keyword to the server so that the server can find the target location ciphertext containing the randomization result in the stored ciphertext mapping relationship corresponding to each keyword-data unit group; receive the target data unit identifier ciphertext returned by the server, the target data unit identifier ciphertext being the target data unit identifier ciphertext corresponding to the target location ciphertext found by the server from the ciphertext mapping relationship corresponding to each keyword-data unit group; use the key SK to decrypt the target data unit identifier ciphertext to obtain the data unit identifier corresponding to the keyword.
[0063] Step 201 generates a random query token and an encrypted Boolean query instruction, preventing the server from associating the query content with the specific data record during subsequent queries. This avoids leaking the specific Boolean query operation, improves security, and solves the problem of leaking access patterns in existing solutions.
[0064] Optionally, in this embodiment, the trusted hardware can first use the aforementioned key SK to decrypt the query token and remove the fixed-length random number r to obtain a query relation, such as a Boolean expression (e.g., key1 AND key2 OR key3). At this point, each keyword in the query relation, such as the Boolean expression, is equivalent to each keyword in the token.
[0065] In step 202, the randomization of the keyword based on the key SK negotiated with the client is similar to the randomization result in the location ciphertext in step 102. For example, the keyword is hashed, and then the hash result and the key SK negotiated with the client are randomized to obtain the randomization result corresponding to the keyword. Specifically, it can be executed according to the following formula: h = Hash(w), P_key = n(SK, h), where w represents the keyword, Hash() represents the hash function, and n represents the random permutation function.
[0066] Optionally, in this embodiment, to further ensure security, sending the randomization result corresponding to the keyword to the server includes: sending the random position combination corresponding to the keyword to the server; the random position combination includes at least the following combination of results: the randomization result corresponding to the keyword, and at least one reference result other than the randomization result. For example, if the randomization result corresponding to the keyword is denoted as P_key, and r1 to rn represent reference results, then the random position combination is: [r1, r2, ... P_key, ... rn]. It can be seen that the results in the random position combination are ordered. When the server receives the random position combination, it will, for each result, search for the ciphertext containing the result in the stored ciphertext mapping relationship corresponding to each keyword-data unit group, and find the data unit identifier ciphertext corresponding to each position ciphertext in the ciphertext mapping relationship corresponding to each keyword-data unit group. Among them, the ciphertext containing the randomization result corresponding to the keyword can be denoted as the target position ciphertext, and the data unit identifier ciphertext corresponding to the target position ciphertext is denoted as the target data unit identifier ciphertext.
[0067] Corresponding to the above random position combination, the received target data unit identifier ciphertext from the server includes: a combination of data unit identifier ciphertexts returned by the server; the data unit identifier ciphertext combination includes the data unit identifier ciphertexts corresponding to each result in the above random position combination; and the target data unit identifier ciphertext is identified from the data unit identifier ciphertext combination. Since the results in the random position combination are ordered, the order of the data unit identifier ciphertexts in the data unit identifier ciphertext combination corresponds to the order of the results in the random position combination. For example, the i-th data unit identifier ciphertext in the data unit identifier ciphertext combination is the data unit identifier ciphertext corresponding to the i-th result in the random position combination. Under this premise, the target data unit identifier ciphertext can be easily identified from the data unit identifier ciphertext combination. Then, the above key SK can be used to decrypt the target data unit identifier ciphertext to obtain the data unit identifier corresponding to the keyword.
[0068] Step 203: Determine the target data unit identifier based on the data unit identifier corresponding to each keyword; send the target data unit identifier to the server so that the server can find the target data unit ciphertext corresponding to the target data unit identifier from the stored data mapping relationship corresponding to each data unit and send it to the client.
[0069] Optionally, here, the target data unit identifier is determined based on the data unit identifier corresponding to each keyword, including:
[0070] If the above query relation includes an expression consisting of at least two keywords, then the data unit identifiers corresponding to each keyword are operated on according to the logical operators between the keywords in the expression, and the target data unit identifier is determined based on the operation result.
[0071] For example, if the query expression above is key1 AND key2 OR key3, then the data unit identifier corresponding to key1 can be ANDed with the data unit identifier corresponding to key2, and the result can be ORed with the data unit identifier corresponding to key3. The final result can be the target data unit identifier. For example, if the target data unit identifier includes the following list of data unit identifiers: [record2, record3, ...], then this list can be returned to the server. The server can then find the ciphertext of the corresponding data unit based on each data unit identifier in the list and return it to the client. The client can then decrypt the ciphertext of the data unit using a symmetric encryption algorithm and its local key CK. Here, the local key CK used by each client is the same as the local key CK used to encrypt the data unit in step 103 above.
[0072] This concludes the process. Figure 2 The process is shown below.
[0073] pass Figure 2 As can be seen from the process shown, in this embodiment, a random and encrypted query token is generated by using a random number and the client's query relation (at this time, the query relation is also equivalent to encryption), so that the server will not associate the relationship between the query keywords and the specific query results when querying data, thus avoiding the problems such as client search pattern leakage that occur when performing encrypted retrieval based on keyword trapdoors.
[0074] Furthermore, based on this encrypted query relation, the specific Boolean query operation will not be leaked, thus improving security and solving the problem of leaking access patterns in existing solutions.
[0075] Furthermore, in this embodiment, Boolean queries and other calculations are performed in trusted hardware, while the server only performs storage, thus separating storage and computation and reducing server resource consumption.
[0076] The apparatus provided in the embodiments of this application is described below:
[0077] See Figure 3 , Figure 3 A structural diagram of a device provided in an embodiment of this application. The device is applied to a client and includes:
[0078] The extraction unit is used to extract keywords from each data unit to be encrypted to obtain keyword-data unit groups. Each keyword-data unit group includes a keyword and a data unit identifier of at least one data unit. The keywords in the keyword-data unit group are present in the data units corresponding to the data unit identifiers in the same keyword-data unit group.
[0079] The determining unit is configured to determine the ciphertext mapping relationship corresponding to each keyword-data unit group; the ciphertext mapping relationship corresponding to the keyword-data unit group includes the correspondence between data unit identifier ciphertext and position ciphertext, wherein the data unit identifier ciphertext is obtained by encrypting each data unit identifier in the keyword-data unit group using a key SK negotiated with trusted hardware; the position ciphertext includes: a randomization result obtained by randomizing the keywords in the keyword-data unit group based on the key SK; and...
[0080] For each data unit, determine the corresponding data mapping relationship; the data mapping relationship for each data unit includes the correspondence between the data unit identifier and the ciphertext of the data unit;
[0081] The storage unit is used to store the encrypted mapping relationship corresponding to each keyword-data unit group and the data mapping relationship corresponding to each data unit to the server.
[0082] Optionally, the data unit identifier ciphertext is obtained by encrypting the data unit identifier in the keyword-data unit group using a symmetric encryption algorithm and the key SK.
[0083] Optionally, the randomization process of the keywords in the keyword-data unit group based on the key SK includes:
[0084] The keywords in the keyword-data unit group are hashed, and then the hash result and the key SK are randomized to obtain the randomization result.
[0085] Optionally, the ciphertext of any data unit is obtained by the client encrypting the data unit using a symmetric encryption algorithm and the local key CK.
[0086] This application also provides another encrypted data query device based on trusted hardware, which is applied to the above... Figure 1 The method shown is applied to a dense data storage scenario, and the device is used in trusted hardware, including:
[0087] The obtaining unit is used to obtain a query token; the token is an encrypted query token generated by encrypting a random number and the client's query expression; the query expression includes a keyword or an expression consisting of at least two keywords;
[0088] The query unit is configured to perform the following steps for each keyword in the token: randomize the keyword based on the key SK negotiated with the client to obtain the randomization result corresponding to the keyword; send the randomization result corresponding to the keyword to the server so that the server can find the target location ciphertext containing the randomization result in the stored ciphertext mapping relationship corresponding to each keyword-data unit group; receive the target data unit identifier ciphertext returned by the server, wherein the target data unit identifier ciphertext is the target data unit identifier ciphertext corresponding to the target location ciphertext found by the server from the ciphertext mapping relationship corresponding to each keyword-data unit group; and decrypt the target data unit identifier ciphertext using the key SK to obtain the data unit identifier corresponding to the keyword.
[0089] The processing unit is configured to determine the target data unit identifier based on the data unit identifier corresponding to each keyword; and send the target data unit identifier to the server so that the server can find the target data unit ciphertext corresponding to the target data unit identifier from the stored data mapping relationship corresponding to each data unit and send it to the client.
[0090] Optionally, the expression consisting of the at least two keywords is composed of the at least two keywords and logical operators;
[0091] The process of determining the target data unit identifier based on the data unit identifier corresponding to each keyword includes:
[0092] If the query relation includes an expression consisting of at least two keywords, then logical operations are performed on the data unit identifiers corresponding to each keyword according to the logical operators between the keywords in the expression, and the target data unit identifier is determined based on the operation result.
[0093] Optionally, sending the randomization result corresponding to the keyword to the server includes:
[0094] The random position combination corresponding to the keyword is sent to the server; the random position combination includes at least the randomization result corresponding to the keyword and at least one reference result other than the randomization result.
[0095] The step of receiving the target data unit identifier ciphertext returned by the server includes: receiving a combination of data unit identifier ciphertexts returned by the server; the combination of data unit identifier ciphertexts includes the data unit identifier ciphertexts corresponding to each result in the random position combination; and identifying the target data unit identifier ciphertext from the combination of data unit identifier ciphertexts.
[0096] This application also provides embodiments that... Figure 3 or Figure 4 The hardware structure of the device shown. See also Figure 5 , Figure 5 This is a structural diagram of an electronic device provided in an embodiment of this application. Figure 5 As shown, the hardware structure may include: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above example of this application.
[0097] Based on the same application concept as the above method, this application embodiment also provides a machine-readable storage medium storing a plurality of computer instructions, which, when executed by a processor, can implement the method disclosed in the above examples of this application.
[0098] For example, the aforementioned machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, etc. For instance, machine-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.
[0099] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for querying encrypted data based on trusted hardware, characterized in that, This method is applied to secure data storage scenarios and to trusted hardware, including: Obtain a query token; the token is an encrypted query token generated by encrypting a random number and the client's query expression; the query expression includes a keyword or an expression consisting of at least two keywords; For each keyword in the token, the following steps are performed: The keyword is randomized based on the key SK negotiated with the client to obtain the randomization result corresponding to the keyword; the random position combination corresponding to the keyword is sent to the server; the random position combination includes at least the randomization result corresponding to the keyword and at least one reference result other than the randomization result, so that the server can find the target position ciphertext containing the randomization result in the stored ciphertext mapping relationship corresponding to each keyword-data unit group; the target data unit identifier ciphertext returned by the server is received, the target data unit identifier ciphertext is the target data unit identifier ciphertext corresponding to the target position ciphertext found by the server from the ciphertext mapping relationship corresponding to each keyword-data unit group; the target data unit identifier ciphertext is decrypted using the key SK to obtain the data unit identifier corresponding to the keyword; The target data unit identifier is determined based on the data unit identifier corresponding to each keyword; the target data unit identifier is sent to the server so that the server can find the target data unit ciphertext corresponding to the target data unit identifier from the stored data mapping relationship corresponding to each data unit and send it to the client.
2. The method according to claim 1, characterized in that, The expression consisting of at least two keywords is composed of the at least two keywords and logical operators; The process of determining the target data unit identifier based on the data unit identifier corresponding to each keyword includes: If the query relation includes an expression consisting of at least two keywords, then logical operations are performed on the data unit identifiers corresponding to each keyword according to the logical operators between the keywords in the expression, and the target data unit identifier is determined based on the operation result.
3. The method according to claim 1, characterized in that, The step of receiving the target data unit identifier ciphertext returned by the server includes: receiving a combination of data unit identifier ciphertexts returned by the server; the combination of data unit identifier ciphertexts includes the data unit identifier ciphertexts corresponding to each result in the random position combination; and identifying the target data unit identifier ciphertext from the combination of data unit identifier ciphertexts.
4. A method for storing encrypted data based on trusted hardware, characterized in that, This method is applied to the scenario of trusted hardware-based encrypted data query as described in any one of claims 1 to 3. The method is applied to a client and includes: Keyword extraction is performed on each data unit to be encrypted to obtain keyword-data unit groups. Each keyword-data unit group includes a keyword and at least one data unit identifier. The data units corresponding to each data unit identifier in the same keyword-data unit group contain the keyword in that keyword-data unit group. For each keyword-data unit group, a ciphertext mapping relationship is determined. This ciphertext mapping relationship includes the correspondence between the data unit identifier ciphertext and the location ciphertext. The data unit identifier ciphertext is obtained by encrypting each data unit identifier in the keyword-data unit group using a key SK negotiated with trusted hardware. The location ciphertext includes the randomization result obtained by randomizing the keywords in the keyword-data unit group based on the key SK. For each data unit, determine the corresponding data mapping relationship; the data mapping relationship for each data unit includes the correspondence between the data unit identifier and the ciphertext of the data unit; Store the encrypted mapping relationship of each keyword-data unit group and the data mapping relationship of each data unit on the server.
5. The method according to claim 4, characterized in that, The encrypted data unit identifier is obtained by encrypting the data unit identifier in the keyword-data unit group using a symmetric encryption algorithm and the key SK.
6. The method according to claim 4, characterized in that, The randomization process based on the key SK for the keywords in the keyword-data unit group includes: The keywords in the keyword-data unit group are hashed, and then the hash result and the key SK are randomized to obtain the randomization result.
7. The method according to claim 4, characterized in that, The ciphertext of any data unit is obtained by the client encrypting the data unit using a symmetric encryption algorithm and the local key CK.
8. A storage device for encrypted data based on trusted hardware, characterized in that, The device is applied to a scenario of trusted hardware-based encrypted data query as described in any one of claims 1 to 3, and the device is applied to a client, comprising: The extraction unit is used to extract keywords from each data unit to be encrypted to obtain keyword-data unit groups. Each keyword-data unit group includes a keyword and a data unit identifier of at least one data unit. The keywords in the keyword-data unit group are present in the data units corresponding to the data unit identifiers in the same keyword-data unit group. The determining unit is configured to determine the ciphertext mapping relationship corresponding to each keyword-data unit group; the ciphertext mapping relationship corresponding to the keyword-data unit group includes the correspondence between data unit identifier ciphertext and position ciphertext, wherein the data unit identifier ciphertext is obtained by encrypting each data unit identifier in the keyword-data unit group using a key SK negotiated with trusted hardware; the position ciphertext includes: a randomization result obtained by randomizing the keywords in the keyword-data unit group based on the key SK; and... For each data unit, determine the corresponding data mapping relationship; the data mapping relationship for each data unit includes the correspondence between the data unit identifier and the ciphertext of the data unit; The storage unit is used to store the encrypted mapping relationship corresponding to each keyword-data unit group and the data mapping relationship corresponding to each data unit to the server.
9. A secure data query device based on trusted hardware, characterized in that, This device is used in trusted hardware, including: The obtaining unit is used to obtain a query token; the token is an encrypted query token generated by encrypting a random number and the client's query expression; the query expression includes a keyword or an expression consisting of at least two keywords; The query unit is configured to perform the following steps for each keyword in the token: randomize the keyword based on the key SK negotiated with the client to obtain the randomization result corresponding to the keyword; send the random position combination corresponding to the keyword to the server; the random position combination includes at least the randomization result corresponding to the keyword and at least one reference result other than the randomization result, so that the server can find the target position ciphertext containing the randomization result in the stored ciphertext mapping relationship corresponding to each keyword-data unit group; receive the target data unit identifier ciphertext returned by the server, the target data unit identifier ciphertext being the target data unit identifier ciphertext corresponding to the target position ciphertext found by the server from the ciphertext mapping relationship corresponding to each keyword-data unit group; and decrypt the target data unit identifier ciphertext using the key SK to obtain the data unit identifier corresponding to the keyword. The processing unit is configured to determine the target data unit identifier based on the data unit identifier corresponding to each keyword; and send the target data unit identifier to the server so that the server can find the target data unit ciphertext corresponding to the target data unit identifier from the stored data mapping relationship corresponding to each data unit and send it to the client.
10. An electronic device, characterized in that, The electronic device includes: a processor and a machine-readable storage medium; The machine-readable storage medium stores machine-executable instructions that can be executed by the processor; The processor is configured to execute machine-executable instructions to implement the method steps of any one of claims 1-7.