Text encryption method and text decryption method

By using the additive homomorphic encryption algorithm in the file search system to encrypt and decrypt ciphertext data, generate and update trap gate data, the problem of poor flexibility in ciphertext data update in the existing technology is solved, and the ciphertext data is realized Flexible and secure updates, supporting multi-keyword link search and sortable search results.

CN118740379BActive Publication Date: 2024-11-12E SURFING VISION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411225373.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2024-11-12
Estimated Expiration
2044-09-03

AI Technical Summary

Technical Problem

Existing symmetric searchable encryption (SSE) schemes are poor in flexibility in ciphertext data update operations such as addition or deletion, and cannot support flexible and secure updates to ciphertext data.

Method used

By encrypting and decrypting keywords using additive homomorphic encryption algorithms in the file search system between the client and the server, generating and updating trapped data, flexible updates of ciphertext data are achieved. The specific steps include generating the first bitmap bit string and the second bitmap bit string, performing encryption operations based on the file information and key submitted by the user, generating data update requests, and storing and searching ciphertext data on the server side.

Benefits of technology

It realizes flexible and secure update operations for ciphertext data, supports multi-keyword connection search and sortable search results, improves the dynamic update capability of ciphertext data, and meets the needs of ciphertext data search in actual conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740379B_ABST
    Figure CN118740379B_ABST
Patent Text Reader

Abstract

The present application relates to a text encryption method and a text decryption method. The text encryption method is applicable to the client side. The method generates a first bitmap string of each keyword contained in the file information based on the file information submitted by the user, and the first bitmap string describes the inclusion relationship between the keyword and each file in the form of an inverted index; obtains a pre-stored master key, and calculates the keyword key of each keyword based on the master key; randomly generates new trapdoor data for each keyword under the latest update number; based on the keyword key and the new trapdoor data, performs an additive homomorphic encryption operation on the first bitmap string of each keyword to obtain the first bitmap ciphertext, and generates a first decryption key; based on the keyword key, the new trapdoor data and the first bitmap ciphertext, generates a data update request, and sends it to the server, which solves the problem that the update operation of the ciphertext data is not supported in the prior art, and realizes flexible and secure update of the ciphertext data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of secret state computing and search technology, and in particular to a text encryption method and a text decryption method. Background Art

[0002] The increasing popularity of cloud computing has brought convenient and inexpensive cloud storage services to individuals and companies. As users of this service, individuals or companies can upload data to the cloud and then conveniently search and access it through a client or browser. In order to protect the security and privacy of data, users usually want to encrypt the data before uploading, but this brings great difficulties to the search and use of data. Once the data is encrypted, users cannot retrieve files stored in the cloud by specific keywords or content. To address the above obstacles, Song et al. introduced symmetric searchable encryption (SSE), which enables searches on ciphertext data, which is particularly suitable for scenarios where users search for their own ciphertext data.

[0003] However, existing SSE solutions basically consider static environments, that is, they do not support update operations of ciphertext data (addition or deletion of ciphertext) and have poor flexibility. Summary of the invention

[0004] In this embodiment, a text encryption method and a text decryption method are provided to solve the problem of poor flexibility in ciphertext update in the related art.

[0005] In a first aspect, a text encryption method is provided in this embodiment, which is applied to a file search system, wherein the system includes a client and a server; the method is applicable to the client side, and the method includes:

[0006] Based on the file information submitted by the user, generate a first bitmap bit string of each keyword contained in the file information, wherein the first bitmap bit string describes the inclusion relationship between the keyword and each file in the form of an inverted index;

[0007] Obtain a pre-stored master key, and calculate a keyword key of each keyword based on the master key; randomly generate new trapdoor data for each keyword under the latest update number;

[0008] Based on the keyword key and the new trapdoor data, perform an additive homomorphic encryption operation on the first bitmap bit string of each keyword to obtain a first bitmap ciphertext, and generate a first decryption key;

[0009] A data update request is generated based on the keyword key, the new trapdoor data and the first bitmap ciphertext, and the data update request is sent to a server.

[0010] In some embodiments, based on the keyword key and the new trapdoor data, the first bitmap bit string of each keyword is encrypted using an additive homomorphic encryption algorithm to obtain the first bitmap ciphertext, and a first decryption key is generated, including:

[0011] Based on the keyword key and the value of the latest update number, calculate a new first encryption key under the latest update number;

[0012] Based on the new first encryption key, encrypt the first bitmap bit string using an additive homomorphic encryption algorithm to obtain a first bitmap ciphertext;

[0013] An old first decryption key at the last update number is obtained, and a first decryption key at the latest update number is generated based on the new first encryption key and the old first decryption key.

[0014] In some embodiments, generating a data update request based on the keyword key, the new trapdoor data and the first bitmap ciphertext includes:

[0015] Get the old trapdoor data under the previous update number stored in advance;

[0016] Based on the keyword key, the new trapdoor data and the old trapdoor data, calculating the association relationship between the new trapdoor data and the old trapdoor data to generate new and old trapdoor association data;

[0017] A data update request is generated based on the keyword key, the new trapdoor data, the first bitmap ciphertext, and the new and old trapdoor association data.

[0018] In some of these embodiments, the data update request further includes: a second bitmap ciphertext;

[0019] The second bitmap ciphertext is generated in the following manner:

[0020] Based on the file information submitted by the user, generating a second bitmap bit string of each keyword contained in the file information, wherein the second bitmap bit string describes the relevance between the keyword and each file in the form of an inverted index;

[0021] The second bitmap bit string of each of the keywords is encrypted based on the keyword key and the new trapdoor data to obtain a second bitmap ciphertext.

[0022] In some embodiments, the method further comprises:

[0023] When the user submits a target keyword set, the master key and the new trapdoor data are obtained;

[0024] For each target keyword in the target keyword set, the keyword key of each target keyword is calculated based on the master key; based on the keyword key and the new trapdoor data, a multi-keyword joint search request is generated;

[0025] The multi-keyword joint search request is sent to a server.

[0026] In a second aspect, this embodiment provides a text encryption method, which is applied to a file search system, wherein the system includes a client and a server; the method is applicable to the server side, and the method includes:

[0027] receiving a data update request, and extracting a keyword key, new trapdoor data, and a first bitmap ciphertext of each keyword from the data update request;

[0028] For each keyword in the update request, based on the keyword key and the new trapdoor data, a new index under the latest update times is calculated; the first bitmap ciphertext is encrypted to obtain new ciphertext data;

[0029] Each of the new indexes and the corresponding new ciphertext data are associated and stored in a data table of the cipher database.

[0030] In some embodiments, encrypting the first bitmap ciphertext to obtain new ciphertext data includes:

[0031] The data update request also includes new and old trapdoor association data;

