A method and system for data encryption and encrypted data query

By introducing interceptors into the data storage and query processing paths, data encryption and search keyword conversion are implemented, encrypted data query problems are solved, efficient query and search are achieved, and applicable to various systems.

CN114647866BActive Publication Date: 2025-03-18BEIJING TIANWEI CHENGXIN ELECTRONIC COMMERCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210217060.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-07
Publication Date
2025-03-18
Estimated Expiration
2042-03-07

AI Technical Summary

Technical Problem

It is difficult for the prior art to effectively query and search for encrypted data without changing the system's original data query method and processing logic.

Method used

By introducing data storage interceptors and data query interceptors in the data storage and query processing paths, the plug-in mechanism is used to realize data encryption and decryption, and the conversion of search keywords, ensuring the searchability and sortability of encrypted data.

Benefits of technology

It realizes efficient query and search of encrypted data, avoids changes in system data storage and query processing logic, and is suitable for deployed and newly developed systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114647866B_ABST
    Figure CN114647866B_ABST
Patent Text Reader

Abstract

Data encryption and encrypted data query method: the interceptor stores data in the form of plain text or encrypted searchable data, encrypted sortable data and encrypted data; the encrypted searchable data is encrypted after word segmentation; when storing data, a plain text search auxiliary record database, a searchable cipher text search auxiliary record database, a sortable cipher text search auxiliary record database, and a cipher text search auxiliary record database are also generated; when querying data, the interceptor converts the plain text search keywords into one or more of the plain text keywords, cipher text searchable keywords, cipher text sortable keywords, and cipher text keywords; if the plain text search keywords are allowed to be converted into one or more of them, then by checking the corresponding auxiliary record database, the search keywords are converted into corresponding plain text keywords, cipher text searchable keywords, cipher text sortable keywords, and cipher text keywords, and one of them can be selected according to the rules; the queried cipher text data is decrypted by the interceptor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of information security technology, and in particular to a data encryption and encrypted data query method and system. Background Art

[0002] For network application systems, data security is very important. The most effective technical means to protect the data stored in the application system (such as data in the database) is to encrypt the stored data and then decrypt the encrypted data when the data is needed.

[0003] Although data encryption is the most effective technical means to protect data security, how to query and search encrypted data (ciphertext data) is a problem that has not yet been well solved, because data will lose many of its original characteristics after encryption, which is not conducive to query and search (in this invention, the meanings of "query" and "search" are the same and consistent, and can be used interchangeably). The existing encrypted (ciphertext) data query solution based on word segmentation index needs to modify the system's data storage and query processing logic and method. Its query processing logic and method for encrypted data are completely different from the original query processing logic and method for plain text. For example, this solution needs to use the hash value (hash value) of the keyword and indirectly query the data through the index containing the hash value (hash value) of the keyword. In this way, it is necessary to modify the data storage structure (such as the structure of the table) of the data storage system, and modify and change it at the database query statement (SQL) level, and change the processing method of the query result (change the program code) to obtain the expected result. Moreover, this encrypted data query method based on word segmentation index cannot be implemented through plug-in mechanisms such as filters and valves without changing the original data query method and processing logic (program) of the system. This is not good for deployed systems because the data storage and query processing logic and method of deployed systems cannot be changed. Moreover, even for newly developed systems, developers need to be familiar with this new data storage and query method, and cannot program according to the original data storage and query method they are familiar with. Summary of the invention

[0004] The purpose of the present invention is to propose a data encryption and query technology solution that can realize ciphertext data query and search, so as to overcome the shortcomings of the prior art.

[0005] In view of the purpose of the present invention, the technical solution proposed by the present invention includes a data encryption method, an encrypted data query method and a corresponding system.

[0006] The data encryption method proposed by the present invention is specifically as follows.

[0007] The data encryption method includes a data storage interceptor; the data storage interceptor is a component inserted by a plug-in mechanism in a data storage processing path and a processing link, and is located before the processing logic and components that (ultimately) execute the data storage processing; the data storage interceptor is used for the conversion of data storage requests;

[0008] After intercepting the data storage processing request (submitted by the client or application system), for the (plaintext) data that does not need to be encrypted, the data storage interceptor directly transmits the data storage request to the subsequent data storage processing logic or component, and the data storage processing logic or component stores the data in plaintext in the data storage system. At the same time, the data storage interceptor calls the word segmentation component to perform word segmentation on the plaintext data to be stored or stored, and obtains one or more plaintext data blocks after word segmentation, that is, the word segmentation plaintext data blocks, for subsequent processing;

[0009] After intercepting the data storage processing request (submitted by the client or application system), the data storage interceptor encrypts the (plaintext) data that needs to be encrypted and generates a new data storage request, which contains the encrypted ciphertext data. The generated new data storage request is then transmitted to the subsequent data storage processing logic or component, which stores the ciphertext data in the data storage system according to the new data storage request, wherein:

[0010] For the searchable data (plaintext data) that needs to be encrypted, the data storage interceptor first calls the word segmentation component to perform word segmentation on the searchable data that needs to be encrypted, and then calls the cipher component to obtain each data component after the word segmentation, that is, the plaintext data block after the word segmentation, that is, the word segmentation plaintext data block, respectively, and then combines the (ciphertext) data blocks obtained after the encryption processing to form the final ciphertext data; the searchable data that needs to be encrypted refers to the data that the encrypted ciphertext data still retains the searchable characteristics (the searchable characteristics, that is, it can be queried and searched by searching keywords or words);

