Query method and device of encrypted information, electronic equipment and storage medium

By generating a key matrix and decomposition strategy using a pre-defined query model, the memory usage and storage cost issues of fuzzy querying of encrypted information are resolved, enabling fast and efficient querying of encrypted information.

CN116644221BActive Publication Date: 2025-12-23INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310597912.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-24
Publication Date
2025-12-23
Estimated Expiration
2043-05-24

AI Technical Summary

Technical Problem

Existing fuzzy query methods for encrypted information suffer from problems such as high memory consumption, unsuitability for big data scenarios, and high storage costs, making them ineffective for fuzzy queries of encrypted information.

Method used

By adopting a preset query model, generating a key matrix and a decomposition strategy, and combining it with a preset ciphertext database, fuzzy queries on encrypted information can be achieved. This includes receiving plaintext strings, generating a key matrix, querying the ciphertext database, and decrypting the ciphertext result with the highest similarity.

Benefits of technology

It enables fast and efficient fuzzy queries in encrypted information scenarios, reduces memory usage and storage costs, and supports fast indexing and querying of massive amounts of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116644221B_ABST
    Figure CN116644221B_ABST
Patent Text Reader

Abstract

The application discloses a query method and device of encrypted information, electronic equipment and a storage medium, and relates to the field of information security, and the query method comprises the following steps: receiving an information query request initiated by a target terminal, generating a key matrix based on a plaintext string and a preset transformation table, querying a preset ciphertext database based on the key matrix and a decomposition strategy corresponding to the query demand, obtaining a query result, decrypting the ciphertext result with the highest similarity degree indication by using the key matrix to obtain a plaintext result, and returning the plaintext result to the target terminal. The application solves the technical problem that encrypted information cannot be effectively queried in the related art.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of information security, and in particular, to a query method and device for encrypted information, an electronic device and a storage medium. BACKGROUND

[0002] With the increasing awareness of protecting customer information and increasingly stringent requirements for protecting customer information, when storing customer information in a financial institution system, important data or sensitive data needs to be encrypted, such as identification number, mobile phone number, address, password and the like. However, the encrypted data affects the original performance of the system, and the encrypted data is not readable. When searching the encrypted data in the database, full-text matching must be performed. If fuzzy matching is used to obtain data, the encrypted data cannot meet such requirements.

[0003] In related technologies, the following methods are often used to solve the above problems: (1) brute force method, which is suitable for scenarios with small amounts of data. First, all data is loaded into memory for decryption. After decryption, fuzzy matching is performed through a program algorithm, or a consistent encryption and decryption algorithm is implemented in the database, the fuzzy query condition is modified, and the database encryption and decryption function is used to decrypt and then fuzzy query; (2) conventional method, which separately adds a column as a search column, and the original ciphertext column is used for decryption business. First, the ciphertext data is segmented and combined, and the result set of the segmented and combined data is encrypted and then stored in the extended column. When searching, the data is directly encrypted and fuzzy searched. For example, through this method, the user sensitive data in the order data of an e-commerce platform is encrypted while supporting fuzzy query.

[0004] However, the method of obtaining data by fuzzy matching in related technologies has the following problems: (1) for the brute force method, the memory occupancy rate is high, it is not suitable for scenarios with large amounts of data, and it cannot take advantage of database indexes to optimize queries; (2) for the conventional method, because there is an extended field, the storage cost is increased, which is a way of using cost to exchange speed.

[0005] At present, there is no effective solution to the above problems. SUMMARY

[0006] The embodiments of the present application provide a query method and device for encrypted information, an electronic device and a storage medium, to at least solve the technical problem that encrypted information cannot be effectively fuzzy queried in related technologies.

[0007] According to an aspect of the embodiments of the present application, a query method for encrypted information is provided, which is applied to a preset query model used for connecting a query application and a preset ciphertext database. The query method comprises: receiving an information query request initiated by a target terminal, wherein the information query request comprises at least a plaintext string and a query requirement; generating a key matrix based on the plaintext string and a preset transformation table, wherein the preset transformation table is used to represent the corresponding relationship between characters and numbers; querying the preset ciphertext database based on the key matrix and a decomposition strategy corresponding to the query requirement to obtain a query result, wherein the query result comprises L ciphertext results, L is a positive integer greater than or equal to 1, and the ciphertext results correspond to a similarity; decrypting the ciphertext result indicated by the highest similarity using the key matrix to obtain a plaintext result, and returning the plaintext result to the target terminal.

[0008] Optionally, before receiving the information query request sent by the target terminal, the query method further comprises: receiving an input request of the target terminal by the query application, wherein the input request carries the plaintext string; initiating a query requirement selection request to the target terminal by the query application under the condition that the input request is received, wherein the target terminal responds to the query requirement selection request and returns the query requirement; generating the information query request based on the plaintext string and the query requirement by the query application, and sending the information query request to the preset query model.

[0009] Optionally, the plaintext string comprises a plurality of sub-strings, and the step of generating the key matrix based on the plaintext string and the preset transformation table comprises: dividing the plaintext string into M sets of sub-strings according to the first character of each sub-string, wherein M is a positive integer greater than or equal to 1; determining the number of sub-strings in each set of sub-strings, and supplementing with random numbers under the condition that the number of sub-strings is less than M, until the sum of the number of sub-strings and the number of random numbers is equal to M; constructing a preset matrix based on all supplemented sets of sub-strings, wherein the preset matrix is a M*M matrix; and converting each sub-string in the preset matrix into a number based on the preset transformation table to obtain the key matrix.

[0010] Optionally, the step of querying the preset ciphertext database based on the key matrix and the decomposition strategy corresponding to the query requirement comprises: encrypting the plaintext string using the key matrix to generate a ciphertext string; decomposing the ciphertext string into N ciphertext keywords using the decomposition strategy corresponding to the query requirement, wherein N is a positive integer greater than or equal to 1; and querying the ciphertext results matching the ciphertext keywords in the preset ciphertext database.

[0011] Optionally, the step of encrypting the plaintext string by using the key matrix to generate a ciphertext string comprises: performing word segmentation on the plaintext string to obtain a first word segmentation vector; converting each character element in the first word segmentation vector into a digital element based on the preset transformation table to obtain a first digital vector; performing a modulo operation on the product of the first digital vector and the key matrix and M to generate a second digital vector; converting each digital element in the second digital vector into a character element based on the preset transformation table to obtain a second word segmentation vector; and generating the ciphertext string based on the second word segmentation vector.