[0032] Based on the old and new trapdoor association data and the keyword key, the old trapdoor data under the last update number is restored; based on the old trapdoor data, an old index of the keyword is generated, and based on the old index, the corresponding old ciphertext data is searched in the pre-stored secret database;

[0033] Based on the old ciphertext data found, an additive homomorphic encryption operation is performed on the first bitmap ciphertext to obtain new ciphertext data with the latest update times.

[0034] In some embodiments, the method further comprises:

[0035] Receive multi-keyword connection search requests sent by clients;

[0036] Extracting the keyword key and the new trapdoor data of each target keyword from the multi-keyword joint search request; searching the corresponding new ciphertext data in the cipher database based on the keyword key and the new trapdoor data;

[0037] Performing an additive homomorphic encryption operation on the new ciphertext data found to obtain a first ciphertext search result;

[0038] The first confidential search result is returned to the search client.

[0039] In some embodiments, the method further comprises:

[0040] The received data update request also includes a second bitmap ciphertext; the corresponding new score data is calculated based on the second bitmap ciphertext; the new index of each keyword and the corresponding new score data are associated and stored in a data table of the encrypted database;

[0041] After receiving the multi-keyword joint search request, searching the corresponding new scoring data in the secret database based on the keyword key and the new trapdoor data; performing an additive homomorphic encryption operation on the found new scoring data to obtain a second secret search result,

[0042] The second confidential search result is returned to the search client.

[0043] In a third aspect, this embodiment provides a text decryption method, which is applied to a file search system, wherein the system includes a client and a server; the method is applicable to the client side, and the method includes:

[0044] Receiving a first secret search result obtained by the server based on a multi-keyword joint search request; obtaining a pre-stored first decryption key;

[0045] Based on the first decryption key, perform a decryption operation corresponding to the additive homomorphic encryption operation on the first secret state search result to obtain a first plaintext bit string;

[0046] The first plaintext bit string is parsed to obtain a file related to the multi-keyword joint search request.

[0047] Compared with the related art, the text encryption method and the text decryption method provided in this embodiment are applied to a file search system, which includes a client and a server; on the client side, the method generates a first bitmap bit string of each keyword contained in the file information based on the file information submitted by the user, and the first bitmap bit string describes the inclusion relationship between the keyword and each file in the form of an inverted index; obtains a pre-stored master key, and calculates the keyword key of each keyword based on the master key; randomly generates new trapdoor data for each keyword under the latest update number; based on the keyword key and the new trapdoor data, performs an additive homomorphic encryption operation on the first bitmap bit string of each keyword to obtain a first bitmap ciphertext, and generates a first decryption key; based on the keyword key, the new trapdoor data and the first bitmap ciphertext, generates a data update request, and sends the data update request to the server, which solves the problem that the prior art does not support the update operation of ciphertext data, and realizes flexible and secure update of ciphertext data.

[0048] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0050] Figure 1 A hardware structure block diagram of a terminal of a text encryption / text decryption method in one embodiment;

[0051] Figure 2 A schematic diagram of the structure of a file search system in one embodiment;

[0052] Figure 3 A schematic diagram of a flow chart of a text encryption method applicable to a client side in one embodiment;

[0053] Figure 4 A schematic diagram of a flow chart of a text encryption method applicable to a server side in one embodiment;

[0054] Figure 5 A schematic diagram of a flow chart of a text decryption method applicable to a client side in one embodiment;

[0055] Figure 6 It is a structural block diagram of a text encryption device applicable to the client side in one embodiment;

[0056] Figure 7It is a structural block diagram of a text encryption device applicable to a server side in one embodiment;

[0057] Figure 8 The present invention is a structural block diagram of a text decryption device applicable to the client side in one embodiment.

[0058] Figure numerals: 102, processor; 104, memory; 106, transmission device; 108, input and output device; 21, client; 22, server; 61, file information processing module; 62, security data calculation module; 63, client encryption module; 64, update request sending module; 71, request receiving module; 72, server encryption module; 73, ciphertext storage module; 81, ciphertext search result receiving module; 82, decryption module; 83, parsing module. DETAILED DESCRIPTION

[0059] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.

[0060] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with general skills in the technical field to which this application belongs. The words "one", "a", "the", "these" and the like in this application do not indicate a quantitative limitation, and they may be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone. Generally, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0061] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1: is a hardware structure block diagram of a terminal of the text encryption / text decryption method of this embodiment. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 and a memory 104 for storing data, wherein the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0062] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the text encryption / text decryption method in the present embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0063] The transmission device 106 is used to receive or send data via a network. The above network includes a wireless network provided by the communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0064] In this embodiment, a text encryption method is provided, which is applied to a file search system, such as Figure 2 As shown, the system includes a client 21 and a server 22; the method is applicable to the client 21 side. Figure 3 is a flowchart of the text encryption method of this embodiment, such as Figure 3 As shown, the process includes the following steps:

[0065] Step S310, based on the file information submitted by the user, generate the first bit string of each keyword contained in the file information, the first bit string of the first image describing the inclusion relationship between the keyword and each file in the form of an inverted index.

[0066] Specifically, the file information includes the identification information of the file and the keyword list of the file. The keyword list records the keywords contained in the main content of the file, and the keywords are specified by the user. In order to support the joint query of multiple keywords, an extended bitmap representation is used to represent the association between files and keywords. The idea of ​​the extended bitmap representation is described below: Now assume that the server 22 expects to support the maximum storage l files, use a A long string of bits representing a file. Now initialize bs For a length of al If the all-0 bit string is set i indivual a If the last bit of the long bit string is 1, it means that the file f i Existing in the server 22. In this embodiment, the bit length of the extended bitmap is set a =4, the number of files that the server 22 expects to support storage l =256, extract in={ f , w} in the file identifier f and keyword list w , for each keyword in the list w ∈ w , calculate the corresponding first bit string according to the operator (addition or deletion) in the plaintext of op bs Assume that there are 6 plaintext files, containing the keywords {keyword 1, keyword 2, keyword 3}, and the keyword inverted index table of these 6 files is shown in Table 1.

[0067] Table 1:

[0068]

[0069] If the last bit of the 4-bit binary string in Table 1 is 1, it means that the file contains the corresponding keyword, such as file 1, file 2, file 4 and file 5 all contain keyword 1. The first bit of keyword 1 is bs is [0001 0001 00000001 0001 0000 ...], where the ellipsis part is all 0. bs The full length of the sequence is al =256×4=1024 bits.

[0070] Furthermore, the file information also includes the score of each keyword, and the scoring mechanism can flexibly score according to word frequency, relevance, etc. The second bitmap bit string of each keyword is calculated based on the score in the file information ss . Through bs and ss Encrypted storage together can provide sortable search results when searching.

[0071] Step S320, obtaining a pre-stored master key, calculating a keyword key of each keyword based on the master key; and randomly generating new trapdoor data for each keyword under the latest update times.