[0011] For the sortable data (plaintext data) that needs to be encrypted, the data storage interceptor calls the cryptographic component to encrypt the data in an order-preserving encryption method (Order-Preserving Encryption, OPE); the sortable data that needs to be encrypted refers to the data whose ciphertext data obtained after encryption still retains the sortable property (the sortable property means that it can be sorted in a certain way such as size); the order-preserving encryption method is a data encryption method in which the ciphertext data obtained after encryption still retains the sortable property;

[0012] For non-searchable and non-sortable data (plaintext data) that needs to be encrypted, the data storage interceptor calls the cryptographic component to encrypt the data using a predetermined (or set) encryption method;

[0013] If the data to be encrypted is both searchable and sortable, it is encrypted as searchable data, where the encryption method used for data encryption is an order-preserving encryption method, that is, first perform word segmentation, then use the order-preserving encryption method to encrypt each plaintext data block obtained by word segmentation, that is, the word segmentation plaintext data block, and then merge the encrypted (ciphertext) data blocks to obtain the final ciphertext data;

[0014] The data storage system is a system for storing data (it can be a relational database, a non-relational database, or other types of data storage systems, such as a file-based data storage system, etc.);

[0015] The data storage interceptor determines through configuration information which data in the data storage request is stored in plain text, which data needs to be encrypted and stored in ciphertext data, and which data among the data that needs to be encrypted is searchable data, which data is sortable data, and which data is non-searchable and non-sortable data;

[0016] The word segmentation process refers to dividing plaintext data (such as plaintext data representing a sentence) into one or more data components, i.e., data blocks after word segmentation, i.e., word segmentation plaintext data blocks, according to predetermined (linguistic or other) laws and rules, and each data component, i.e., data block, has a maximum length limit (not greater than the maximum length, but may be less than the maximum length); the word segmentation process used for data stored in plaintext and data stored in ciphertext (i.e., searchable plaintext data that needs to be encrypted) does not have to be the same;

[0017] The word segmentation component is a component that performs word segmentation processing on data;

[0018] The cryptographic component is a component that performs encryption processing on data;

[0019] The data encryption method also includes the following types of auxiliary record databases (used to assist data query and search):

[0020] A plaintext search auxiliary record database, a searchable ciphertext search auxiliary record database, a sortable ciphertext search auxiliary record database, and a ciphertext search auxiliary record database (the database here can be a relational database, a non-relational database, or other data storage systems. Each type of auxiliary record database can use its own data storage system or share a data storage system; the data storage system used as the auxiliary record database and the data storage system storing plaintext and ciphertext do not have to use the same data storage system);

[0021] Each type of auxiliary record database stores a series of records, each of which is called a record or a record data; the records in the auxiliary record database are not indexes for query search (not objects of data query search or part of the queried data object, for example, not query objects of SQL statements when performing data query), but are used to convert search keywords into corresponding or different types of search keywords when performing data query, including: plaintext keywords (used for searching plaintext data), ciphertext searchable keywords (used for searching encrypted encrypted searchable data), ciphertext sortable keywords (used for searching encrypted encrypted sortable data), ciphertext keywords (used for searching encrypted non-searchable and non-sortable data);

[0022] For the (plaintext) data that does not need to be encrypted, the data storage interceptor performs word segmentation on the plaintext being processed to be stored or stored, obtains one or more plaintext data blocks after word segmentation, i.e., word segmentation plaintext data blocks, and further processes each obtained word segmentation plaintext data block in the following manner:

[0023] Check whether the corresponding segmented plaintext data block has been recorded in the plaintext search auxiliary record database, that is, whether there is a record stored or corresponding to the segmented plaintext data block being checked and processed. If yes, process the segmented plaintext data block obtained by the next segmentation (do not generate auxiliary records for the current segmented plaintext data block) until all segmented plaintext data blocks are processed; if not, generate a plaintext search auxiliary record, which stores or corresponds to the segmented plaintext data block being checked and processed, save the generated plaintext search auxiliary record to the plaintext search auxiliary record database, and then process the segmented plaintext data block obtained by the next segmentation, until all segmented plaintext data blocks are processed;

[0024] The data storage interceptor performs word segmentation processing on the searchable data to be encrypted, obtains one or more plaintext data blocks after word segmentation, namely, word segmentation plaintext data blocks, and further processes each word segmentation plaintext data block before encryption in the following manner before or after calling the cryptographic component to complete encryption processing on the word segmentation plaintext data blocks obtained by word segmentation:

[0025] Check whether the hash value (hash value) of the corresponding word segmentation plaintext data block has been recorded in the searchable ciphertext search auxiliary record database, that is, whether there is a record storing or corresponding to the hash value (hash value) of the word segmentation plaintext data block being checked and processed. If yes, process the next word segmentation plaintext data block obtained by word segmentation (do not generate auxiliary records for the current word segmentation plaintext data block) until all word segmentation plaintext data blocks obtained by word segmentation are processed; if not, generate a searchable ciphertext search auxiliary record, which stores or corresponds to the hash value (hash value) of the word segmentation plaintext data block being checked and processed, save the generated searchable ciphertext search auxiliary record in the searchable ciphertext search auxiliary record database, and then process the next word segmentation plaintext data block obtained by word segmentation until all word segmentation plaintext data blocks obtained by word segmentation are processed;

[0026] For the sortable data that needs to be encrypted, the data storage interceptor further processes the sortable data that needs to be encrypted in the following manner before or after calling the cryptographic component to encrypt the data in an order-preserving encryption manner:

[0027] Check whether the sortable ciphertext search auxiliary record database has recorded the corresponding hash value (hash value) of the sortable data to be encrypted, that is, whether there is a record storing or corresponding to the hash value (hash value) of the sortable data to be encrypted. If yes, no further processing is performed; if no, generate a sortable ciphertext search auxiliary record, which stores or corresponds to the hash value (hash value) of the sortable data to be encrypted being processed, save the generated sortable ciphertext search auxiliary record into the sortable ciphertext search auxiliary record database, and complete the processing;

[0028] The data storage interceptor further processes the non-searchable and non-sortable data that needs to be encrypted as follows before or after calling the cryptographic component to encrypt the data:

[0029] Check whether the corresponding hash value (hash value) of the data to be encrypted is recorded in the ciphertext search auxiliary record database, that is, whether there is a record storing or corresponding to the hash value (hash value) of the data to be encrypted. If so, no further processing is performed; if not, generate a ciphertext search auxiliary record, which stores or corresponds to the hash value (hash value) of the data to be encrypted being processed, and save the generated ciphertext search auxiliary record in the ciphertext search auxiliary record database to complete the processing.

[0030] For the data encryption method described above, if the data storage request contains multiple data items that need to be stored (such as multiple fields of a data record that needs to be stored), the data storage interceptor processes each data item according to the data encryption method.

[0031] For the data encryption method described above, if the data storage request contains multiple data that need to be stored, the storage types of the multiple data that the data storage interceptor needs to process simultaneously do not have to be the same (for example, one of them is plaintext storage data, one is ciphertext searchable data, one is ciphertext sortable data, etc.).

[0032] The encrypted data query method for the above-mentioned data encryption method is as follows.

[0033] The encrypted data query method includes a data query interceptor; the data query interceptor is a component inserted by a plug-in mechanism in a data query processing path and a processing link, and is located before the processing logic and components that (ultimately) execute the data query processing; the data query interceptor is used for data query request and response conversion;

[0034] After intercepting the data query request (submitted by the client or application system), the data query interceptor converts and generates the final (or new) search (query) keyword (or keyword, the two are equivalent, the same below) according to the search (query) keyword (or keyword, the two are equivalent, the same below) in the query request, generates a new data query request using the search (query) keyword generated by the conversion, and then transmits the generated new data query request to the subsequent data query processing logic or component, which queries and obtains data from the data storage system storing plain text and / or ciphertext, and then intercepts the data returned by the query processing logic or component, calls the cryptographic component to decrypt the encrypted data (ciphertext data) in the queried (returned) data, and then returns the plaintext data (including the plaintext data directly obtained by the query and the plaintext data obtained by decryption);

[0035] The data query interceptor converts each search keyword in each query condition field in the received query request in the following manner (a query request may include multiple query condition fields, and a query condition field may include one or more search keywords, such as keywords separated by commas or spaces):

[0036] According to the configuration information, the search keyword is converted into one or more specified types of search keywords;

[0037] Alternatively, according to the allowed type of the converted search keyword set in the configuration information, check whether the search keyword (to be converted) or its hash value (not necessarily the original search keyword appears in full, but may appear partially after word segmentation) appears in the corresponding auxiliary record database, and convert the search keyword into a type (of the search keyword) that is allowed to appear;

[0038] The types of search keywords specified or allowed to appear after the conversion include: plain text keywords, cipher text searchable keywords, cipher text sortable keywords, and cipher text keywords;

[0039] The correspondence between the types of search keywords allowed to appear after conversion and the auxiliary record database to be checked is as follows:

[0040] Plain text keywords, corresponding to the plain text search auxiliary record database;

[0041] The ciphertext can be searched for keywords, and the corresponding ciphertext can be searched for auxiliary records database;

[0042] Ciphertext sortable keywords, corresponding to sortable ciphertext search auxiliary record database;

[0043] Ciphertext keywords, corresponding to ciphertext search auxiliary record database;

[0044] If the data query request contains multiple query condition fields, there is corresponding search keyword conversion configuration information for each query field.

[0045] For the encrypted data query method described above, the data query interceptor converts the search keyword into one or more specified types of search keywords according to the configuration information as follows:

[0046] If the search keyword needs to be converted into a plaintext keyword, the search keyword after conversion is the search keyword before conversion (i.e., no conversion, i.e., plaintext keyword);

[0047] If the search keyword needs to be converted into a ciphertext searchable keyword, the word segmentation component is first called to perform word segmentation on the search keyword, and then the cipher component is called to encrypt each plaintext data block obtained by word segmentation, that is, the word segmentation plaintext data block, and then the encrypted data is merged, and the merged encrypted data is used as the search keyword (that is, the ciphertext searchable keyword);

[0048] If the search keyword needs to be converted into a ciphertext sortable keyword, the cryptographic component is called to encrypt the search keyword in an order-preserving encryption method, and then the encrypted data is used as the search keyword (i.e., the ciphertext sortable keyword);

[0049] If the search keyword needs to be converted into a ciphertext keyword, the cryptographic component is called to encrypt the search keyword in an agreed manner (an encryption method for non-searchable and non-sortable data), and the encrypted data is used as the search keyword (i.e., the ciphertext keyword);

[0050] If the search keyword is converted into a ciphertext searchable keyword, and the ciphertext data for which the ciphertext searchable keyword is used for query is both searchable data and sortable data, then after the search keyword to be converted is segmented, the encryption method used to encrypt each plaintext data block obtained by the segmentation, i.e., the segmented plaintext data block, is an order-preserving encryption method;

[0051] After the conversion is completed, the converted search keyword is used as a new search keyword for data query (one search keyword may be converted into multiple search keywords).