[0012] Optionally, the step of decomposing the ciphertext string into N ciphertext keywords according to the decomposition strategy corresponding to the query requirement comprises: in the case that the query requirement is a reserved original content requirement, decomposing the ciphertext string into N ciphertext keywords according to the decomposition strategy corresponding to the reserved original content requirement; or in the case that the query requirement is a filtered original content requirement, filtering preset words in the ciphertext string according to the decomposition strategy corresponding to the filtered original content requirement to obtain a target ciphertext string, and decomposing the target ciphertext string into N ciphertext keywords.

[0013] Optionally, after querying the ciphertext result matching the ciphertext keyword in the preset ciphertext database, the method further comprises: determining the number of repeated words between the ciphertext string and the ciphertext result; determining the number of ciphertexts of all words in the ciphertext result; and determining the similarity of the ciphertext result based on the number of repeated words and the number of ciphertexts.

[0014] Optionally, after querying the preset ciphertext database based on the key matrix and the decomposition strategy corresponding to the query requirement, the method further comprises: decrypting all the ciphertext results by using the key matrix to obtain plaintext results corresponding to the ciphertext results; sorting the similarities of the ciphertext results to obtain a sorting result; and returning the plaintext results corresponding to the ciphertext results indicated by the similarities located in a preset position range to the target terminal according to the sorting result.

[0015] Optionally, the step of decrypting the ciphertext result with the highest similarity indication by using the key matrix to obtain the plaintext result comprises: performing word segmentation processing on the ciphertext result to obtain a third word segmentation vector; converting each character element in the third word segmentation vector into a digital element based on the preset transformation table to obtain a third digital vector; performing a modulo operation on the product of the third digital vector and the inverse matrix of the key matrix and M to generate a fourth digital vector; converting each digital element in the fourth digital vector into a character element based on the preset transformation table to obtain a fourth word segmentation vector; and generating the plaintext result based on the fourth word segmentation vector.

[0016] Optionally, the query method further comprises: constructing an initial query model, wherein the initial query model comprises an initial weight parameter and an initial bias parameter; collecting query strings in a historical time period to obtain training data; adjusting the initial weight parameter and the initial bias parameter by using the training data until the similarity between the plaintext result output by the initial query model and the input query string exceeds a preset similarity threshold to obtain a target weight parameter and a target bias parameter; and updating the initial query model based on the target weight parameter and the target bias parameter to obtain the preset query model.

[0017] According to another aspect of the embodiments of the present application, an information query device for encrypted information is also provided, which is applied to a preset query model used for connecting a query application and a preset ciphertext database. The query device comprises: a receiving unit configured to receive an information query request initiated by a target terminal, wherein the information query request comprises at least a plaintext string and a query requirement; a generating unit configured to generate a key matrix based on the plaintext string and a preset transformation table, wherein the preset transformation table is used to represent the corresponding relationship between characters and numbers; a querying unit configured to query the preset ciphertext database based on the key matrix and a decomposition strategy corresponding to the query requirement to obtain a query result, wherein the query result comprises L ciphertext results, L is a positive integer greater than or equal to 1, and the ciphertext results correspond to similarity indications; and a decrypting unit configured to decrypt the ciphertext result with the highest similarity indication by using the key matrix to obtain a plaintext result, and return the plaintext result to the target terminal.

[0018] Optionally, the query device further comprises: a first receiving module, configured to receive an input request of a target terminal before receiving an information query request sent by the target terminal, wherein the input request carries the plaintext string; a first initiating module, configured to initiate a query demand selection request to the target terminal when the query application receives the input request, wherein the target terminal responds to the query demand selection request and returns the query demand; and a first generating module, configured to generate the information query request based on the plaintext string and the query demand, and send the information query request to the preset query model.

[0019] Optionally, the plaintext string comprises a plurality of substrings, and the generating unit comprises: a first dividing module, configured to divide the plaintext string into M sets of substrings according to the first character of each substring, wherein M is a positive integer greater than or equal to 1; a first determining module, configured to determine the number of substrings in each set of substrings, and supplement with random numbers if the number of substrings is less than M, until the sum of the number of substrings and the number of random numbers is equal to M; a first constructing module, configured to construct a preset matrix based on all the supplemented sets of substrings, wherein the preset matrix is an M*M matrix; and a first converting module, configured to convert each substring in the preset matrix into a number based on the preset conversion table to obtain the key matrix.

[0020] Optionally, the query unit comprises: a second generating module, configured to encrypt the plaintext string using the key matrix to generate a ciphertext string; a first decomposing module, configured to decompose the ciphertext string into N ciphertext keywords using a decomposition strategy corresponding to the query demand, wherein N is a positive integer greater than or equal to 1; and a first query module, configured to query the preset ciphertext database for a ciphertext result matching the ciphertext keyword.

[0021] Optionally, the second generating module comprises: a first processing submodule, configured to perform word segmentation processing on the plaintext string to obtain a first segmented vector; a first conversion submodule, configured to convert each character element in the first segmented vector into a digital element based on the preset conversion table to obtain a first digital vector; a first generating submodule, configured to perform a modulo operation on the product of the first digital vector and the key matrix and M to generate a second digital vector; a second conversion submodule, configured to convert each digital element in the second digital vector into a character element based on the preset conversion table to obtain a second segmented vector; and a second generating submodule, configured to generate the ciphertext string based on the second segmented vector.

[0022] Optionally, the first decomposition module comprises: a first decomposition submodule, configured to, in a case where the query requirement is a reserved original content requirement, decompose the ciphertext string into N ciphertext keywords by using the decomposition strategy corresponding to the reserved original content requirement; and a second decomposition submodule, configured to, in a case where the query requirement is a filtered original content requirement, filter preset words in the ciphertext string by using the decomposition strategy corresponding to the filtered original content requirement to obtain a target ciphertext string, and decompose the target ciphertext string into N ciphertext keywords.

[0023] Optionally, the query device further comprises: a second determination module, configured to determine a repetition number of repeated words between the ciphertext string and the ciphertext result after querying the ciphertext database for the ciphertext result matching the ciphertext keyword; a third determination module, configured to determine a ciphertext number of all words in the ciphertext result; and a fourth determination module, configured to determine a similarity of the ciphertext result based on the repetition number and the ciphertext number.

[0024] Optionally, the query device further comprises: a first decryption module, configured to, after querying the ciphertext database based on the key matrix and the decomposition strategy corresponding to the query requirement, decrypt all the ciphertext results by using the key matrix to obtain plaintext results corresponding to the ciphertext results; a first sorting module, configured to sort the similarities of the ciphertext results to obtain a sorting result; and a first returning module, configured to return the plaintext results corresponding to the ciphertext results located in a preset position range to the target terminal according to the similarity indication in the sorting result.