[0072] Specifically, during the system initialization phase, the client 21 randomly generates a master key K , and saved in the client 21. Further, during the initialization phase, a security parameter λ is input, and a master key is randomly generated based on the security parameter K , and using a secure pseudo-random function F Calculate the keyword key. The client 21 also pre-stores a trapdoor table for storing the number of times the keyword is updated. c New Trapdoor Data T c When randomly generating new trapdoor data T c+1 After that, the new trapdoor data can be T c+1 Saved in trapdoor table.

[0073] Step S330, based on the keyword key and the new trapdoor data, perform an additive homomorphic encryption operation on the first bitmap bit string of each keyword to obtain the first bitmap ciphertext and generate a first decryption key.

[0074] Specifically, the additive homomorphic encryption operation allows the user to directly perform specific algebraic operations on the ciphertext, and the result obtained is the same as the result obtained by performing certain encryption operations on the plaintext. In order to encrypt the extended bitmap representation, the following modular addition homomorphic encryption algorithm HomAdd={Init,Enc,Dec,Add} can be used:

[0075] (1) Initialization algorithm Init generates a modulus based on security parameters n ;

[0076] (2) Encryption algorithm Enc m , sk , n ): Plaintext encoded as an integer m , where 0≤ m < n , key sk Also satisfies the value 0≤ sk < n, output ciphertext c =( m + sk ) mod n ;

[0077] (3) Decryption algorithm Dec ( c , sk , n ): Input ciphertext c and key sk , output plain text c =( c - sk ) mod n ;

[0078] (4) Homomorphic addition operation Add c 1, c 2, n ): for the ciphertext c 1 and c 2, where c 1=(m1+ sk 1) mod n , c 2=( m 2+ sk 2) mod n ,definition c =( c 1+ c 2) mod n It is easy to see c It happens to be plain text m 1 and m 2's ciphertext is just the corresponding encryption key sk for( sk 1+ sk 2) mod n .

[0079] In this embodiment, the first bit string is encrypted using the encryption algorithm Enc in the modular homomorphic encryption algorithm. bs , get the first ciphertext e c+1 =Enc( bs , sk c+1 , n 1) Encrypt the first and second bitmap bit strings ss , get the second bitmap ciphertext es c+1 =Enc( ss , ssk c+1 , n 2) Among them, sk c+1 ,ssk c+1 is the key, modulus n 1 and modulus n 2 According to the formula n 1=2 al , n 2=2 dl Calculate, where a To extend the bit length of the bitmap representation, d is the bit length of the score, l The number of files that the server 22 is expected to support storage.

[0080] Step S340 , generating a data update request based on the keyword key, the new trapdoor data and the first bitmap ciphertext, and sending the data update request to the server 22 .

[0081] Specifically, a set of keyword keys, new trapdoor data, and first bitmap ciphertext constitute the update data of a keyword, and a data update request is generated based on the set of all keyword update data. The update data of each keyword can be updated separately, that is, if the file information provided by the user only involves the update of keyword 1, and the other keywords are not affected, then only the update data of keyword 1 can be calculated, and a data update request involving only keyword 1 can be sent, thereby improving the flexibility of data update.

[0082] In this embodiment, based on the file information submitted by the user, a first bitmap bit string of each keyword contained in the file information is generated, and the first bitmap bit string describes the inclusion relationship between the keyword and each file in the form of an inverted index; a pre-stored master key is obtained, and a keyword key of each keyword is calculated based on the master key; new trapdoor data for each keyword under the latest update number is randomly generated; based on the keyword key and the new trapdoor data, an additive homomorphic encryption operation is performed on the first bitmap bit string of each keyword to obtain the first bitmap ciphertext, and a first decryption key is generated; based on the keyword key, the new trapdoor data and the first bitmap ciphertext, a data update request is generated, and the data update request is sent to the server 22, which solves the problem that the update operation of the ciphertext data is not supported in the prior art, and realizes flexible and secure updating of the ciphertext data.

[0083] In some of the embodiments, based on the keyword key and the new trapdoor data, the first bitmap bit string of each keyword is encrypted using an additive homomorphic encryption algorithm to obtain the first bitmap ciphertext, and a first decryption key is generated, including:

[0084] Step S331, based on the keyword key and the value of the latest update number, calculate the new first encryption key under the latest update number.

[0085] Step S332: Based on the new first encryption key, the first bitmap bit string is encrypted using an additive homomorphic encryption algorithm to obtain the first bitmap ciphertext.

[0086] Step S333: Obtain the old first decryption key at the last update number, and generate the first decryption key at the latest update number based on the new first encryption key and the old first decryption key.

[0087] Specifically, using a secure pseudo-random function F The calculated keyword key includes the first subkey K w and the second subkey K ' w : K w || K ' w ← F ( K , w ). Use the hash function to hash the second subkey K ' w and the value of the most recent update count c +1 to obtain the new first encryption key of the first bit string sk c+1 At this time, the first decryption key is generated according to the method for encrypting and storing the first bitmap ciphertext set in the server 22. Preferably, the first encryption key obtained by each update is sk The sum is used as the first decryption key. Specifically, the first key and table of the client 21 are Sum Each keyword saved in w The first decryption key at each update number, when the latest update number comes c +1, the new first encryption key sk c+1 Add it to the saved first decryption key to obtain the first decryption key with the latest update number.

[0088] Furthermore, when the client 21 also generates a second bitmap bit string ss Based on the same principle, the second bitmap bit string is encrypted ss , and generate the corresponding first decryption key. Specifically, the second subkey is calculated using a hash function (different from that used to calculate the first encryption key). K ' w and the value of the most recent update count c +1 to obtain the new first encryption key of the second bitmap bit string ssk c+1At this time, the second decryption key is generated according to the method for encrypting and storing the second bitmap ciphertext set in the server 22. Preferably, the first encryption key obtained by each update is ssk The sum is used as the first decryption key. Specifically, the first key and table of the client 21 are SSum Each keyword saved in w The second decryption key at each update number, when the latest update number reaches c +1, the new second encryption key sk c+1 Add it to the saved second decryption key to obtain the second decryption key with the latest update number.

[0089] In some embodiments, generating a data update request based on the keyword key, the new trapdoor data and the first bitmap ciphertext includes:

[0090] Step S341, obtaining the pre-stored old trapdoor data of the last update number.

[0091] Step S342, based on the keyword key, the new trapdoor data and the old trapdoor data, calculate the association relationship between the new trapdoor data and the old trapdoor data, and generate new and old trapdoor association data.

[0092] Step S343: Generate a data update request based on the keyword key, the new trapdoor data, the first bitmap ciphertext, and the new and old trapdoor association data.

[0093] In this embodiment, the new and old trapdoor association data are added to the data update request so that the server 22 can quickly find the data under the last update number through the data and associate the data under the two updates.