[0052] For the encrypted data query method described above, the data query interceptor checks whether the search keyword (to be converted) or its hash value appears in the corresponding auxiliary record database according to the type of the converted search keyword allowed to appear set by the configuration information, and converts the search keyword into the type allowed to appear as follows:

[0053] If the types of search keywords allowed to appear after conversion set in the configuration information include plaintext keywords, the word segmentation component is called to perform word segmentation on the search keywords to be converted, and then it is checked whether one of the one or more data blocks obtained by word segmentation, i.e., the word segmentation plaintext data blocks, appears in a record of the plaintext search auxiliary record database. If not, the conversion result is empty. If yes, the search keyword before conversion is used as the search keyword after conversion (i.e., the plaintext keyword);

[0054] If the types of search keywords after conversion set in the configuration information are allowed to appear include ciphertext searchable keywords, the word segmentation component is called to perform word segmentation on the search keywords to be converted, and then it is checked whether a hash value (hash value) of one or more data blocks obtained by word segmentation, i.e., the word segmentation plaintext data blocks, appears in a record of the searchable ciphertext search auxiliary record database. If not, the conversion result is empty. If so, the cryptographic component is called to encrypt each plaintext data block obtained by word segmentation, i.e., the word segmentation plaintext data block, and then the encrypted data are merged, and the merged encrypted data is used as the search keyword after conversion (i.e., the ciphertext searchable keyword);

[0055] If the types of search keywords allowed to appear after conversion set in the configuration information include ciphertext sortable keywords, then check whether the hash value (hash value) of the search keyword to be converted appears in a record of the sortable ciphertext search auxiliary record database, if not, the conversion result is empty, if yes, call the cryptographic component to encrypt the search keyword, and then use the encrypted data as the search keyword after conversion (i.e., the ciphertext sortable keyword);

[0056] If the types of search keywords allowed to appear after conversion set in the configuration information include ciphertext keywords, then check whether the hash value (hash value) of the search keyword to be converted appears in a record of the ciphertext search auxiliary record database. If not, the conversion result is empty. If so, call the cryptographic component to encrypt the search keyword, and then use the encrypted data as the search keyword after conversion (i.e., the ciphertext keyword);

[0057] If there are one or more converted search keywords after all allowed types of conversion are completed, the converted search keywords are used as new search keywords for data query;

[0058] If after completing the conversion of all allowed types, there is no converted search keyword (that is, the search keywords of the allowed types are all empty), the search keyword is converted to the default type of search keyword specified by the configuration information for data query, or the search keyword is converted to the corresponding type of search keyword for data query according to the rules set in the configuration information; the rules for converting the search keyword to the corresponding type of search keyword set in the configuration information include: randomly selecting a type of converted search keyword from the allowed conversion types.

[0059] For the encrypted data query method described above, if the configuration information sets multiple types of search keywords allowed to appear after conversion, and limits the final conversion result to only one type of search keywords, and the conversion result has more than one type of search keywords, then the data query component selects one type of search keyword from the multiple types of search keywords obtained by conversion for data query according to the rules set by the configuration information; the rules for selecting one type of search keyword from the multiple types of search keywords set by the configuration information include: based on the priority of the converted search keyword types (selecting the type with a higher priority among the allowed types), randomly selecting a converted search keyword type from the allowed types.

[0060] For the encrypted data query method described above, if the data storage interceptor, when performing data storage processing, checks whether the hash value (hash value) of the segmented plaintext data block or the plaintext data to be encrypted or the hash value (hash value) of the data to be encrypted already exists in the auxiliary record database, and at the same time, counts the number of times the hash value (hash value) of the segmented plaintext data block to be stored or the plaintext data to be encrypted or the data to be encrypted appears (one is added each time it appears), then the rules for selecting a type of converted search keyword from the multiple types of allowed search keywords set in the configuration information include: selecting the search keyword that appears the most times when the data is stored.

[0061] The data encryption system based on the above data encryption method includes:

[0062] A data storage interceptor for data storage request conversion, a word segmentation component for word segmentation of (plain text) data, a cryptographic component for encrypting data, a data storage system for storing plain text data and cipher text data (encrypted data), and a plain text search auxiliary record database for assisting data query search, a searchable cipher text search auxiliary record database, a sortable cipher text search auxiliary record database, and a cipher text search auxiliary record database;

[0063] After intercepting the data storage request, the data storage interceptor performs data storage request conversion processing according to the data encryption method.

[0064] The encrypted data query system based on the encrypted data query method described above includes:

[0065] A data query interceptor for data query request and response conversion, a word segmentation component for word segmentation of (plain text) data, a cryptographic component for encryption and decryption of data, a data storage system for storing plain text data and cipher text data (encrypted data), and a plain text search auxiliary record database for assisting data query search, a searchable cipher text search auxiliary record database, a sortable cipher text search auxiliary record database, and a cipher text search auxiliary record database;

[0066] After intercepting the data query request, the data query interceptor performs data query request and response conversion processing according to the encrypted data query method.

[0067] Based on the data encryption and encrypted data query method and system of the present invention: the data storage structure (such as the structure of the table) of the data storage system does not need to be changed; when data storage is performed, the data is automatically encrypted by the data storage interceptor, and the data storage processing logic or components do not need to be modified, and the data is still stored in the original manner; when data query is performed, the original search keywords are converted into different types of search keywords by the data query interceptor, and the data query processing logic or components do not need to be changed, and the data query is still performed in the original manner including at the query statement level, and the query results are still processed in the original manner (for example, the results obtained by combining queries in the original manner); since all these data operation processes are implemented at the interceptor level using the plug-in mechanism, therefore, for existing and deployed systems, the system's data storage and query processing logic and components do not need to be modified, and for newly developed systems, programmers still write data storage and query programs in the original manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] Figure 1A schematic structural diagram of a data encryption system of the present invention.