[0025] Optionally, the decryption unit comprises: a first processing module, configured to perform word segmentation processing on the ciphertext result to obtain a third word segmentation vector; a second conversion module, configured to convert each character element in the third word segmentation vector into a digital element based on the preset conversion table to obtain a third digital vector; a third generation module, configured to perform a modulo operation on a product of the third digital vector and an inverse matrix of the key matrix and M to generate a fourth digital vector; a third conversion module, configured to convert each digital element in the fourth digital vector into a character element based on the preset conversion table to obtain a fourth word segmentation vector; and a fourth generation module, configured to generate the plaintext result based on the fourth word segmentation vector.

[0026] Optionally, the query device further comprises: a second construction module, configured to construct an initial query model, wherein the initial query model comprises an initial weight parameter and an initial bias parameter; a first acquisition module, configured to acquire a query string in a historical time period to obtain training data; a first adjustment module, configured to adjust the initial weight parameter and the initial bias parameter by using the training data until a similarity between a plaintext result output by the initial query model and the query string input exceeds a preset similarity threshold to obtain a target weight parameter and a target bias parameter; and a first update module, configured to update the initial query model based on the target weight parameter and the target bias parameter to obtain the preset query model.

[0027] According to a further aspect of the embodiments of the present application, a computer readable storage medium is provided, which comprises a stored computer program, wherein the computer readable storage medium controls a device where the computer readable storage medium is located to perform the query method of encrypted information when the computer program runs.

[0028] According to a further aspect of the embodiments of the present application, an electronic device is provided, which comprises one or more processors and a memory, wherein the memory is configured to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the query method of encrypted information.

[0029] In the present disclosure, a target terminal initiates an information query request, a key matrix is generated based on a plaintext string and a preset transformation table, a preset ciphertext database is queried based on the key matrix and a decomposition strategy corresponding to a query requirement to obtain a query result, a ciphertext result with the highest similarity is decrypted by using the key matrix to obtain a plaintext result, and the plaintext result is returned to the target terminal. In the present disclosure, the key matrix can be generated according to the received plaintext string and the preset transformation table, then the preset ciphertext database is queried according to the key matrix and the decomposition strategy corresponding to the received query requirement to obtain a plurality of ciphertext results, the ciphertext result with the highest similarity is determined and decrypted by using the key matrix to obtain the plaintext result, and then the plaintext result is returned to the target terminal, which can quickly and effectively query encrypted information, thereby solving the technical problem that encrypted information cannot be effectively queried in the related art. BRIEF DESCRIPTION OF DRAWINGS

[0030] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and serve to explain the principles of the application. In the drawings:

[0031] Figure 1is a flow chart of an optional query method of encrypted information according to an embodiment of the present application;

[0032] Figure 2 is a schematic diagram of an optional cloud translator control flow according to an embodiment of the present application;

[0033] Figure 3 is a schematic diagram of an optional cloud translator processing flow according to an embodiment of the present application;

[0034] Figure 4 is a schematic diagram of an optional iterative learning flow according to an embodiment of the present application;

[0035] Figure 5 is a schematic diagram of an optional query device of encrypted information according to an embodiment of the present application;

[0036] Figure 6 is a hardware structure block diagram of an electronic device (or mobile device) for a query method of encrypted information according to an embodiment of the present application. DETAILED DESCRIPTION

[0037] In order to make the personnel in the art better understand the present application scheme, the technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should belong to the scope of protection of the present application.

[0038] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0039] It should be noted that the query method of encrypted information and the device thereof in the present disclosure can be used in the case of querying encrypted information in the field of information security, and can also be used in the case of querying encrypted information in any field other than the field of information security. The application field of the query method of encrypted information and the device thereof in the present disclosure is not limited.

[0040] It should be noted that the related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with the relevant laws, regulations and standards of the country and region, and provide corresponding operation portal for the user to choose authorization or refusal. For example, an interface is provided between the system and the related user or agency, and before obtaining the related information, the interface needs to send an acquisition request to the aforementioned user or agency, and after receiving the consent information fed back by the aforementioned user or agency, the related information is acquired.

[0041] The following embodiments of the present application can be applied to various systems / applications / devices for querying encrypted information. In the present application, fuzzy query refers to intelligent matching even in the case of inaccurate keyword input. Fuzzy cases include incomplete spelling, such as the word about being input as abou; and spelling errors, such as the word search being misspelled as serch, searlch, etc. The classic algorithm for fuzzy query is to use the method of measuring the shortest edit distance to judge the fuzziness, but this needs to be matched on the basis of plaintext, and the encrypted string after the plaintext edit distance is 1 is often completely different. Therefore, the present application proposes an encrypted information fuzzy query mechanism based on cloud storage segmentation, which can support encrypted information fuzzy query and has the characteristics of supporting massive data scenarios and fast query using index.

[0042] The present application will be described in detail below in conjunction with various embodiments.

[0043] Embodiment one

[0044] According to an embodiment of the present application, an embodiment of a query method for encrypted information is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0045] Figure 1 is a flowchart of an optional query method for encrypted information according to an embodiment of the present application, as shown in Figure 1 The method comprises the following steps:

[0046] Step S101, receiving an information query request initiated by a target terminal, wherein the information query request at least comprises: a plaintext string, a query requirement.

[0047] In step S102, a key matrix is generated based on the plaintext string and a preset transformation table, wherein the preset transformation table is used to represent the correspondence between characters and numbers.

[0048] In step S103, the preset ciphertext database is queried based on the key matrix and a decomposition strategy corresponding to the query requirement, to obtain a query result, wherein the query result includes L ciphertext results, L is a positive integer greater than or equal to 1, and the ciphertext results correspond to a similarity.

[0049] In step S104, the ciphertext result indicated by the highest similarity is decrypted by using the key matrix to obtain a plaintext result, and the plaintext result is returned to the target terminal.

[0050] Through the above steps, the information query request initiated by the target terminal can be received, the key matrix is generated based on the plaintext string and the preset transformation table, the preset ciphertext database is queried based on the key matrix and the decomposition strategy corresponding to the query requirement to obtain the query result, the ciphertext result indicated by the highest similarity is decrypted by using the key matrix to obtain the plaintext result, and the plaintext result is returned to the target terminal. In the embodiment of the present application, the key matrix can be generated according to the received plaintext string and the preset transformation table, then the preset ciphertext database is queried according to the key matrix and the decomposition strategy corresponding to the received query requirement to obtain a plurality of ciphertext results, the ciphertext result with the highest similarity is determined and decrypted by using the key matrix to obtain the plaintext result, and then the plaintext result is returned to the target terminal, which can quickly and effectively query the encrypted information, thereby solving the technical problem that the encrypted information cannot be effectively queried in the related art.

[0051] The embodiment of the present application will be described in detail below in combination with the above steps. The following steps can be applied to a preset query model (for example, a cloud translator, which is an encryption and decryption engine), and the preset query model is used to connect a query application and a preset ciphertext database (that is, a preset query model is added between the query application and the preset ciphertext database).