[0094] In some of the embodiments, the data update request further includes: a second bitmap ciphertext.

[0095] The second bitmap ciphertext generation method includes:

[0096] Step S350: Based on the file information submitted by the user, a second bitmap bit string of each keyword contained in the file information is generated, and the second bitmap bit string describes the relevance between the keyword and each file in the form of an inverted index.

[0097] Step S360: encrypt the second bitmap bit string of each keyword based on the keyword key and the new trapdoor data to obtain a second bitmap ciphertext.

[0098] In this embodiment, the second bitmap bit string includes information on the degree of relevance between the keyword and the file, and increases the description dimension of the corresponding relationship between the keyword and the file.

[0099] In some of these embodiments, the method further comprises:

[0100] Step S370: When the user submits the target keyword set, the master key and new trapdoor data are obtained.

[0101] Step S380: for each target keyword in the target keyword set, a keyword key of each target keyword is calculated based on the master key; based on the keyword key and the new trapdoor data, a multi-keyword joint search request is generated.

[0102] Step S390 , sending the multi-keyword joint search request to the server 22 .

[0103] Specifically, the master key and the new trapdoor data are stored in the client 21, wherein the new trapdoor data is the trapdoor data under the latest update times of each target keyword. Furthermore, a weight value is generated for each target keyword, and the weight value is added to the multi-keyword connection search request. The weight value is used to assign weights to the scores when the server 22 searches, thereby satisfying the priority preference for keywords during actual searches, so that the final search results are sorted more in line with actual scenario requirements. Specifically, the weight value can be set by the user according to the target keywords provided, or it can be automatically set to a fixed value according to the order in which the target keywords are provided. When set to a fixed value in order, the weight value may not be added to the multi-keyword connection search request, but the corresponding fixed value may be saved in order in the server 22.

[0104] In this embodiment, the target keyword to be queried is hidden by using the keyword key and the new trapdoor data, thereby improving the security of the query.

[0105] In this embodiment, a text encryption method is also provided, which is applied to Figure 2 The file search system shown in the figure includes a client 21 and a server 22. The method is applicable to the server 22 side. Figure 4 is a flowchart of the text encryption method of this embodiment, such as Figure 4 As shown, the process includes the following steps:

[0106] Step S410, receiving a data update request, and extracting a keyword key, new trapdoor data and a first bitmap ciphertext of each keyword from the data update request.

[0107] Step S420, for each keyword in the update request, based on the keyword key and the new trapdoor data, calculate the new index under the latest update times; encrypt the first bitmap ciphertext to obtain new ciphertext data.

[0108] Step S430: associate each new index with the corresponding new ciphertext data and store them in a data table of the cipher database.

[0109] Specifically, the secret database in the server 22 includes a ciphertext table and a trapdoor table, wherein the ciphertext table is used to store new ciphertext data, and the trapdoor table is used to store new trapdoor data. Further, the secret database also includes a score table, which is used to store new score data encrypted by the second bitmap ciphertext when the second bitmap ciphertext is received.

[0110] In this embodiment, by parsing and calculating the received data update request, a new index of each keyword and the corresponding new ciphertext data are generated to be stored in the server 22, so as to achieve a flexible update of the file-keyword with high security.

[0111] In this embodiment, it is also provided that the first bitmap ciphertext is encrypted to obtain new ciphertext data, including:

[0112] Step S421: The data update request also includes new and old trapdoor association data.

[0113] Step S422, based on the new and old trapdoor association data and the keyword key, restore the old trapdoor data under the previous update times; generate the old index of the keyword based on the old trapdoor data, and based on the old index, search for the corresponding old ciphertext data in the pre-stored secret database.

[0114] Step S423: Based on the old ciphertext data found, perform an additive homomorphic encryption operation on the first bit graph ciphertext to obtain new ciphertext data with the latest update times.

[0115] Specifically, the homomorphic addition operation Add in the modular homomorphic encryption algorithm is used to calculate new ciphertext data based on old ciphertext data, thereby improving the security of ciphertext storage.

[0116] In this embodiment, the method further comprises:

[0117] Step S440 , receiving a multi-keyword connection search request sent by the client 21 .

[0118] Step S450, extracting the keyword key and new trapdoor data of each target keyword from the multi-keyword joint search request; searching for the corresponding new ciphertext data in the cipher database based on the keyword key and the new trapdoor data.

[0119] Specifically, the extracted new trapdoor data is compared with the new trapdoor data stored in the secret database of the server 22. If the two are the same, there is no abnormality, and the subsequent step S460 is continued; if the two are not the same, it means that there is an abnormality (such as an injection attack), and the first secret search result is directly generated based on the random filling method to ensure forward security. In addition, for files that are added and then deleted between two searches, the server 22 will not access the deleted files, achieving backward security.

[0120] Step S460, performing an additive homomorphic encryption operation on the found new ciphertext data to obtain a first encrypted search result.

[0121] Step S470: Return the first secret search result to the search client 21.

[0122] In this embodiment, a search capability that supports multi-keyword joint search is implemented.

[0123] In this embodiment, the method further comprises:

[0124] Step S480: The received data update request also includes a second bitmap ciphertext; the corresponding new score data is calculated based on the second bitmap ciphertext; and the new index of each keyword and the corresponding new score data are associated and stored in a data table of the encrypted database.

[0125] Step S490, after receiving the multi-keyword connection search request, search for the corresponding new scoring data in the secret database based on the keyword key and the new trapdoor data; perform additive homomorphic encryption operation on the found new scoring data to obtain a second secret search result, and return the second secret search result to the search client 21.

[0126] In this embodiment, the functions of multi-keyword joint search and sortable search results are supported.

[0127] In this embodiment, a text decryption method is also provided. The method is applied to a file search system. The system includes a client 21 and a server 22. The method is applicable to the client 21 side. Figure 5 is a flowchart of the text decryption method of this embodiment, such as Figure 5 As shown, the process includes the following steps:

[0128] Step S510: receiving the first encrypted search result obtained by the server 22 based on the multi-keyword joint search request; and obtaining a pre-stored first decryption key.

[0129] Step S520: Based on the first decryption key, a decryption operation corresponding to the additive homomorphic encryption operation is performed on the first encrypted search result to obtain a first plaintext bit string.

[0130] Step S530: parse the first plaintext bit string to obtain files related to the multi-keyword joint search request.

[0131] Further, a second secret search result is received, and based on the second scored decryption key, a decryption operation corresponding to the additive homomorphic encryption operation is performed on the second secret search result to obtain a second plaintext bit string.

[0132] Furthermore, if the data returned by the server 22 includes an abnormal flag, the attacker will obtain invalid data because the first secret search result and the second secret search result are random values. If the flag is normal, the client 21 will obtain the correct file flag set that meets the search condition, and then can initiate a further corresponding file viewing or downloading request to the server 22 as required.