[0069] Figure 2 A schematic structural diagram of the encrypted data query system of the present invention. DETAILED DESCRIPTION

[0070] The following is a further description of specific implementations of the present invention. The following implementations do not represent all possible implementations and are not intended to limit the present invention.

[0071] The data storage interceptor of the present invention can be implemented by a pluggable component located in the data storage processing path and processing link, such as a filter, valve, code aspect, or interceptor in a certain technical architecture of a Web server; similarly, the data query interceptor can be implemented by a pluggable component located in the data query processing path and processing link, such as a filter, valve, code aspect, or interceptor in a certain technical architecture of a Web server.

[0072] The data storage system used for storing data in the present invention is an original or common data storage system before the encryption function is implemented. For example, it can be a relational database, a non-relational database, or other types of data storage systems, such as a file-based data storage system.

[0073] The word segmentation processing of the present invention can be based on language laws and rules, and the plaintext data representing the sentence can be divided into one or more data components, i.e., data blocks, i.e., word segmentation plaintext data blocks, and each data component, i.e., data block has a maximum length limit (not greater than the maximum length, but can be less than), which has many mature technologies. At this time, the word segmentation result can be encrypted using a symmetric key encryption with the characteristics of an electronic code book (ECB), or an asymmetric key encryption that supports ciphertext search, or other encryption schemes that support ciphertext search (as long as the search for ciphertext can be achieved, even if it is a partial search). The word segmentation processing of the present invention can also be data segmentation performed according to the block encryption requirements, provided that the encryption of the block data can achieve ciphertext search. If the data to be encrypted is both searchable data and sortable data, the data to be encrypted is encrypted according to the searchable data, wherein the encryption method used for encrypting the plaintext data blocks obtained by word segmentation, i.e., the word segmentation plaintext data blocks, is an encryption method that can preserve the order.

[0074] The order-preserving encryption method of the present invention may adopt an existing, suitable order-preserving encryption scheme (Order-Preserving Encryption).

[0075] For encryption of non-searchable and non-sortable data, an encryption scheme deemed appropriate by the implementer may be used, such as ECB block cipher, or a stream cipher that produces the same ciphertext for the same plaintext.

[0076] There are many hash algorithms (hash algorithms) for calculating hash values ​​(hash values), just choose a safe one.

[0077] The various types of auxiliary record databases of the present invention are data storage systems other than plaintext and ciphertext data, and may adopt relational databases, non-relational databases, or other data storage systems; they may adopt independent data storage systems, or the same data storage system; a field of a record in the auxiliary record database stores a segmented plaintext data block (for plaintext storage data), or a hash value of the segmented plaintext data block after segmentation of searchable data to be encrypted, or a hash value of sortable data to be encrypted, or a hash value of non-searchable and non-sortable data to be encrypted.

[0078] When querying data, the present invention converts the search keywords into three situations according to the settings of the configuration information:

[0079] 1) Convert the search keyword into one or more specified types of search keywords;

[0080] 2) According to the allowed type of the converted search keyword set in the configuration information, check whether the search keyword (to be converted) or its hash value appears in the corresponding auxiliary record database, and convert the search keyword into a search keyword of the allowed type;

[0081] 3) Add restrictions based on 2) to limit the final conversion results to only one type of search keyword.

[0082] The first situation is usually used when multiple search keywords are allowed to appear in a search field, so it is allowed and feasible to convert one search keyword into multiple search keywords; after the search keyword conversion is completed, one or more converted search keywords are used as new search keywords for data query.

[0083] The second situation is an optimization of the first situation to avoid unnecessary search keyword conversions; if there are one or more converted search keywords after completing the conversion of all allowed types, the converted search keywords are used as new search keywords for data query; if there are no converted search keywords after completing the conversion of all allowed types (that is, the search keywords of the allowed types are all empty), the search keywords are converted to the default type of search keywords specified by the configuration information for data query, or the search keywords are converted to the corresponding type of search keywords for data query according to the rules set in the configuration information; the rules for converting the search keywords to the corresponding type of search keywords set in the configuration information include: randomly selecting a type of converted search keyword from the allowed conversion types.

[0084] The third situation is mainly aimed at the situation that only one search keyword can appear in a search field, and multiple search keywords are not allowed, and it is impossible to know in advance which converted search keyword should be used; the configuration information further stipulates that if the conversion result has more than one type of search keyword, then what is the rule for selecting one type of search keyword from the multiple types of search keywords obtained by conversion for data query; the rules for selecting one type of search keyword from the multiple types of search keywords set by the configuration information include: according to the priority of the converted search keyword type (select the type with a higher priority among the allowed types), randomly select a converted one from the allowed types Search keyword type; further, if the data storage interceptor, during data storage processing, checks whether the hash value (hash value) of the segmented plaintext data block or the plaintext data to be encrypted or the hash value (hash value) of the data to be encrypted already exists in the auxiliary record database, and at the same time, counts the number of occurrences of the hash value (hash value) of the segmented plaintext data block to be stored or the plaintext data to be encrypted or the data to be encrypted (one is added for each occurrence), then the rules for selecting one type of converted search keyword from the multiple types of allowed search keywords set in the configuration information include: selecting the search keyword that appears the most times when data is stored.