[0052] In the embodiment of the present application, in order to realize the fuzzy query function of the encrypted information, an encryption and decryption engine (that is, a preset query model, for example, a cloud translator) is added between an application program (that is, a query application) and a database management system (in which a preset ciphertext database is deployed). The preset query model is responsible for converting the original query of the user into a query of encrypted data, and it needs to access metadata (that is, a collection of conversion rules, including: a preset transformation table, a decomposition strategy, etc.) in the conversion process. After the encrypted database completes the query, the encrypted result is stored in a temporary result, and then sent to the preset query model to decrypt the encrypted query result, and the original query is executed again on the decrypted data, and finally the accurate query result is returned to the user.

[0053] Figure 2 is a schematic diagram of an optional cloud translator control flow according to an embodiment of the application, as shown, a user makes an original query (plaintext) through an application, the cloud translator converts the original query into a query for encrypted data, in the process of conversion it needs to access metadata, and after completing the query on the encrypted database, stores the obtained encrypted result into a temporary result, and sends it into the cloud translator to decrypt the encrypted result to obtain the actual result (plaintext), and returns it to the user through the application. Figure 2

[0054] Optionally, before receiving the information query request sent by the target terminal, the method further includes: receiving an input request of the target terminal by the query application, wherein the input request carries a plaintext string; initiating a query demand selection request to the target terminal by the query application after receiving the input request, wherein the target terminal responds to the query demand selection request and returns a query demand; generating an information query request based on the plaintext string and the query demand by the query application, and sending the information query request to the preset query model.

[0055] In the embodiment of the application, the user can send an input request (which carries a plaintext string, and the plaintext string is a string of an original query) to the query application through the target terminal, the query application can initiate a query demand selection request to the target terminal after receiving the input request (that is, the query application can display a query demand list to the target terminal, for example, a demand for retaining original content, a demand for filtering original content, etc.), the target terminal can respond to the query demand selection request (that is, the user can select a query demand through the target terminal), and return the selected query demand, and the query application can generate an information query request based on the plaintext string and the query demand, and send the information query request to the preset query model for processing.

[0056] Step S101, receiving an information query request initiated by a target terminal, wherein the information query request at least includes a plaintext string and a query demand.

[0057] In the embodiment of the application, the preset query model can receive an information query request initiated by a target terminal, and the information query request includes a plaintext string, a query demand, etc.

[0058] Step S102, generating a key matrix based on the plaintext string and a preset transformation table, wherein the preset transformation table is used to represent the corresponding relationship between characters and numbers.

[0059] ​Optionally, the plaintext string comprises a plurality of substrings, and the step of generating the key matrix based on the plaintext string and the preset transformation table comprises: dividing the plaintext string into M sets of substrings according to the first character of each substring, wherein M is a positive integer greater than or equal to 1; determining the number of substrings in each set of substrings, and supplementing with random numbers in the case that the number of substrings is less than M, until the sum of the number of substrings and the number of random numbers is equal to M; and constructing a preset matrix based on all the supplemented sets of substrings, wherein the preset matrix is an M*M matrix; and converting each substring in the preset matrix into a number based on the preset transformation table to obtain the key matrix.

[0060] In the embodiment of the application, the key matrix can be generated based on the plaintext string and a preset transformation table, and the preset transformation table is used to represent the correspondence between characters and numbers. Specifically, the plaintext character set (i.e. the plaintext string, which comprises a plurality of substrings) is first grouped according to data items, and substrings with the same first character are grouped into one group, and different characters are grouped into different groups. In this way, no matter how many groups there are, there are at most 26 groups (i.e. the plaintext string is divided into M sets of substrings according to the first character of each substring, wherein M is a positive integer greater than or equal to 1), and then the correspondence between characters and numbers is used to solve. The characters and numbers are not arranged in sequence, but are arranged in a random order table (i.e. the preset transformation table), so as to avoid forward guessing attacks and increase security. In this way, the obtained key (i.e. the key matrix) is a combination of the transformation matrix (i.e. the preset matrix) and the random order table. The key construction step is as follows: the number of substrings in each set of substrings can be determined first, and if the number of substrings is less than M, random numbers can be supplemented until the sum of the number of substrings and the number of random numbers is equal to M (i.e. the number of substrings in each group is supplemented to M). Then, a preset matrix (which is an M*M matrix) is constructed based on all the supplemented sets of substrings, and each substring in the preset matrix is converted into a number (the number corresponding to each character in the substring is accumulated to obtain the number corresponding to the substring) based on the preset transformation table, so as to obtain the key matrix.

[0061] In step S103, the preset ciphertext database is queried based on the key matrix and a decomposition strategy corresponding to the query requirement, and a query result is obtained, wherein the query result comprises L ciphertext results, L is a positive integer greater than or equal to 1, and the ciphertext result corresponds to a similarity.

[0062] Optionally, based on the key matrix and the decomposition strategy corresponding to the query requirement, the step of querying the preset ciphertext database comprises: encrypting the plaintext string by using the key matrix to generate a ciphertext string; decomposing the ciphertext string into N ciphertext keywords by using the decomposition strategy corresponding to the query requirement, wherein N is a positive integer greater than or equal to 1; and querying the preset ciphertext database for a ciphertext result matching the ciphertext keyword.

[0063] In the embodiment of the application, the preset ciphertext database can be queried according to the key matrix and the decomposition strategy corresponding to the query requirement to obtain a query result, which includes L ciphertext results, L being a positive integer greater than or equal to 1, and the ciphertext results corresponding to a similarity. Specifically, the plaintext string can be encrypted by using the key matrix to generate a ciphertext string (i.e., when performing fuzzy query, the plaintext string in the query statement can be tokenized and encrypted first to generate a ciphertext index, and then a plurality of ciphertext indexes can be combined to obtain a ciphertext string), and then the ciphertext string can be decomposed into N (N being a positive integer greater than or equal to 1) ciphertext keywords by using the decomposition strategy corresponding to the query requirement (since the ciphertext string is decomposed into a plurality of ciphertext keywords, the matching between the ciphertext keywords and the ciphertext will be performed multiple times when searching), and then the preset ciphertext database can be queried for a ciphertext result matching the ciphertext keyword.

[0064] Optionally, the step of encrypting the plaintext string by using the key matrix to generate a ciphertext string comprises: performing tokenization processing on the plaintext string to obtain a first tokenization vector; converting each character element in the first tokenization vector into a digital element based on a preset conversion table to obtain a first digital vector; performing a modulo operation on the product of the first digital vector and the key matrix and M to generate a second digital vector; converting each digital element in the second digital vector into a character element based on the preset conversion table to obtain a second tokenization vector; and generating the ciphertext string based on the second tokenization vector.