[0133] In this embodiment, single keyword and multi-keyword search are supported, search results can be sorted, and dynamic update of ciphertext data is supported, which can better meet the actual needs of ciphertext data search.

[0134] The present embodiment is described and illustrated below through preferred embodiments.

[0135] Before describing the algorithm in detail, the meanings of the parameters represented by the symbols involved in this preferred embodiment are given first, as shown in Tables 2 and 3 below.

[0136] Table 2:

[0137]

[0138] Table 3:

[0139]

[0140] 1. System initialization algorithm.

[0141] Input: Input security parameter λ and parameter a,d,l .

[0142] Output: client 21 secret state parameter σ, cloud server secret state database EDB.

[0143] The algorithm flow is as follows:

[0144] The system consists of a client 21 and a cloud server. The system performs the following initialization operations:

[0145] Step 1: Randomly select a key , λ is a security parameter. The extended bitmap indicates the length a , score bit length d , modulus of the modular homomorphic encryption algorithm n 1=2 al , n 2=2 dl , l The number of files that the cloud server is expected to support storage.

[0146] Step 2: Initialize 7 empty mapping tables M ,S, T , TK ,Sum , SSum , Counter ,in M Used to store the encrypted inverted index table. S Used to save the keyword's relevance score in each file, with an initial value of 0. w The dense rating vector in the inverted index is S [ w ], T is the update count used by client 21 to store keywords c and the latest search trap T c (token), TK It is the latest trap used by cloud servers to store search keywords T c , Sum Used to store n 1 is the key sum of each keyword in the modulus-added homomorphic encryption algorithm after each inverted index update, initialization keyword w The key and Sum [ w ]=0. SSum Used to store n 2 is the key sum of each keyword in the modulus-added homomorphic encryption algorithm after each inverted index update, initialization keyword w The key and SSum [ w ]=0. Counter Used to store corresponding keywords w and in the update c The number of files that exist at the time.

[0147] Step 3: The cloud server's secret database EDB = ( M , S , TK ), the secret state parameter σ of client 21 = ( K , T , Sum , SSum , Counter ).

[0148] 2. System update algorithm.

[0149] Input: Client 21 parameter σ, the set of files and their keyword lists in={ f , w}, operator for adding or deleting op={add,del}.

[0150] Output: Client 21 updates parameter σ, and the cloud server updates the encrypted database EDB.

[0151] The algorithm flow is as follows:

[0152] First, client 21 performs the following operations:

[0153] Step 1: Extract in={ f , w File identification in f and keyword list w , for each keyword in the list w ∈ w , according to the operator (addition or deletion) in op, the corresponding extended bitmap representation bit string is calculated bs , and extract the key in the secret state σ K , using a secure pseudo-random function F Calculate two keys K ' w : K w || K ' w ← F ( K , w ), and from T Extract the current latest token value and update times corresponding to the keyword ( T c , c )← T [ w ], if token is empty, it is represented as ( T c , c )=∅, then let c ←-1, T c ←{0,1}^λ. Counter Record the number of files that existed during this update (i.e. before the update) Counter [ w , c ]=num.

[0154] Step 2: Random generation T c+1 ←{0,1}^λ, and update T [ w ]←( T c+1 , c +1).

[0155] Step 3: Using hash functions H 2. Calculate the connection between the new and old tokens CT c ← H 2(K w , T c+1 )⨁ T c , using hash functions H 3 Calculation bs Encryption key sk c+1 ← H 3( K ' w , c +1), and then encrypted using the additive homomorphic encryption algorithm bs Get the ciphertext e c+1 =Enc( bs , sk c+1 , n 1) and update Sum [ w ]← Sum [ w ]+ sk c+1 .

[0156] Step 4: Using hash functions H 4 Calculation ss Encryption key ssk c+1 ←H4( K ' w , c +1), and then encrypted using the additive homomorphic encryption algorithm ss Get the ciphertext es c+1 =Enc( ss , ssk , n 2) and update SSum [ w ]← SSum [ w ]+ ssk c+1 .

[0157] Step 5: Client 21 sends information (( K w , T c+1 ),(e c+1 , es c+1 ), CT c )) to the cloud server.

[0158] The cloud server receives the message (( K w ,T c+1 ),(e c+1 , es c+1 ), CT c ))After that, perform the following update operations:

[0159] Using hash functions H 1Calculate the index UT c+1 ← H 1( K w , T c+1 ), update the inverted index table, let M [ UT c+1 ]← e c+1 , S [ UT c+1 ]← es c+1 , and then use the connection information CT c Restore Previous T c Value T c ← H 2( K w , T c+1 )⊕ CT c , further reuse T c Restore the previous index UT c ← H 1( K w , T c ) and get the corresponding value e c ← M [ UT c ], es c ← S [ UT c ], update at this time M [ UT c+1 ] is M [ UT c+1 ]←Add( e c+1 ,e c , n 1) and delete M [ UT c ].renew S [ UT c+1 ] is S [ UT c+1 ]←Add( es c+1 , es c ,n2), and delete S [ UT c ] Update keywords w Corresponding trapdoor table TK [ w ]← T c+1 , pay attention to the cloud server TK The index is actually K w ,Right now TK [ K w ], but to simplify the notation we write TK [ w ]. So far, for a keyword w The dense inverted index and dense score of are updated. Use the same method to implement w The inverted index corresponding to all keywords in is updated.

[0160] 3. System search algorithm.

[0161] Input: Client 21 parameter σ, Client 21 multi-keyword join query request q , cloud server encrypted database EDB.

[0162] Output: The client 21 obtains the encrypted search result result returned by the cloud database.

[0163] The algorithm flow is as follows:

[0164] Join query request for multiple keywords q ={ w 1, w 2,..., w t} (compatible with single keyword query, at this time t =1), client 21 performs the following operations:

[0165] For each w i ∈q ,calculate K w || K ' w ← F ( K , w ), and from T Get T c , c )← T [ w ],if( T c , c )=∅, then directly return the search result as ∅. Otherwise, send the set {( K w , T c , c ,α w )} w∈q To the cloud server, where α w is a keyword w The corresponding weight of .

[0166] The cloud server receives the search request {( K w , T c , c , α w )} w∈q Then, do the following:

[0167] make sum =0, ssum =0, execute the following loop:

[0168] “for each ( K w , T c , c , α w ):

[0169] flag=True,error=∅

[0170] T ' c ← TK [ w ]

[0171] if T ' c ≠ T c :

[0172] flag=False, error=( K w , T c , c )

[0173] break # Found an illegal token, stopped the calculation, and ended the for loop

[0174] UT c ← H 1( K w , T ' c ), e c ← M [ UT c ], es c ← S [ UT c ]

[0175] sum ←Add( sum , e c , n 1), ssum ←Add( ssum ,α w es c , n 2)

[0176] end for

[0177] if flag=False:

[0178] Random padding sum =[0:]

[0179] Random padding ssum =[0:]

[0180] return result={ sum , ssum ,flag,error}".

[0181] In the for loop above sum That is, the inverted indexes corresponding to all the keywords in the query request are summed in a dense form. ssumIt is the sum of all the weighted scoring vectors of the keywords in the query request for each file. The cloud server will sum and ssum Sent to client 21. Among them, random padding sum [0:] means to fill the entire sum Value (fill position from 0 to the end), random padding ssum [0:] means to fill the entire ssum The value of (fill position from 0 to the end). flag indicates the status of the result return, which is convenient for the client 21 to judge the correctness of the result.

[0182] 4. Client 21 decryption algorithm.

[0183] Input: Secret search result, two tables of keys and Sum , SSum .

[0184] Output: plaintext bit string bs and ss .

[0185] The algorithm flow is as follows:

[0186] Client 21 receives result={ sum , ssum ,flag,error}, perform the following calculations:

[0187] “let sum sk =0, ssum ssk =0;

[0188] For w ∈ q :

[0189] sum sk ← sum sk + Sum [ w ]

[0190] sum ssk ← sum ssk +α w SSum [ w ]

[0191] end for

[0192] bs ←Dec(sum , sum sk , n 1), ss ←Dec( ssum , ssum sk , n 2),

[0193] If flag==False:

[0194] Find num=min{ Counter [ w , c ]}

[0195] bs ← bs [0: a ∙num], ss ← ss [0: d ∙num]

[0196] return bs , ss ”.

[0197] Calculated bs , ss After checking the value of bs Zhongmei a Is the value of the bit-length binary string | q |, that is, whether it is the number of keywords in the query. If they are equal, it means that the corresponding file meets the condition of containing all the keywords in the query. Then ss Calculate the score of the corresponding file (calculate each d bit length of the binary string), sort the file identifiers according to the score value. Note that when flag is False, the optional range of file identifiers is the smallest value obtained in the illegal search token (that is, num=min{ Counter [ w , c ]}), at this time, the file identifiers obtained by the adversary of the file injection attack will not include the newly injected files, satisfying forward security. In fact, the search results at this time are completely random values, making the file identifiers obtained by the attacker meaningless. When flag is True, the client 21 will obtain the correct set of file identifiers that meet the search conditions, and then can initiate further corresponding file viewing or downloading requests to the cloud server according to needs.

[0198] 5. Examples

[0199] As an example, we now give the specific algorithm parameters, ciphertext data update, ciphertext search, and search result decryption process.

[0200] System initialization algorithm Setup: security parameter λ = 128 bits, that is, the key length is 128 bits. K 0x4b9e8ed c 583d6a38a4 c 49b1435d52832, bit length of extended bitmap representation a =4, bit length of the score d =16, the number of files that the cloud server expects to support storage l =256. Modulus n 1 and n 2 According to the formula n 1=2 al , n 2=2 d Perform calculations.

[0201] System update algorithm execution process: Assume that there are 6 plaintext files, containing the keywords {Cryptography, Privacy, AI}. These 6 files are represented in the form of a keyword inverted index table as shown in the following table:

[0202] Table 4:

[0203]

[0204] If the last bit of the 4-bit binary string in the table is 1, it means that the file contains the corresponding keyword, such as file 1, file 2, file 4 and file 5 all contain the keyword Cryptography.

[0205] The update process of these 6 files is as follows:

[0206] First update: Add file 1, which corresponds to the keyword Cryptography bs The sequence is [0001 ...], where all ellipsis parts are 0. bs The total length of the sequence is 256×4=1024 bits.

[0207] Second update: Add files 2, 3, 4, 5, corresponding to the keyword Cryptography bs The sequence is [00010001 0000 0001 0001 0000 ...].

[0208] Third update: No files were added this time, only the keywords corresponding to Privacy were updated bsThe sequence [0001 00010000 0001 ...].

[0209] Fourth update: Add file 6 and update the corresponding keywords of AI bs The sequence is [0000 0001 0001 00010001 0001 ...].

[0210] Fifth update: This time, file 6 is deleted. Since the deletion only affects keyword AI, its corresponding bs The sequence becomes [0000 0001 0001 0001 0001 0000 ...].

[0211] Scoring table settings: The scores of the keywords contained in these 6 files are set to the following table. The scores of files that do not contain the keywords are 0 (for files that were added and then deleted, such as file 6, the scores of the keywords AI contained in them can be retained, which will not affect the subsequent search results, because the corresponding AI scores after deleting file 6 bs The sequence is set to 0000). The scores of keywords are shown in the following table:

[0212] Table 5:

[0213]

[0214] The cloud server searches based on the token submitted by client 21: The connection keyword currently being searched is q ={Cryptography, Privacy, AI}, that is, search for files containing all three keywords. The search weights of these three words are set to (5, 3, 2), that is, the weight of the keyword Cryptography is dominant.

[0215] The secret search tokens for the three keywords submitted by client 21 are:

[0216] "{[702a2bef6fd2f10c48895fc61fabcbb7,6e49ef425ca806bdd5cd96730d4bb 1bf2ac168a07ae32b8865519a0e6a3ff557,1],[c0a999b1ed7b0ecf7ae03caa2b dd6c1a,73f8a201ec32ffb924aa7396cdd0602122e554def7822fd1ba5814d127e 4f12c,1],[887c9882e97837d80e2c224ce451c9ce,08fe936d119f9f4f1264a17 c 5694 c396b6090 f 34915e68 f 750754866b38aa7 c 8,1]}".

[0217] The confidential query result returned by the cloud server is:

[0218] "A48F04D29ABD58FE826E78B5F73A7350913FDAA19F47B8C4B14B9EEC31C62C0 9817BE4D59ABD58FE826E78B5F73A7350913FDAA19F47B8C4B14B9EEC31C62C09 817BE4D59ABD58FE826E78B5F73A7350913FDAA19F47B8C4B14B9EEC31C62C098 17BE4D59ABD58FE826E78B5F73A7350913FDAA19F47B8C4B14B9EEC31C62C09”.

[0219] Client 21 decrypts the ciphertext returned by the cloud server to obtain the plaintext (for bs Parsed as 4 bits):

[0220] [2, 3, 1, 3, 2, 0 ...].

[0221] The file at the position corresponding to number 3 in this plaintext is the file that contains three keywords at the same time: file 2 and file 4.

[0222] The weighted scoring plaintexts obtained by decryption are ranked as follows:

[0223] [28, 31, 4, 18, 11, 10 ...].

[0224] Therefore, the final results are sorted into file 2 and file 4, and the search ends. From the inverted index table of the text, it can be seen that only file 2 and file 4 contain all three keywords, and the search results are correct.

[0225] This preferred embodiment has the following beneficial effects:

[0226] (1) Support for multi-functional search capabilities: The algorithm supports single-keyword and multi-keyword searches, supports sorting of search results, and supports dynamic updates of ciphertext data, which can better meet the actual needs of ciphertext data searches.

[0227] (2) The algorithm is highly efficient: The underlying design components use symmetric encryption (encryption of the plaintext data file itself), hash algorithm, and modular homomorphic encryption algorithm. These cryptographic primitives are highly efficient and ensure the efficiency of the entire algorithm.

[0228] (3) The algorithm has high security: The algorithm achieves forward security and backward security. Forward security means that when a file selected by an adversary is injected, the previously searched token cannot match the newly added file. In the designed algorithm, the cloud server will check the correctness of the token and find that the file identifier returned when the replayed token is found will not contain the attack injection file selected by the adversary, thus ensuring forward security. In addition, for files that are added and then deleted between two searches, the corresponding file identifier in the ciphertext and is 0, so that the cloud server will not access the deleted files, thus achieving backward security.

[0229] (4) The algorithm has a flexible expansion and scoring mechanism: The designed algorithm has a flexible index change, expansion and scoring mechanism. First, when the ciphertext is dynamically updated, the corresponding bs The value of the sequence is used to change the index. In addition, the current file data volume can be bs The length of the file can be flexibly configured, as long as it is sufficient within a period of time. bs When configuring the length of bs' Start the inverted index from this new file, so that a single bs The length of the query will not be too long and can be flexibly expanded. Finally, the scoring mechanism we provide can flexibly score based on word frequency, relevance, etc., and can set weights based on the search keyword ranking, so as to meet the priority preference for keywords in actual searches, making the final search result ranking closer to the actual scenario.

[0230] It should be noted that the steps shown in the above process or the flowchart in 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.

[0231] In the present embodiment, a text encryption / text decryption device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. The terms "module", "unit", "subunit" and the like used below can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0232] Figure 6 is a structural block diagram of the text encryption device of this embodiment, such as Figure 6 As shown, it is applied to a file search system, the system includes a client 21 and a server 22; the device is applicable to the client 21 side, and the device includes: a file information processing module 61, a security data calculation module 62, a client encryption module 63 and an update request sending module 64.

[0233] The file information processing module 61 is used to generate the first bit string of each keyword contained in the file information based on the file information submitted by the user. The first bit string describes the inclusion relationship between the keyword and each file in the form of an inverted index.

[0234] The security data calculation module 62 is used to obtain a pre-stored master key, calculate a keyword key of each keyword based on the master key, and randomly generate new trapdoor data for each keyword under the latest update times.

[0235] The client encryption module 63 is used to perform an additive homomorphic encryption operation on the first bitmap bit string of each keyword based on the keyword key and the new trapdoor data to obtain the first bitmap ciphertext and generate a first decryption key.

[0236] The update request sending module 64 is used to generate a data update request based on the keyword key, the new trapdoor data and the first bitmap ciphertext, and send the data update request to the server 22.

[0237] In some of the embodiments, based on the keyword key and the new trapdoor data, the first bitmap bit string of each keyword is encrypted using an additive homomorphic encryption algorithm to obtain the first bitmap ciphertext, and a first decryption key is generated, including:

[0238] Based on the keyword key and the value of the latest update number, calculate the new first encryption key under the latest update number; based on the new first encryption key, use the additive homomorphic encryption algorithm to encrypt the first bitmap bit string to obtain the first bitmap ciphertext; obtain the old first decryption key under the previous update number, and generate the first decryption key under the latest update number based on the new first encryption key and the old first decryption key.

[0239] In some embodiments, generating a data update request based on the keyword key, the new trapdoor data and the first bitmap ciphertext includes:

[0240] Obtain the old trapdoor data under the previous update number that was stored; based on the keyword key, the new trapdoor data and the old trapdoor data, calculate the association relationship between the new trapdoor data and the old trapdoor data, and generate new and old trapdoor association data; based on the keyword key, the new trapdoor data, the first bitmap ciphertext and the new and old trapdoor association data, generate a data update request.

[0241] In some of the embodiments, the data update request further includes: a second bitmap ciphertext. The file information processing module 61 is further used to generate a second bitmap bit string of each keyword contained in the file information based on the file information submitted by the user, wherein the second bitmap bit string describes the relevance between the keyword and each file in the form of an inverted index; and encrypt the second bitmap bit string of each keyword based on the keyword key and the new trapdoor data to obtain a second bitmap ciphertext.

[0242] In some of the embodiments, the device further includes a multi-keyword search module. The multi-keyword search module is used to obtain a master key and new trapdoor data when a user submits a target keyword set; for each target keyword in the target keyword set, calculate a keyword key of each target keyword based on the master key; generate a multi-keyword joint search request based on the keyword key and the new trapdoor data; and send the multi-keyword joint search request to the server 22.

[0243] This embodiment also provides a text encryption device, which is applied to a file search system. The system includes a client 21 and a server 22. The device is applicable to the server 22 side, such as Figure 7 As shown, the device includes: a request receiving module 71, a server encryption module 72, and a ciphertext storage module 73.

[0244] The request receiving module 71 is used to receive a data update request and extract the keyword key, new trapdoor data and first bitmap ciphertext of each keyword from the data update request.

[0245] The server encryption module 72 is used to calculate the new index under the latest update times for each keyword in the update request based on the keyword key and the new trapdoor data; and encrypt the first bitmap ciphertext to obtain new ciphertext data.

[0246] The ciphertext storage module 73 is used to associate and store each new index with the corresponding new ciphertext data in a data table of the ciphertext database.

[0247] In some of the embodiments, encrypting the first bitmap ciphertext to obtain new ciphertext data includes:

[0248] The data update request also includes new and old trapdoor association data; based on the new and old trapdoor association data and the keyword key, the old trapdoor data under the previous update number is restored; based on the old trapdoor data, the old index of the keyword is generated, and based on the old index, the corresponding old ciphertext data is searched in the pre-stored secret database; based on the found old ciphertext data, the first bit graph ciphertext is subjected to additive homomorphic encryption operation to obtain the new ciphertext data under the latest update number.

[0249] In some of the embodiments, the device further includes: a secret state search result generation module. The secret state search result generation module is used to receive a multi-keyword connection search request sent by the client 21; extract the keyword key and new trapdoor data of each target keyword from the multi-keyword connection search request; search for corresponding new ciphertext data in the secret state database based on the keyword key and the new trapdoor data; perform additive homomorphic encryption operation on the found new ciphertext data to obtain a first secret state search result; and return the first secret state search result to the search client 21.

[0250] In some of the embodiments, the received data update request also includes a second bitmap ciphertext; the corresponding new score data is calculated based on the second bitmap ciphertext; the new index of each keyword and the corresponding new score data are associated and stored in a data table of the secret database. The secret search result generation module is also used to search for the corresponding new score data in the secret database based on the keyword key and the new trapdoor data after receiving the multi-keyword connection search request; perform additive homomorphic encryption operation on the found new score data to obtain a second secret search result, and return the second secret search result to the search client 21.

[0251] This embodiment provides a text decryption device, which is applied to a file search system. The system includes a client 21 and a server 22. The device is applicable to the client 21 side, such as Figure 8 As shown, the device includes: a secret search result receiving module 81, a decryption module 82 and a parsing module 83.

[0252] The secret search result receiving module 81 is used to receive the first secret search result obtained by the server 22 based on the multi-keyword joint search request; and obtain a pre-stored first decryption key.

[0253] The decryption module 82 is used to perform a decryption operation corresponding to the additive homomorphic encryption operation on the first encrypted search result based on the first decryption key to obtain a first plaintext bit string.

[0254] The parsing module 83 is used to parse the first plaintext bit string to obtain files related to the multi-keyword joint search request.

[0255] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0256] In this embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0257] Optionally, the computer device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0258] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and will not be repeated in this embodiment.