[0085] Based on the data encryption method of the present invention, a corresponding data encryption system can be constructed, such as Figure 1As shown, the system includes: a data storage interceptor for converting data storage requests, a word segmentation component for performing word segmentation processing on (plaintext) data, a cryptographic component for performing encryption processing on data, a data storage system for storing plaintext data and ciphertext data (encrypted data), and a plaintext search auxiliary record database for assisting data query and search, a searchable ciphertext search auxiliary record database, a sortable ciphertext search auxiliary record database, and a ciphertext search auxiliary record database; after intercepting a data storage request, the data storage interceptor performs data storage request conversion processing according to the data encryption method.

[0086] Based on the encrypted data query method of the present invention, a corresponding encrypted data query system can be constructed, such as Figure 2 As shown, the system includes: a data query interceptor for data query request and response conversion, a word segmentation component for word segmentation processing of (plaintext) data, a cryptographic component for encrypting and decrypting data, a data storage system for storing plaintext data and ciphertext data (encrypted data), and a plaintext search auxiliary record database for assisting data query search, a searchable ciphertext search auxiliary record database, a sortable ciphertext search auxiliary record database, and a ciphertext search auxiliary record database; after intercepting a data query request, the data query interceptor performs data query request and response conversion processing according to the encrypted data query method.

[0087] Other specific technical implementations not described are well known and self-evident to technicians in the relevant fields.

Claims

1. A data encryption method, characterized in that: The data encryption method includes a data storage interceptor; the data storage interceptor is a component inserted by a plug-in mechanism in a data storage processing path and a processing link, and is located before the processing logic and components that perform data storage processing; the data storage interceptor is used for conversion of data storage requests; After intercepting the data storage processing request, for data that does not need to be encrypted, the data storage interceptor directly transmits the data storage request to the subsequent data storage processing logic or component, and the data storage processing logic or component stores the data in plain text in the data storage system. At the same time, the data storage interceptor calls the word segmentation component to perform word segmentation on the plain text data to be stored or stored, and obtains one or more plain text data blocks after word segmentation, that is, word segmentation plain text data blocks, for subsequent processing; After intercepting the data storage processing request, the data storage interceptor encrypts the data that needs to be encrypted and generates a new data storage request, which contains the encrypted ciphertext data. The generated new data storage request is then transmitted to the subsequent data storage processing logic or component, which stores the ciphertext data in the data storage system according to the new data storage request, wherein: For the searchable data that needs to be encrypted, the data storage interceptor first calls the word segmentation component to perform word segmentation on the searchable data that needs to be encrypted, and then calls the cipher component to obtain each data component after the word segmentation, that is, the plaintext data block after the word segmentation, that is, the word segmentation plaintext data block, and performs encryption processing on each data component, that is, the plaintext data block after the word segmentation, and then combines the data blocks obtained after the encryption processing to form the final ciphertext data; the searchable data that needs to be encrypted refers to the data whose encrypted ciphertext data still retains the searchable characteristics; For the sortable data that needs to be encrypted, the data storage interceptor calls the cryptographic component to encrypt the data in an order-preserving encryption method; the sortable data that needs to be encrypted refers to data that still retains the sortable property after the encryption of the ciphertext data; the order-preserving encryption method refers to a data encryption method in which the encrypted ciphertext data still retains the sortable property; For non-searchable and non-sortable data that needs to be encrypted, the data storage interceptor calls the cryptographic component to encrypt the data using a predetermined encryption method; If the data to be encrypted is both searchable and sortable, it is encrypted as searchable data, where the encryption method used for data encryption is an order-preserving encryption method, that is, first perform word segmentation, then use the order-preserving encryption method to encrypt each plaintext data block obtained by word segmentation, that is, the word segmentation plaintext data block, and then merge the encrypted data blocks to obtain the final ciphertext data; The data storage system is a system for storing data; The data storage interceptor determines through configuration information which data in the data storage request is stored in plain text, which data needs to be encrypted and stored in ciphertext data, and which data among the data that needs to be encrypted is searchable data, which data is sortable data, and which data is non-searchable and non-sortable data; The word segmentation process refers to dividing the plaintext data into one or more data components, i.e., data blocks after word segmentation, i.e., word segmentation plaintext data blocks, according to predetermined laws and rules, and each data component, i.e., data block, has a maximum length limit; the word segmentation process used for data stored in plaintext and data stored in ciphertext does not have to be the same; The word segmentation component is a component that performs word segmentation processing on data; The cryptographic component is a component that performs encryption processing on data; The data encryption method also includes the following types of auxiliary record databases: a plaintext search auxiliary record database, a searchable ciphertext search auxiliary record database, a sortable ciphertext search auxiliary record database, and a ciphertext search auxiliary record database; Each type of auxiliary record database stores a series of records, each of which is called a record or a record data; the records in the auxiliary record database are not indexes for query searches, but are used to convert search keywords into corresponding or different types of search keywords when querying data, including: plaintext keywords, ciphertext searchable keywords, ciphertext sortable keywords, and ciphertext keywords.