[0065] In the embodiment of the application, the core of the preset query model is a ciphertext index library, which can balance the security and privacy of data and the high efficiency and convenience of the cloud system. Meanwhile, the tokenization method based on the Hill (i.e., a kind of block cipher algorithm) cipher processing improvement can realize the fuzzy query function.

[0066] In the embodiment of the application, the Hill cipher is a kind of generalized affine cipher, and the basic idea is to convert n plaintext letters into n ciphertext letters through linear transformation, and only one inverse transformation is needed when decrypting. Assuming that the plaintext M=(m1, m2, …, mN), the ciphertext C=(c1, c2, …, cN), and the key is an n*n reversible matrix K=(K ij )n*n, wherein K ijrepresents an element in the i-th row and j-th column of the invertible matrix K. The encryption formula is: C=MK mod n; and the decryption formula is: M=CK - 1 mod n, wherein mod represents a remainder operation, and n represents the dimension of the invertible matrix K.

[0067] In the embodiment of the present application, the plaintext string can be first subjected to word segmentation processing to obtain a first segmented vector, then each character element in the first segmented vector is converted into a digital element according to a preset conversion table to obtain a first digital vector, then the product of the first digital vector and the key matrix is subjected to a remainder operation with M (i.e. the dimension of the key matrix) according to the encryption formula to generate a second digital vector, then each digital element in the second digital vector is converted into a character element according to the preset conversion table to obtain a second segmented vector, and finally the second segmented vector is used to generate a ciphertext string.

[0068] Optionally, the ciphertext string is decomposed into N ciphertext keywords by using a decomposition strategy corresponding to the query requirement, which includes: in the case that the query requirement is a requirement of retaining original content, a decomposition strategy corresponding to the requirement of retaining original content is used to decompose the ciphertext string into N ciphertext keywords; or in the case that the query requirement is a requirement of filtering original content, a decomposition strategy corresponding to the requirement of filtering original content is used to filter preset words in the ciphertext string to obtain a target ciphertext string, and then the target ciphertext string is decomposed into N ciphertext keywords.

[0069] In the embodiment of the present application, in order to reduce the number of indexes as much as possible to save space, hierarchical analysis retrieval can be introduced, different analyzers are added, and different analysis strategies are used for different search requirements. If it is required to save original content, any word contained in the original content can be returned in the search result. If a long sentence is searched, stop words (which can be preset, such as words like's' and 'd') and other meaningless content are filtered out, and case normalization and other operations are performed as required.

[0070] In the embodiment of the present application, if the query requirement selected by the user is a requirement of retaining original content, a decomposition strategy corresponding to the requirement of retaining original content (for example, dividing the ciphertext string according to a preset length) can be used to decompose the ciphertext string into N ciphertext keywords; if the query requirement selected by the user is a requirement of filtering original content, a decomposition strategy corresponding to the requirement of filtering original content (for example, filtering preset words first, and then decomposing the ciphertext string) can be used to filter preset words (for example, words like's' and 'd') in the ciphertext string to obtain a target ciphertext string, and then the target ciphertext string is decomposed into N ciphertext keywords.

[0071] Optionally, after querying the ciphertext result matching the ciphertext keyword in the preset ciphertext database, the method further comprises: determining the repetition quantity of repeated words between the ciphertext string and the ciphertext result; determining the ciphertext quantity of all words in the ciphertext result; and determining the similarity of the ciphertext result based on the repetition quantity and the ciphertext quantity.

[0072] In the embodiment of the present application, after matching the corresponding ciphertext result for each ciphertext keyword, the similarity of each ciphertext result can be calculated, specifically: the repetition quantity of repeated words between the ciphertext string and the ciphertext result can be determined first, then the ciphertext quantity of all words in the ciphertext result is determined, and finally the similarity of the ciphertext result is determined based on the repetition quantity and the ciphertext quantity (i.e. the ratio between the repetition quantity and the ciphertext quantity is taken as the similarity).

[0073] Optionally, after querying the preset ciphertext database based on the key matrix and the decomposition strategy corresponding to the query requirement, the method further comprises: decrypting all ciphertext results by using the key matrix to obtain plaintext results corresponding to the ciphertext results; sorting the similarities of the ciphertext results to obtain a sorting result; and returning the plaintext results corresponding to the ciphertext results indicated by the similarities located in a preset position range to the target terminal according to the sorting result.

[0074] In the embodiment of the present application, after matching the corresponding ciphertext result for each ciphertext keyword, all ciphertext results can also be decrypted by using the key matrix to obtain plaintext results corresponding to the ciphertext results (i.e. after matching multiple groups of ciphertexts, the decryption is performed in a secure manner). Then the similarities of the ciphertext results can be sorted to obtain a sorting result, and the plaintext results corresponding to the ciphertext results indicated by the similarities located in a preset position range (e.g. the top three with the highest similarity) are returned to the target terminal according to the sorting result (i.e. the search results are returned according to the similarity sorting).

[0075] Step S104: decrypting the ciphertext result indicated by the highest similarity by using the key matrix to obtain a plaintext result, and returning the plaintext result to the target terminal.

[0076] Optionally, the step of decrypting the ciphertext result indicated by the highest similarity by using the key matrix to obtain a plaintext result comprises: performing word segmentation processing on the ciphertext result to obtain a third word segmentation vector; converting each character element in the third word segmentation vector into a digital element based on a preset conversion table to obtain a third digital vector; performing a modulo operation on the product of the third digital vector and the inverse matrix of the key matrix and M to generate a fourth digital vector; converting each digital element in the fourth digital vector into a character element based on the preset conversion table to obtain a fourth word segmentation vector; and generating the plaintext result based on the fourth word segmentation vector.

[0077] In the embodiment of the present application, after matching the corresponding ciphertext result for each ciphertext keyword, the ciphertext result with the highest similarity can also be determined, the ciphertext result is decrypted using the key matrix to obtain the plaintext result, and the plaintext result is returned to the target terminal. Specifically, the ciphertext result can be first subjected to word segmentation processing to obtain a third word segmentation vector, then each character element in the third word segmentation vector is converted into a digital element according to a preset transformation table to obtain a third digital vector, then the product of the third digital vector and the inverse matrix of the key matrix is subjected to a modulo operation with M according to a decryption formula to generate a fourth digital vector, then each digital element in the fourth digital vector is converted into a character element according to the preset transformation table to obtain a fourth word segmentation vector, and finally the plaintext result is generated according to the fourth word segmentation vector.

[0078] Figure 3 is a schematic diagram of an optional cloud translator processing flow according to an embodiment of the present application, as shown, including user interaction, client encryption and decryption processing, cloud database operation and other modules, and the specific process is as follows: Figure 3