[0259] In addition, in combination with the text encryption / decryption method provided in the above embodiments, a storage medium can also be provided in this embodiment to implement the method. The storage medium stores a computer program; when the computer program is executed by a processor, any one of the text encryption / decryption methods in the above embodiments is implemented.

[0260] It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.

[0261] Obviously, the drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can also be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.

[0262] The term "embodiment" in this application refers to a specific feature, structure or characteristic described in conjunction with the embodiment that can be included in at least one embodiment of the present application. The appearance of this phrase in various locations in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. It is clearly or implicitly understood by those of ordinary skill in the art that the embodiments described in this application can be combined with other embodiments without conflict.

[0263] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the attached claims.

Claims

1. A text encryption method, characterized in that: Applied to a file search system, the system comprising a client and a server; The method applicable to the client side includes: Based on the file information submitted by the user, generate a first bitmap bit string of each keyword contained in the file information, wherein the first bitmap bit string describes the inclusion relationship between the keyword and each file in the form of an inverted index; Obtain a pre-stored master key, and calculate a keyword key of each keyword based on the master key; randomly generate new trapdoor data for each keyword under the latest update number; Based on the keyword key and the new trapdoor data, performing an additive homomorphic encryption operation on the first bitmap bit string of each keyword to obtain a first bitmap ciphertext; Generate a data update request based on the keyword key, the new trapdoor data and the first bitmap ciphertext, and send the data update request to the server; The method applicable to the server side includes: receiving a data update request, and extracting a keyword key, new trapdoor data, and a first bitmap ciphertext of each keyword from the data update request; For each keyword in the update request, based on the keyword key and the new trapdoor data, a new index under the latest update times is calculated; the first bitmap ciphertext is encrypted to obtain new ciphertext data; Each of the new indexes and the corresponding new ciphertext data are associated and stored in a data table of the cipher database.