2. The data encryption method according to claim 1, characterized in that: For data that does not need to be encrypted, the data storage interceptor performs word segmentation on the plaintext being processed to be stored or stored, obtains one or more plaintext data blocks after word segmentation, i.e., word segmentation plaintext data blocks, and further processes each obtained word segmentation plaintext data block in the following manner: Check whether the corresponding word segmentation plaintext data block has been recorded in the plaintext search auxiliary record database, that is, whether there is a record storing or corresponding to the word segmentation plaintext data block being checked and processed. If yes, process the next word segmentation plaintext data block obtained by word segmentation until all word segmentation plaintext data blocks obtained by word segmentation are processed; if not, generate a plaintext search auxiliary record, which stores or corresponds to the word segmentation plaintext data block being checked and processed, save the generated plaintext search auxiliary record in the plaintext search auxiliary record database, and then process the next word segmentation plaintext data block obtained by word segmentation until all word segmentation plaintext data blocks obtained by word segmentation are processed; The data storage interceptor performs word segmentation processing on the searchable data to be encrypted, obtains one or more plaintext data blocks after word segmentation, namely, word segmentation plaintext data blocks, and further processes each word segmentation plaintext data block before encryption in the following manner before or after calling the cryptographic component to complete encryption processing on the word segmentation plaintext data blocks obtained by word segmentation: Check whether the hash value of the corresponding word segmentation plaintext data block has been recorded in the searchable ciphertext search auxiliary record database, that is, whether there is a record storing or corresponding to the hash value of the word segmentation plaintext data block being checked and processed. If yes, process the next word segmentation plaintext data block until all word segmentation plaintext data blocks are processed; if not, generate a searchable ciphertext search auxiliary record, which stores or corresponds to the hash value of the word segmentation plaintext data block being checked and processed, save the generated searchable ciphertext search auxiliary record in the searchable ciphertext search auxiliary record database, and then process the next word segmentation plaintext data block until all word segmentation plaintext data blocks are processed; For the sortable data that needs to be encrypted, the data storage interceptor further processes the sortable data that needs to be encrypted in the following manner before or after calling the cryptographic component to encrypt the data in an order-preserving encryption manner: Check whether the sortable ciphertext search auxiliary record database has recorded the corresponding hash value of the sortable data to be encrypted, that is, whether there is a record stored or corresponding to the hash value of the sortable data to be encrypted. If yes, no further processing is performed; If not, a sortable ciphertext search auxiliary record is generated, which stores or corresponds to the hash value of the sortable data that needs to be encrypted being processed, and the generated sortable ciphertext search auxiliary record is saved in the sortable ciphertext search auxiliary record database to complete the processing; The data storage interceptor further processes the non-searchable and non-sortable data that needs to be encrypted as follows before or after calling the cryptographic component to encrypt the data: Check whether the corresponding hash value of the data to be encrypted is already recorded in the ciphertext search auxiliary record database, that is, whether there is a record stored or corresponding to the hash value of the data to be encrypted. If yes, no further processing is performed; If not, a ciphertext search auxiliary record is generated, which stores or corresponds to the hash value of the data being processed that needs to be encrypted, and the generated ciphertext search auxiliary record is saved in the ciphertext search auxiliary record database to complete the processing.

3. The data encryption method according to claim 2, characterized in that: If the data storage request contains multiple items of data that need to be stored, the data storage interceptor processes each item of data according to the data encryption method.

4. The data encryption method according to claim 3, characterized in that: If the data storage request includes multiple pieces of data that need to be stored, the storage types of the multiple pieces of data that the data storage interceptor needs to process simultaneously do not have to be the same.

5. An encrypted data query method based on the data encryption method of claim 4, characterized in that: The encrypted data query method includes a data query interceptor; the data query interceptor is a component inserted by a plug-in mechanism in a data query processing path and a processing link, and is located before the processing logic and components that perform data query processing; the data query interceptor is used for data query request and response conversion; After intercepting the data query request, the data query interceptor converts and generates the final search keyword according to the search keyword in the query request, generates a new data query request using the search keyword generated by the conversion, and then transmits the generated new data query request to the subsequent data query processing logic or component, which queries and obtains data from the data storage system storing plain text and / or ciphertext, then intercepts the data returned by the query processing logic or component, calls the cryptographic component to decrypt the encrypted data in the queried data, and then returns the plain text data; The data query interceptor converts each search keyword in each query condition field in the received query request in the following manner: According to the configuration information, the search keyword is converted into one or more specified types of search keywords; Alternatively, according to the type of allowed appearance of the converted search keyword set in the configuration information, check whether the search keyword or its hash value appears in the corresponding auxiliary record database, and convert the search keyword into a type that is allowed to appear; The types of search keywords specified or allowed to appear after the conversion include: plain text keywords, cipher text searchable keywords, cipher text sortable keywords, and cipher text keywords; The correspondence between the types of search keywords allowed to appear after conversion and the auxiliary record database to be checked is as follows: Plain text keywords, corresponding to the plain text search auxiliary record database; The ciphertext can be searched for keywords, and the corresponding ciphertext can be searched for auxiliary records database; Ciphertext sortable keywords, corresponding to sortable ciphertext search auxiliary record database; Ciphertext keywords, corresponding to ciphertext search auxiliary record database; If the data query request contains multiple query condition fields, there is corresponding search keyword conversion configuration information for each query field.

6. The encrypted data query method according to claim 5, characterized in that: The data query interceptor converts the search keyword into one or more specified types of search keywords according to the configuration information as follows: If the search keyword needs to be converted into a plain text keyword, the search keyword after conversion is the search keyword before conversion; If the search keyword needs to be converted into a ciphertext searchable keyword, the word segmentation component is first called to segment the search keyword, and then the cipher component is called to encrypt each plaintext data block obtained by the word segmentation, that is, the word segmentation plaintext data block, and then the encrypted data is merged, and the merged encrypted data is used as the search keyword; If the search keyword needs to be converted into a ciphertext sortable keyword, the cryptographic component is called to encrypt the search keyword in an order-preserving encryption method, and then the encrypted data is used as the search keyword; If the search keyword needs to be converted into a ciphertext keyword, the cryptographic component is called to encrypt the search keyword in an agreed manner, and the encrypted data is used as the search keyword; If the search keyword is converted into a ciphertext searchable keyword, and the ciphertext data for which the ciphertext searchable keyword is used for query is both searchable data and sortable data, then after the search keyword to be converted is segmented, the encryption method used to encrypt each plaintext data block obtained by the segmentation, i.e., the segmented plaintext data block, is an order-preserving encryption method; After the conversion is completed, the converted search keywords are used as new search keywords for data query.