[0079] Firstly, the user inputs the plaintext for searching (i.e. inputs the search word in the user interaction module of the cloud translator), the client encryption and decryption processing module of the cloud translator can process the keyword based on Hill word segmentation (i.e. segment the plaintext data block based on Hill encryption), and perform hierarchical retrieval of the plaintext as needed, encrypt the segmented keyword in the cloud database operation module as an index (i.e. generate an index after encrypting the segmented keyword), combine multiple segmented indexes, the index object is the encrypted data block, and send it to the database for retrieval.

[0080] In the user interaction module, the ciphertext is input, i.e. the search word is input in the user interaction module, multiple ciphertext matching is performed through the cloud database operation module, then safe decryption is performed, and finally the search result is returned according to the similarity.

[0081] Optionally, the query method further includes: constructing an initial query model, wherein the initial query model includes: an initial weight parameter, an initial bias parameter; collecting query strings in a historical time period to obtain training data; adjusting the initial weight parameter and the initial bias parameter using the training data until the similarity between the plaintext result output by the initial query model and the input query string exceeds a preset similarity threshold to obtain a target weight parameter and a target bias parameter; updating the initial query model based on the target weight parameter and the target bias parameter to obtain a preset query model.

[0082] In the embodiment of the present application, the parameters of the first ciphertext fuzzy query can also be fed back, wherein the parameters include: the weight of the weakened common root, the bias, etc., and through multiple iterations, the fuzzy matching accuracy is finally improved.

[0083] ​In the embodiment of the present application, the preset query model can be pre-trained, specifically, an initial query model (including initial weight parameters and initial bias parameters) can be constructed first, then query strings in a historical time period (for example, one year) are collected to obtain training data, and the initial weight parameters and the initial bias parameters are adjusted using the training data until the similarity of the plaintext result output by the initial query model and the input query string exceeds a preset similarity threshold (which can be set according to actual conditions) to obtain target weight parameters and target bias parameters. Then, the initial query model is updated according to the target weight parameters and the target bias parameters to obtain the preset query model.

[0084] Figure 4 is a schematic diagram of an optional iterative learning process according to an embodiment of the present application, as shown in Figure 4 the input training samples (X1 and X2) and weights (W1 and W2) are calculated and output to obtain an output result, and an expectation is obtained, the output result is compared with the expected result, if satisfied, the result (i.e. the optimized parameter value) is obtained; if the result is not satisfied, the weights are adjusted multiple times until satisfied.

[0085] In the embodiment of the present application, Xi represents input, Wi represents weight, and b represents bias. The introduction of bias can make the model applicable to more cases. After obtaining the output result in the first round, comparison is performed, if the result is satisfied, it can be directly used, otherwise multiple iterations are performed to adjust the weights, and calculation is performed again after each adjustment, and the cycle is repeated until the result is satisfied.

[0086] In the embodiment of the present application, the fuzzy query of ciphertext information is realized, the ciphertext result matched by fuzzy matching can be sorted according to the similarity, and the plaintext result of the ciphertext result with a higher similarity indication is returned, and multiple iterations are performed to finally improve the fuzzy matching accuracy.

[0087] The following will be described in detail in combination with another embodiment.

[0088] Embodiment two

[0089] The query device for encrypted information provided in the embodiment includes a plurality of implementation units, each implementation unit corresponding to each implementation step in the above embodiment one.

[0090] Figure 5 is a schematic diagram of an optional query device for encrypted information according to an embodiment of the present application, as shown in Figure 5 the query device can include a receiving unit 50, a generating unit 51, a querying unit 52, and a decryption unit 53, wherein,

[0091] The receiving unit 50 is configured to receive an information query request initiated by the target terminal, wherein the information query request at least comprises a plaintext string and a query requirement.

[0092] The generating unit 51 is configured to generate a key matrix based on the plaintext string and a preset transformation table, wherein the preset transformation table is used to represent the correspondence between characters and numbers.

[0093] The querying unit 52 is configured to query a preset ciphertext database based on the key matrix and a decomposition strategy corresponding to the query requirement, to obtain a query result, wherein the query result comprises L ciphertext results, L is a positive integer greater than or equal to 1, and the ciphertext result corresponds to a similarity.

[0094] The decrypting unit 53 is configured to decrypt the ciphertext result with the highest similarity by using the key matrix, to obtain a plaintext result, and return the plaintext result to the target terminal.

[0095] The above-mentioned query device can receive an information query request initiated by the target terminal through the receiving unit 50, generate a key matrix based on the plaintext string and the preset transformation table through the generating unit 51, query a preset ciphertext database based on the key matrix and a decomposition strategy corresponding to the query requirement through the querying unit 52, obtain a query result, decrypt the ciphertext result with the highest similarity by using the key matrix through the decrypting unit 53, obtain a plaintext result, and return the plaintext result to the target terminal. In the embodiment of the application, the key matrix can be generated according to the received plaintext string and the preset transformation table, then a plurality of ciphertext results can be obtained by querying the preset ciphertext database according to the key matrix and the decomposition strategy corresponding to the received query requirement, the ciphertext result with the highest similarity is determined and decrypted by using the key matrix to obtain a plaintext result, and then the plaintext result is returned to the target terminal. The encrypted information can be quickly and effectively queried, and the technical problem that the encrypted information cannot be effectively queried in the related art is solved.

[0096] Optionally, the query device further comprises a first receiving module configured to query an input request of the target terminal before receiving the information query request sent by the target terminal, wherein the input request carries a plaintext string; a first initiating module configured to initiate a query requirement selection request to the target terminal in the case that the input request is received, wherein the target terminal responds to the query requirement selection request and returns a query requirement; and a first generating module configured to generate the information query request based on the plaintext string and the query requirement, and send the information query request to a preset query model.

[0097] Optionally, the plaintext string comprises a plurality of substrings, and the generating unit comprises: a first dividing module, configured to divide the plaintext string into M sets of substrings according to the first character of each substring, wherein M is a positive integer greater than or equal to 1; a first determining module, configured to determine the number of substrings in each set of substrings, and supplement with random numbers if the number of substrings is less than M, until the sum of the number of substrings and the number of random numbers is equal to M; a first constructing module, configured to construct a preset matrix based on all the supplemented sets of substrings, wherein the preset matrix is an M*M matrix; and a first converting module, configured to convert each substring in the preset matrix into a number based on a preset conversion table to obtain a key matrix.

[0098] Optionally, the querying unit comprises: a second generating module, configured to encrypt the plaintext string using the key matrix to generate a ciphertext string; a first decomposing module, configured to decompose the ciphertext string into N ciphertext keywords using a decomposition strategy corresponding to the query requirement, wherein N is a positive integer greater than or equal to 1; and a first querying module, configured to query the ciphertext database to obtain a ciphertext result matching the ciphertext keywords.