2. The text encryption method according to claim 1, characterized in that: Based on the keyword key and the new trapdoor data, the first bitmap bit string of each keyword is encrypted using an additive homomorphic encryption algorithm to obtain the first bitmap ciphertext, including: Based on the keyword key and the new trapdoor data, calculating a new first encryption key under the latest update number; Based on the new first encryption key, encrypt the first bitmap bit string using an additive homomorphic encryption algorithm to obtain a first bitmap ciphertext; The method applicable to the client side also includes: An old first decryption key at the last update number is obtained, and a first decryption key at the latest update number is generated based on the new first encryption key and the old first decryption key.

3. The text encryption method according to claim 1, characterized in that: Generating a data update request based on the keyword key, the new trapdoor data and the first bitmap ciphertext, including: Get the old trapdoor data under the previous update number stored in advance; Based on the keyword key, the new trapdoor data and the old trapdoor data, calculating the association relationship between the new trapdoor data and the old trapdoor data to generate new and old trapdoor association data; A data update request is generated based on the keyword key, the new trapdoor data, the first bitmap ciphertext, and the new and old trapdoor association data.

4. The text encryption method according to any one of claims 1 to 3, characterized in that: The data update request also includes: a second bitmap ciphertext; The second bitmap ciphertext is generated in the following manner: Based on the file information submitted by the user, generating a second bitmap bit string of each keyword contained in the file information, wherein the second bitmap bit string describes the relevance between the keyword and each file in the form of an inverted index; The second bitmap bit string of each of the keywords is encrypted based on the keyword key and the new trapdoor data to obtain a second bitmap ciphertext.

5. The text encryption method according to claim 1, characterized in that: The method further comprises: When the user submits a target keyword set, the master key and the new trapdoor data are obtained; For each target keyword in the target keyword set, the keyword key of each target keyword is calculated based on the master key; based on the keyword key and the new trapdoor data, a multi-keyword joint search request is generated; The multi-keyword joint search request is sent to a server.

6. The text encryption method according to claim 1, characterized in that: The first bitmap ciphertext is encrypted to obtain new ciphertext data, including: The data update request also includes new and old trapdoor association data; Based on the old and new trapdoor association data and the keyword key, the old trapdoor data under the last update number is restored; based on the old trapdoor data, an old index of the keyword is generated, and based on the old index, the corresponding old ciphertext data is searched in the pre-stored secret database; Based on the old ciphertext data found, an additive homomorphic encryption operation is performed on the first bitmap ciphertext to obtain new ciphertext data with the latest update times.

7. The text encryption method according to claim 1, characterized in that: The method further comprises: Receive multi-keyword connection search requests sent by clients; Extracting the keyword key and the new trapdoor data of each target keyword from the multi-keyword joint search request; searching the corresponding new ciphertext data in the cipher database based on the keyword key and the new trapdoor data; Performing an additive homomorphic encryption operation on the new ciphertext data found to obtain a first ciphertext search result; The first confidential search result is returned to the search client.

8. The text encryption method according to claim 7, characterized in that: The method further comprises: The received data update request also includes a second bitmap ciphertext; the corresponding new score data is calculated based on the second bitmap ciphertext; the new index of each keyword and the corresponding new score data are associated and stored in a data table of the encrypted database; After receiving the multi-keyword joint search request, searching the corresponding new scoring data in the secret database based on the keyword key and the new trapdoor data; performing an additive homomorphic encryption operation on the found new scoring data to obtain a second secret search result, The second confidential search result is returned to the search client.

9. The text encryption method according to claim 2, characterized in that: The method on the client side also includes: Receiving a first secret search result obtained by the server based on a multi-keyword joint search request; obtaining a pre-stored first decryption key; the pre-stored first decryption key is the first decryption key under the latest update number; Based on the pre-stored first decryption key, performing a decryption operation corresponding to the additive homomorphic encryption operation on the first secret state search result to obtain a first plaintext bit string; The first plaintext bit string is parsed to obtain a file related to the multi-keyword joint search request.