7. The encrypted data query method according to claim 6, characterized in that: The data query interceptor checks whether the search keyword or its hash value appears in the corresponding auxiliary record database according to the type of the converted search keyword allowed to appear set by the configuration information, and converts the search keyword into the type allowed to appear as follows: If the types of search keywords allowed to appear after conversion set in the configuration information include plaintext keywords, the word segmentation component is called to perform word segmentation on the search keywords to be converted, and then one or more data blocks obtained by word segmentation, i.e., the word segmentation plaintext data blocks, are checked to see whether one of them appears in a record in the plaintext search auxiliary record database. If not, the conversion result is empty. If so, the search keyword before conversion is used as the search keyword after conversion. If the types of search keywords after conversion set in the configuration information are allowed to appear include ciphertext searchable keywords, the word segmentation component is called to perform word segmentation on the search keyword to be converted, and then it is checked whether a hash value of one or more data blocks obtained by word segmentation, i.e., the word segmentation plaintext data blocks, appears in a record of the searchable ciphertext search auxiliary record database. If not, the conversion result is empty. If so, the cryptographic component is called to encrypt each plaintext data block obtained by word segmentation, i.e., the word segmentation plaintext data block, and then the encrypted data are merged, and the merged encrypted data is used as the search keyword after conversion; If the types of search keywords allowed to appear after conversion set in the configuration information include ciphertext sortable keywords, then check whether the hash value of the search keyword to be converted appears in a record of the sortable ciphertext search auxiliary record database, if not, the conversion result is empty, if yes, call the cryptographic component to encrypt the search keyword, and then use the encrypted data as the search keyword after conversion; If the types of search keywords allowed to appear after conversion set in the configuration information include ciphertext keywords, then check whether the hash value of the search keyword to be converted appears in a record in the ciphertext search auxiliary record database. If not, the conversion result is empty. If so, call the cryptographic component to encrypt the search keyword, and then use the encrypted data as the search keyword after conversion; If there are one or more converted search keywords after all allowed types of conversion are completed, the converted search keywords are used as new search keywords for data query; If there is no converted search keyword after completing conversion of all allowed types, the search keyword will be converted to a search keyword of the default type specified by the configuration information for data query, or the search keyword will be converted to a search keyword of the corresponding type for data query according to the rules set in the configuration information; the rules for converting the search keyword into the corresponding type of search keyword set in the configuration information include: randomly selecting a type of converted search keyword from the allowed conversion types.

8. The encrypted data query method according to claim 7, characterized in that: If the configuration information sets multiple types of search keywords allowed after conversion and limits the final conversion result to only one type of search keywords, and the conversion result has more than one type of search keywords, then the data query interceptor selects one type of search keyword from the multiple types of search keywords obtained after conversion for data query according to the rules set in the configuration information; the rules for selecting one type of search keyword from the multiple types of search keywords set in the configuration information include: randomly selecting a type of converted search keyword from the allowed types according to the priority of the converted search keyword types.

9. The encrypted data query method according to claim 8, characterized in that: If the data storage interceptor, during data storage processing, checks whether the segmented plaintext data block after word segmentation or the hash value of the plaintext data after word segmentation to be encrypted or the hash value of the data to be encrypted already exists in the auxiliary record database, and at the same time counts the number of times the segmented plaintext data block to be stored or the hash value of the plaintext data after word segmentation to be encrypted or the number of times the data to be encrypted appears, then the rules for selecting one type of converted search keywords from the multiple types of allowed search keywords set in the configuration information include: selecting the search keyword that appears the most times during data storage.

10. A data encryption system based on the data encryption method according to claim 4, characterized in that: The data encryption system includes: a data storage interceptor for data storage request conversion, a word segmentation component for word segmentation processing of data, a password component for encryption processing of data, a data storage system for storing plaintext data and ciphertext data, and a plaintext search auxiliary record database for assisting data query search, a searchable ciphertext search auxiliary record database, a sortable ciphertext search auxiliary record database, and a ciphertext search auxiliary record database; After intercepting the data storage request, the data storage interceptor performs data storage request conversion processing according to the data encryption method.

11. An encrypted data query system based on the encrypted data query method according to claim 8 or 9, characterized in that: The data query system includes: a data query interceptor for data query request and response conversion, a word segmentation component for word segmentation processing of data, a cryptographic component for encryption and decryption processing of data, a data storage system for storing plaintext data and ciphertext data, and a plaintext search auxiliary record database for assisting data query search, a searchable ciphertext search auxiliary record database, a sortable ciphertext search auxiliary record database, and a ciphertext search auxiliary record database; After intercepting the data query request, the data query interceptor performs data query request and response conversion processing according to the encrypted data query method.

Citation Information

Patent Citations

  • Multi-keyword plaintext and ciphertext retrieving method and device oriented to cloud storage

    CN103593476A

  • Web system-oriented data encryption and decryption method and system

    CN113206838A