[0099] Optionally, the second generating module comprises: a first processing submodule, configured to perform word segmentation processing on the plaintext string to obtain a first segmented vector; a first converting submodule, configured to convert each character element in the first segmented vector into a numerical element based on a preset conversion table to obtain a first numerical vector; a first generating submodule, configured to perform a modulo operation on the product of the first numerical vector and the key matrix and M to generate a second numerical vector; a second converting submodule, configured to convert each numerical element in the second numerical vector into a character element based on the preset conversion table to obtain a second segmented vector; and a second generating submodule, configured to generate the ciphertext string based on the second segmented vector.

[0100] Optionally, the first decomposing module comprises: a first decomposing submodule, configured to, if the query requirement is a requirement to retain the original content, decompose the ciphertext string into N ciphertext keywords using a decomposition strategy corresponding to the requirement to retain the original content; and a second decomposing submodule, configured to, if the query requirement is a requirement to filter the original content, filter preset words in the ciphertext string using a decomposition strategy corresponding to the requirement to filter the original content to obtain a target ciphertext string, and decompose the target ciphertext string into N ciphertext keywords.

[0101] Optionally, the querying apparatus further comprises: a second determining module, configured to, after querying the ciphertext database to obtain the ciphertext result matching the ciphertext keywords, determine the number of repeated words between the ciphertext string and the ciphertext result; a third determining module, configured to determine the number of ciphertexts of all words in the ciphertext result; and a fourth determining module, configured to determine the similarity of the ciphertext result based on the number of repeated words and the number of ciphertexts.

[0102] Optionally, the query device further comprises: a first decryption module, configured to, after querying the preset ciphertext database based on the key matrix and the decomposition strategy corresponding to the query requirement, decrypt all the ciphertext results by using the key matrix to obtain plaintext results corresponding to the ciphertext results; a first sorting module, configured to sort the similarity of the ciphertext results to obtain a sorting result; and a first returning module, configured to return the plaintext results corresponding to the ciphertext results with the similarity indication within the preset position range to the target terminal according to the sorting result.

[0103] Optionally, the decryption unit comprises: a first processing module, configured to perform word segmentation processing on the ciphertext results to obtain a third word segmentation vector; a second conversion module, configured to convert each character element in the third word segmentation vector into a digital element based on a preset conversion table to obtain a third digital vector; a third generation module, configured to perform a modulo operation on the product of the third digital vector and the inverse matrix of the key matrix and M to generate a fourth digital vector; a third conversion module, configured to convert each digital element in the fourth digital vector into a character element based on the preset conversion table to obtain a fourth word segmentation vector; and a fourth generation module, configured to generate the plaintext results based on the fourth word segmentation vector.

[0104] Optionally, the query device further comprises: a second construction module, configured to construct an initial query model, wherein the initial query model comprises an initial weight parameter and an initial bias parameter; a first acquisition module, configured to acquire query strings in a historical time period to obtain training data; a first adjustment module, configured to adjust the initial weight parameter and the initial bias parameter by using the training data until the similarity between the plaintext results output by the initial query model and the input query strings exceeds a preset similarity threshold to obtain a target weight parameter and a target bias parameter; and a first update module, configured to update the initial query model based on the target weight parameter and the target bias parameter to obtain a preset query model.

[0105] The query device described above can further comprise a processor and a memory, and the above-mentioned receiving unit 50, generation unit 51, query unit 52, decryption unit 53, etc. are all stored in the memory as program units, and the corresponding functions are realized by the processor executing the above-mentioned program units stored in the memory.

[0106] The above-mentioned processor comprises a core, and the core retrieves the corresponding program units from the memory. The core can be set to one or more, and the highest similarity indication ciphertext result is decrypted by using the key matrix by adjusting the core parameters to obtain the plaintext result, and the plaintext result is returned to the target terminal.

[0107] The above-mentioned memory can include a non-permanent memory in a computer readable medium, a random access memory (RAM) and / or a non-volatile memory such as a read-only memory (ROM) or a flash memory (flash RAM), and the memory includes at least one memory chip.

[0108] The application further provides a computer program product adapted to execute the program of the following method steps when executed on a data processing device: receiving an information query request initiated by a target terminal, generating a key matrix based on a plaintext string and a preset transformation table, querying a preset ciphertext database based on the key matrix and a decomposition strategy corresponding to the query requirement to obtain a query result, decrypting a ciphertext result with the highest similarity indication using the key matrix to obtain a plaintext result, and returning the plaintext result to the target terminal.

[0109] According to another aspect of the embodiments of the present application, a computer readable storage medium is further provided, which includes a stored computer program, wherein the computer readable storage medium controls a device where the computer readable storage medium is located to execute the above-mentioned query method of encrypted information when the computer program is executed.

[0110] According to another aspect of the embodiments of the present application, an electronic device is further provided, which includes one or more processors and a memory, and the memory is used to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the above-mentioned query method of encrypted information.

[0111] Figure 6 is a hardware structure block diagram of an electronic device (or a mobile device) for a query method of encrypted information according to an embodiment of the present application. As shown in Figure 6 , the electronic device can include one or more (as shown in Figure 6 602a, 602b, …, 602n) processors 602 (the processor 602 can include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 604 for storing data. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. Those skilled in the art can understand that the structure shown in Figure 6 is only a schematic, which does not limit the structure of the above-mentioned electronic device. For example, the electronic device can include more or less components than those shown in Figure 6 , or have a different configuration from Figure 6 .

[0112] The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0113] In the above-described embodiments of the present application, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0114] In several embodiments provided in the present application, it should be understood that the disclosed technical contents can be implemented by other ways. Among them, the above-described device embodiments are only schematic, for example, the division of the units can be a logical function division, and actual implementation can have another division way, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or modules shown or discussed can be indirect coupling or communication connection through some interfaces, units or modules, which can be electrical or other forms.

[0115] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed to multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0116] In addition, each functional unit in each embodiment of the present application can be integrated in a processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0117] When the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and various program codes that can be stored in the medium.

[0118] The above merely describes the preferred embodiments of the present application, and it should be pointed out that, for those skilled in the art, several improvements and refinements can be made without departing from the principles of the present application, and these improvements and refinements should also be considered as falling within the protection scope of the present application.

Claims

1. A method for querying encrypted information, characterized in that, The query method is applied to a preset query model, which connects the query application to a preset encrypted database. The preset query model includes: Receive an information query request initiated by a target terminal, wherein the information query request includes at least: a plaintext string and a query requirement; A key matrix is ​​generated based on the plaintext string and a preset transformation table, wherein the preset transformation table is used to represent the correspondence between characters and numbers; wherein the preset transformation table is a randomized table. Based on the key matrix and the decomposition strategy corresponding to the query requirement, the preset ciphertext database is queried to obtain query results, wherein the query results include: L ciphertext results, where L is a positive integer greater than or equal to 1, and the ciphertext results correspond to similarity. The ciphertext result indicating the highest similarity is decrypted using the key matrix to obtain the plaintext result, and the plaintext result is returned to the target terminal; The plaintext string includes multiple substrings. The step of generating a key matrix based on the plaintext string and a preset transformation table includes: Based on the first character of each substring, the plaintext string is divided into M sets of substrings, where M is a positive integer greater than or equal to 1; Determine the number of substrings in each set of substrings, and if the number of substrings is less than M, supplement with random numbers until the sum of the number of substrings and the number of random numbers equals M; Based on all the supplemented substring sets, a preset matrix is ​​constructed, wherein the preset matrix is ​​an M*M matrix; Based on the preset transformation table, each substring in the preset matrix is ​​converted into a number to obtain the key matrix.

2. The query method according to claim 1, characterized in that, Before receiving the information query request sent by the target terminal, it also includes: The query application receives an input request from the target terminal, wherein the input request carries the plaintext string; Upon receiving the input request, the query application initiates a query request selection request to the target terminal, wherein the target terminal responds to the query request selection request and returns the query request. The query application generates the information query request based on the plaintext string and the query requirement, and sends the information query request to the preset query model.

3. The query method according to claim 1, characterized in that, The steps for querying the preset encrypted database based on the key matrix and the decomposition strategy corresponding to the query requirement include: The plaintext string is encrypted using the key matrix to generate a ciphertext string; Using a decomposition strategy corresponding to the query requirement, the ciphertext string is decomposed into N ciphertext keywords, where N is a positive integer greater than or equal to 1; The ciphertext results that match the ciphertext keywords are queried in the preset ciphertext database.

4. The query method according to claim 3, characterized in that, The step of encrypting the plaintext string using the key matrix to generate the ciphertext string includes: The plaintext string is segmented to obtain the first segmentation vector; Based on the preset transformation table, each character element in the first word segmentation vector is converted into a number element to obtain the first number vector. The second digital vector is generated by taking the remainder of the product of the first digital vector and the key matrix with M. Based on the preset transformation table, each numeric element in the second numeric vector is converted into a character element to obtain the second word segmentation vector; The ciphertext string is generated based on the second word segmentation vector.

5. The query method according to claim 3, characterized in that, The step of decomposing the ciphertext string into N ciphertext keywords using a decomposition strategy corresponding to the query requirement includes: If the query requirement is to retain the original content, the decomposition strategy corresponding to the requirement of retaining the original content is adopted to decompose the ciphertext string into N ciphertext keywords; or... When the query requirement is to filter the original content, the decomposition strategy corresponding to the original content filtering requirement is used to filter the preset words in the ciphertext string to obtain the target ciphertext string, and the target ciphertext string is decomposed into N ciphertext keywords.

6. The query method according to claim 3, characterized in that, After querying the preset ciphertext database for ciphertext results that match the ciphertext keyword, the process further includes: Determine the number of repetitions of repeated words between the ciphertext string and the ciphertext result; Determine the ciphertext count of all words in the ciphertext result; The similarity of the ciphertext results is determined based on the number of repetitions and the number of ciphertexts.

7. The query method according to claim 1, characterized in that, After querying the preset ciphertext database based on the key matrix and the decomposition strategy corresponding to the query requirement, the process further includes: The key matrix is ​​used to decrypt all the ciphertext results to obtain the plaintext results corresponding to the ciphertext results. The similarity scores of the encrypted results are sorted to obtain a sorting result; Based on the sorting results, the plaintext results corresponding to the ciphertext results of the similarity indicators located within the preset position range are returned to the target terminal.

8. The query method according to claim 1, characterized in that, The step of decrypting the ciphertext result indicating the highest similarity using the key matrix to obtain the plaintext result includes: The encrypted result is segmented to obtain a third segmentation vector; Based on the preset transformation table, each character element in the third word segmentation vector is converted into a number element to obtain the third number vector; The fourth digital vector is generated by taking the remainder of the product of the third digital vector and the inverse of the key matrix with M. Based on the preset transformation table, each numeric element in the fourth numeric vector is converted into a character element to obtain the fourth word segmentation vector; The plaintext result is generated based on the fourth word segmentation vector.

9. The query method according to claim 1, characterized in that, The query method also includes: Construct an initial query model, wherein the initial query model includes: initial weight parameters and initial bias parameters; Collect query strings within historical time periods to obtain training data; The initial weight parameters and the initial bias parameters are adjusted using training data until the similarity between the plaintext result output by the initial query model and the input query string exceeds a preset similarity threshold, thereby obtaining the target weight parameters and the target bias parameters. Based on the target weight parameters and the target bias parameters, the initial query model is updated to obtain the preset query model.

10. A device for querying encrypted information, characterized in that, The query device is applied to a preset query model, which connects the query application to a preset encrypted database. The preset query model includes: The receiving unit is used to receive an information query request initiated by the target terminal, wherein the information query request includes at least: a plaintext string and a query requirement; A generation unit is used to generate a key matrix based on the plaintext string and a preset transformation table, wherein the preset transformation table is used to represent the correspondence between characters and numbers; wherein the preset transformation table is a randomized table. The query unit is used to query the preset ciphertext database based on the key matrix and the decomposition strategy corresponding to the query requirement, and obtain query results, wherein the query results include: L ciphertext results, where L is a positive integer greater than or equal to 1, and the ciphertext results correspond to similarity. The decryption unit is used to decrypt the ciphertext result indicating the highest similarity using the key matrix to obtain the plaintext result, and return the plaintext result to the target terminal; The plaintext string includes multiple substrings. The generation unit includes: a first partitioning module, used to divide the plaintext string into M sets of substrings based on the first character of each substring, where M is a positive integer greater than or equal to 1; a first determining module, used to determine the number of substrings in each set of substrings, and if the number of substrings is less than M, to supplement with random numbers until the sum of the number of substrings and the number of random numbers equals M; a first construction module, used to construct a preset matrix based on all the supplemented substring sets, where the preset matrix is ​​an M*M matrix; and a first transformation module, used to convert each substring in the preset matrix into a number based on a preset transformation table to obtain a key matrix.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device containing the computer-readable storage medium to perform the encrypted information query method according to any one of claims 1 to 9.

12. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the method for querying encrypted information as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Data query method and system, electronic device and storage medium

    CN110347723A

  • Signature-based matrix dual encryption method

    CN111130755A

  • Ciphertext JPEG image retrieval method and application

    CN112417190A