Data retrieval method and data storage method based on encrypted storage
By performing asymmetric encryption and thread pool parallel processing locally on the terminal, the security risks and low retrieval efficiency in encrypted storage technology are solved, achieving efficient encrypted data retrieval and storage security, and enhancing the control of sensitive data. and security.
Patent Information
- Application Number
- CN202311578877.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-23
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-11-23
AI Technical Summary
Existing encryption storage technology has security risks and low retrieval efficiency. Especially when the security requirements of database information are high, the traditional unified key and network transmission key scheme cannot effectively protect sensitive data, and encrypted data does not support Efficient search.
Use asymmetric encryption to encrypt data locally on the terminal, and store the encrypted data and the certificate fingerprint corresponding to the private key in the database. Parallel processing by the thread pool improves retrieval efficiency. The retrieval request includes the certificate fingerprint to filter the data, and the entire encryption and decryption The process is performed on the terminal side, and the network transmits and stores it as ciphertext data.
It effectively enhances data storage security, reduces the amount of decrypted data, improves retrieval efficiency, strengthens the management and control of sensitive data, prevents data leakage, and supports efficient retrieval of encrypted information resources.
Smart Images

Figure CN117708871B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data retrieval method and a data storage method based on encrypted storage. Background Art
[0002] Data retrieval is to find and extract the required data from a large amount of data. Data retrieval greatly facilitates the exchange and utilization of information resources, has a profound impact on social and economic development and people's scientific research methods, and thus has greatly promoted the advancement of science and technology.
[0003] Encrypted storage and retrieval is a technology that encrypts data before storing it, then searches the encrypted data and extracts the data that meets the screening criteria. This technology can protect the security of stored data, prevent sensitive data leakage, and meet people's needs for data search and use. As the research on database security threats shows, the information security of databases has received widespread attention from the society, and at the same time, the requirements for stored data are higher, which poses new challenges to the use of encrypted stored data.
[0004] In the prior art, the database itself is usually encrypted and stored, and the encryption key is a unified key or the key needs to be transmitted to the server through the network. However, this solution has certain security risks. When a piece of data is decrypted, the security of the data in the entire database will be affected. At the same time, the encrypted data does not support retrieval or decryption retrieval of all data, and the retrieval efficiency is low. Summary of the invention
[0005] In view of the problems existing in the prior art, the present invention provides a data retrieval method and a data storage method based on encrypted storage.
[0006] The present invention provides a data retrieval method based on encrypted storage, comprising:
[0007] The first terminal obtains the search condition;
[0008] The first terminal assigns the pre-acquired certificates of the plurality of second terminals to the threads in the thread pool, and each thread calculates the certificate fingerprint assigned to the certificate; each certificate is generated by the corresponding second terminal based on the respective public key;
[0009] For each thread in the thread pool, the first terminal calls the thread and sends a search request to the background server based on the search condition; the search request includes the search condition and the certificate fingerprint of the certificate corresponding to the thread; after receiving the search result returned by the background server, the thread decrypts the search result based on the certificate to obtain decrypted data, and stores the decrypted data that meets the search condition in a result list;
[0010] The first terminal determines search data based on the data in the result list.
[0011] According to a data retrieval method based on encrypted storage provided by the present invention, for each thread in the thread pool, the first terminal calls the thread and sends a retrieval request to the background server based on the retrieval condition, including:
[0012] When it is determined according to the search condition that the search type is a definite value search, a hash operation is performed on the search condition to obtain a first hash value; the first N bytes of the first hash value are converted into an integer type to obtain a first integer value; N is a positive integer;
[0013] For each thread in the thread pool, the first terminal calls the thread to send the retrieval request to the background server; the retrieval request includes the first integer value and the certificate fingerprint of the certificate corresponding to the thread.
[0014] According to a data retrieval method based on encrypted storage provided by the present invention, the method further includes:
[0015] After the search result is decrypted based on the certificate, the decrypted data that does not meet the search condition is discarded.
[0016] The present invention provides a data storage method based on encrypted storage, comprising:
[0017] The second terminal obtains the data to be encrypted and stored;
[0018] The second terminal encrypts the to-be-encrypted stored data using the corresponding private key to obtain encrypted data;
[0019] The second terminal sends a storage request to the backend server, so that the backend server stores the encrypted data and the certificate fingerprint corresponding to the private key in a database;
[0020] The storage request includes the encrypted data and the certificate fingerprint corresponding to the private key.
[0021] According to a data storage method based on encrypted storage provided by the present invention, the method further includes:
[0022] The second terminal performs a hash operation on the data to be encrypted and stored to obtain a second hash value; converts the first N bytes of the second hash value into an integer type to obtain a second integer value; N is a positive integer;
[0023] Correspondingly, the second terminal sends a storage request to the background server so that the background server stores the encrypted data and the certificate fingerprint corresponding to the private key in a database, including:
[0024] The second terminal sends the storage request to the background server, so that the background server stores the encrypted data, the second integer value and the certificate fingerprint corresponding to the private key in a database; wherein the storage request also includes the second integer value.
[0025] According to a data storage method based on encrypted storage provided by the present invention, the method further includes:
[0026] The second terminal generates a public-private key pair locally, wherein the public-private key pair includes a public key and a private key;
[0027] The second terminal generates a corresponding public key certificate based on the public key, and determines a certificate fingerprint of the public key certificate;
[0028] The second terminal sends the public key certificate to other terminals based on preset authority.
[0029] The present invention also provides a data retrieval device based on encrypted storage, comprising:
[0030] A first acquisition module, used to acquire search conditions;
[0031] A calculation module, used to assign the pre-acquired certificates of multiple second terminals to threads in the thread pool, each thread calculating the certificate fingerprint assigned to each certificate; each certificate is generated by the corresponding second terminal based on the respective public key;
[0032] A retrieval module, for calling each thread in the thread pool, and sending a retrieval request to a background server based on the retrieval condition; the retrieval request includes the retrieval condition and the certificate fingerprint of the certificate corresponding to the thread; after receiving the search result returned by the background server, the thread decrypts the search result based on the certificate to obtain decrypted data, and stores the decrypted data that meets the retrieval condition in a result list;
[0033] The determination module is used to determine the retrieval data based on the data in the result list.
[0034] The present invention also provides a data storage device based on encrypted storage, comprising:
[0035] A second acquisition module is used to acquire the data to be encrypted and stored;
[0036] An encryption module, used for the second terminal to encrypt the to-be-encrypted stored data using a corresponding private key to obtain encrypted data;
[0037] A sending module, used for the second terminal to send a storage request to the background server, so that the background server stores the encrypted data and the certificate fingerprint corresponding to the private key in a database;
[0038] The storage request includes the encrypted data and the certificate fingerprint corresponding to the private key.
[0039] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the processor implements a data retrieval method based on encrypted storage as described above, or implements a data storage method based on encrypted storage as described above.
[0040] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it implements any of the data retrieval methods based on encrypted storage as described above, or implements any of the data storage methods based on encrypted storage as described above.
[0041] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned data retrieval methods based on encrypted storage, or implements any of the above-mentioned data storage methods based on encrypted storage.
[0042] The data retrieval method and data storage method based on encrypted storage provided by the present invention encrypt data by adopting asymmetric encryption in the terminal locally, and store the encrypted data and the certificate fingerprint corresponding to the private key in the database; the first terminal adopts the parallel processing mode of thread pool to improve the retrieval efficiency during retrieval, and the calling thread sends a retrieval request to the background server based on the retrieval condition, and the retrieval request includes the retrieval condition and the certificate fingerprint of the certificate corresponding to the thread; then, the search result returned by the background server is decrypted based on the certificate to obtain the decrypted data, and most of the data can be filtered out through the certificate fingerprint during the retrieval process, which greatly reduces the data volume of the decrypted data, and the entire encryption and decryption stages are on the terminal side, and the encrypted data is transmitted and stored in the network, which effectively strengthens the personal control over their own sensitive data, enhances the storage security of the data, and prevents data leakage. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1This is one of the flow charts of the data retrieval method based on encrypted storage provided by the present invention;
[0045] Figure 2 This is one of the flow charts of the data storage method based on encrypted storage provided by the present invention;
[0046] Figure 3 This is the second flow chart of the data storage method based on encrypted storage provided by the present invention;
[0047] Figure 4 This is the second flow chart of the data retrieval method based on encrypted storage provided by the present invention;
[0048] Figure 5 It is a structural schematic diagram of a data retrieval device based on encrypted storage provided by the present invention;
[0049] Figure 6 It is a structural schematic diagram of a data storage device based on encrypted storage provided by the present invention;
[0050] Figure 7 It is a schematic diagram of the physical structure of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0052] Combine the following Figures 1 to 4 The present invention describes a data retrieval method and a data storage method based on encrypted storage.
[0053] Figure 1 is one of the flow charts of the data retrieval method based on encrypted storage provided by the present invention, such as Figure 1 As shown, the method includes steps 101 to 104, wherein:
[0054] Step 101: The first terminal obtains search conditions.
[0055] It should be noted that the data retrieval method based on encrypted storage provided by the present invention is applicable to data encrypted storage and retrieval scenarios.
[0056] Step 102: The first terminal distributes the pre-acquired certificates of multiple second terminals to threads in a thread pool, and each thread calculates a certificate fingerprint of a certificate distributed to it; each certificate is generated by the corresponding second terminal based on its own public key.
[0057] Optionally, the second terminal locally generates a public-private key pair, the public-private key pair including a public key and a private key; the second terminal generates a corresponding public key certificate based on the public key, and determines the certificate fingerprint of the public key certificate; the second terminal sends the public key certificate to other terminals (including the first terminal) based on preset permissions.
[0058] Step 103: For each thread in the thread pool, the first terminal calls the thread and sends a search request to the background server based on the search condition; the search request includes the search condition and the certificate fingerprint of the certificate corresponding to the thread; after the thread receives the search result returned by the background server, the thread decrypts the search result based on the certificate to obtain decrypted data, and stores the decrypted data that meets the search condition in a result list.
[0059] Optionally, after the search result is decrypted based on the certificate, the decrypted data that does not meet the search condition is discarded, or the decrypted data that meets the search condition is stored in a result list.
[0060] Optionally, in step 103, for each thread in the thread pool, the first terminal calls the thread and sends a search request to the background server based on the search condition, which may be implemented by:
[0061] Step (1), when it is determined according to the search condition that the search type is a definite value search, a hash operation is performed on the search condition to obtain a first hash value; the first N bytes of the first hash value are converted into an integer type to obtain a first integer value; N is a positive integer;
[0062] Optionally, the first integer value is used as a verification value when decrypting data. N is 4, for example.
[0063] Step (2): for each thread in the thread pool, the first terminal calls the thread to send the retrieval request to the background server; the retrieval request includes the first integer value and the certificate fingerprint of the certificate corresponding to the thread.
[0064] Optionally, when searching, the background server uses the first integer value as a first index value, and uses the certificate fingerprint of the certificate corresponding to the thread as a second index value.
[0065] Step 104: The first terminal determines search data based on the data in the result list.
[0066] Optionally, when all threads in the thread pool receive the query results fed back by the backend server, the retrieved data is determined based on the data in the result list, and the retrieved data is presented to the user, or the retrieved data is sent to a specific device, thereby completing the retrieval of the encrypted stored data.
[0067] The data retrieval method based on encrypted storage provided by the present invention encrypts data by adopting asymmetric encryption method locally at the terminal, and stores the encrypted data and the certificate fingerprint corresponding to the private key in the database; the first terminal adopts the parallel processing method of thread pool to improve the retrieval efficiency during retrieval, and the calling thread sends a retrieval request to the background server based on the retrieval condition, and the retrieval request includes the retrieval condition and the certificate fingerprint of the certificate corresponding to the thread; then, the search result returned by the background server is decrypted based on the certificate to obtain the decrypted data, and most of the data can be filtered out through the certificate fingerprint during the retrieval process, which greatly reduces the data volume of the decrypted data, and the entire encryption and decryption stages are on the terminal side, and the data transmitted and stored in the network are all ciphertext data, which effectively strengthens the personal control over their own sensitive data, enhances the storage security of the data, and prevents data leakage.
[0068] Figure 2 This is one of the flow charts of the data storage method based on encrypted storage provided by the present invention, such as Figure 2 As shown, the method includes steps 201 to 203, wherein:
[0069] Step 201: The second terminal obtains data to be encrypted and stored.
[0070] It should be noted that the data storage method based on encrypted storage provided by the present invention is applicable to data encryption storage scenarios.
[0071] Step 202: The second terminal uses the corresponding private key to encrypt the data to be encrypted and stored to obtain encrypted data.
[0072] Optionally, the second terminal locally generates a public-private key pair, the public-private key pair including a public key and a private key; the second terminal generates a corresponding public key certificate based on the public key, and determines the certificate fingerprint of the public key certificate; the second terminal sends the public key certificate to other terminals based on preset permissions.
[0073] Step 203: The second terminal sends a storage request to the background server, so that the background server stores the encrypted data and the certificate fingerprint corresponding to the private key in a database; wherein the storage request includes the encrypted data and the certificate fingerprint corresponding to the private key.
[0074] Optionally, the second terminal performs a hash operation on the data to be encrypted and stored to obtain a second hash value; converts the first N bytes of the second hash value into an integer type to obtain a second integer value; N is a positive integer;
[0075] Optionally, in step 203, the second terminal sends a storage request to the background server so that the background server stores the encrypted data and the certificate fingerprint corresponding to the private key in a database. The implementation method may include: the second terminal sends the storage request to the background server so that the background server stores the encrypted data, the second integer value and the certificate fingerprint corresponding to the private key in the database; wherein the storage request also includes the second integer value.
[0076] The data storage method based on encrypted storage provided by the present invention encrypts data by using asymmetric encryption in the local terminal, encrypts the data to be encrypted and stored using a private key to obtain encrypted data, and then sends the encrypted data and the certificate fingerprint corresponding to the private key to the background server, so that the background server stores the encrypted data and the certificate fingerprint corresponding to the private key in the database. Since the data sources of each certificate fingerprint are different and completely independent, most of the data can be filtered out through the certificate fingerprint during the retrieval process, which greatly reduces the amount of decrypted data and improves the retrieval efficiency. The entire encryption and decryption stage is on the terminal side, and the data transmitted and stored in the network are all ciphertext data, which effectively strengthens the individual's control over their own sensitive data, enhances the storage security of data, and prevents data leakage.
[0077] The present invention encrypts and stores data, supports retrieval of stored encrypted data, encrypts the original data in an asymmetric encryption manner to generate ciphertext, performs hash operation on the original data, takes the first 4 bytes as the check value, and converts the 4 bytes into an integer type to improve retrieval and comparison efficiency. After the user generates a public key pair locally, the public key generates a certificate and calculates the certificate fingerprint. When storing the ciphertext data field in the database table, the integer value obtained by hashing and the corresponding certificate fingerprint are stored at the same time. Since the data sources of each certificate fingerprint are different and are completely independent, the processing method of the thread pool used during retrieval can efficiently process the encrypted data and obtain the authorized data required by the user. The present invention can effectively strengthen the management and control of personal sensitive data, enhance the storage security of data, prevent data leakage, improve the security control of data authority, and support the normal retrieval of data by users, which greatly facilitates the use of encrypted information resources.
[0078] Figure 3 This is a second flow chart of the data storage method based on encrypted storage provided by the present invention, such as Figure 3 As shown, the method includes steps 301 to 308, wherein:
[0079] Step 301: The second terminal generates a public-private key pair locally, and uses the public key to generate a certificate.
[0080] Step 302: Use the RipeMD160 algorithm to calculate the certificate fingerprint.
[0081] Step 303: Distribute the certificate to other users according to management specifications and permissions.
[0082] Step 304: When sensitive data needs to be encrypted and stored (i.e., data to be encrypted and stored), a hash operation is performed on the data to be encrypted and stored to obtain a hash value; the first 4 bytes of the hash value are taken as a check value, and these 4 bytes are converted into an integer type to obtain an integer value.
[0083] Step 305: Use the private key to encrypt the data to be stored.
[0084] Step 306: Send one or more encrypted data, corresponding integer values, and the certificate fingerprint corresponding to the private key used for encryption to the background server via the Hyper Text Transfer Protocol over Secure Socket Layer (HTTPS) protocol.
[0085] Step 307: After receiving the encrypted data, the corresponding integer value and the certificate fingerprint corresponding to the private key used for encryption, the background server stores the encrypted data, the corresponding integer value and the certificate fingerprint corresponding to the private key used for encryption in a database table.
[0086] Step 308: Create indexes for the integer value and the certificate fingerprint respectively.
[0087] At this point, the storage of the data to be encrypted is completed.
[0088] Next, the user can retrieve the data on the background server through the terminal. Since the data is stored in encrypted form, it cannot be filtered like plain text data. Therefore, a fuzzy search is performed first, and then the data that meets the conditions is decrypted and filtered.
[0089] Figure 4 This is the second flow chart of the data retrieval method based on encrypted storage provided by the present invention. Figure 4 As shown, the method includes steps 401 to 413, wherein:
[0090] Step 401: When a user needs to perform a search, the first terminal obtains search conditions.
[0091] Step 402: Establish a thread pool.
[0092] Optionally, since the stored encrypted data is encrypted through asymmetric encryption, the data of each different certificate fingerprint is independent, and by starting the thread pool, data can be retrieved more efficiently.
[0093] Step 403: The first terminal reads all local certificates and assigns them to threads in the thread pool. Each thread calculates the certificate fingerprint of the certificate assigned to it, and then each thread sends the search conditions and the certificate fingerprint of the certificate corresponding to the thread to the background server in parallel. Each certificate is generated by the corresponding second terminal based on its own public key.
[0094] Step 404: The backend server receives the search condition and the certificate fingerprint of the thread corresponding certificate sent by the user through the first terminal. Based on the search condition, it is determined whether the encrypted data is a definite value search (for example, searching for a definite value such as a mobile phone number equal to "13623456548"); if it is determined that the encrypted data is a definite value search, go to step 406; if it is determined that the encrypted data is not a definite value search, go to step 405.
[0095] Step 405 , use the certificate fingerprint as the index value for retrieval, and then go to step 407 .
[0096] Step 406: Perform a hash operation on the search condition to obtain a hash value; take the first 4 bytes of the hash value as the check value, convert these 4 bytes into an integer type, and obtain an integer value. The backend server uses the generated integer value as the first index value and the certificate fingerprint as the second index value for retrieval.
[0097] Step 407: The backend server returns the search result to the first terminal.
[0098] Step 408: After receiving the search result, different threads in the first terminal use corresponding certificates to decrypt the search result.
[0099] Step 409, determine whether the decrypted data meets the search conditions; if the decrypted data meets the search conditions, go to step 411; if the decrypted data does not meet the search conditions, go to step 410.
[0100] Step 410 , discard the decrypted data that does not meet the retrieval condition, and then go to step 412 .
[0101] Step 411: store the decrypted data that meets the search criteria into a result list.
[0102] Step 412: Wait for all threads in the thread pool to return results.
[0103] Step 413: Determine the search data based on the data in the result list, present the search data to the user, or send the search data to a specific device, thereby completing the search for the encrypted storage data.
[0104] The present invention uses an asymmetric method to encrypt data. Each user can have one or more key pairs. The entire encryption and decryption stage is local, and network transmission and storage are all ciphertext data, which effectively strengthens the individual's control over their own sensitive data, enhances the storage security of data, and prevents data leakage. At the same time, different keys are directly and completely independent, and the leakage of an individual's private key cannot affect all the data, thereby greatly improving the overall security. Users decrypt data through public keys, and improve data authority security control through control and management of certificate distribution. During retrieval, most of the data can be filtered out through certificate fingerprints, greatly reducing the amount of decrypted data. Due to the independence of certificates, the parallel processing of thread pools further greatly improves the retrieval efficiency.
[0105] The data retrieval device based on encrypted storage provided by the present invention is described below. The data retrieval device based on encrypted storage described below and the data retrieval method based on encrypted storage described above can be referenced to each other.
[0106] Figure 5 is a schematic diagram of the structure of the data retrieval device based on encrypted storage provided by the present invention; the data retrieval device based on encrypted storage 500 comprises: a first acquisition module 501, a calculation module 502, a retrieval module 503 and a determination module 504; wherein,
[0107] The first acquisition module 501 is used to acquire search conditions;
[0108] A calculation module 502 is used to assign the pre-acquired certificates of multiple second terminals to threads in the thread pool, and each thread calculates the certificate fingerprint assigned to each certificate; each certificate is generated by the corresponding second terminal based on its own public key;
[0109] The retrieval module 503 is used to call each thread in the thread pool and send a retrieval request to the background server based on the retrieval condition; the retrieval request includes the retrieval condition and the certificate fingerprint of the certificate corresponding to the thread; after receiving the search result returned by the background server, the thread decrypts the search result based on the certificate to obtain decrypted data, and stores the decrypted data that meets the retrieval condition in the result list;
[0110] The determination module 504 is used to determine the search data based on the data in the result list.
[0111] The data retrieval device based on encrypted storage provided by the present invention encrypts data by adopting asymmetric encryption method locally at the terminal, and stores the encrypted data and the certificate fingerprint corresponding to the private key in the database; the first terminal adopts the parallel processing method of thread pool to improve the retrieval efficiency during retrieval, and the calling thread sends a retrieval request to the background server based on the retrieval condition, and the retrieval request includes the retrieval condition and the certificate fingerprint of the certificate corresponding to the thread; then, the search result returned by the background server is decrypted based on the certificate to obtain the decrypted data, and most of the data can be filtered out through the certificate fingerprint during the retrieval process, which greatly reduces the data volume of the decrypted data, and the entire encryption and decryption stages are on the terminal side, and the data transmitted and stored in the network are all ciphertext data, which effectively strengthens the personal control over their own sensitive data, enhances the storage security of the data, and prevents data leakage.
[0112] Optionally, the retrieval module 503 is specifically used to:
[0113] When it is determined according to the search condition that the search type is a definite value search, a hash operation is performed on the search condition to obtain a first hash value; the first N bytes of the first hash value are converted into an integer type to obtain a first integer value; N is a positive integer;
[0114] For each thread in the thread pool, the thread is called to send the retrieval request to the background server; the retrieval request includes the first integer value and the certificate fingerprint of the certificate corresponding to the thread.
[0115] Optionally, the data retrieval device 500 based on encrypted storage further includes:
[0116] The processing module is used to decrypt the search result based on the certificate and discard the decrypted data that does not meet the search condition.
[0117] The data storage device based on encrypted storage provided by the present invention is described below. The data storage device based on encrypted storage described below and the data storage method based on encrypted storage described above can be referenced to each other.
[0118] Figure 6 600 is a schematic diagram of a data storage device based on encrypted storage provided by the present invention; the data storage device based on encrypted storage 600 comprises: a second acquisition module 601, an encryption module 602 and a sending module 603; wherein,
[0119] The second acquisition module 601 is used to acquire the data to be encrypted and stored;
[0120] An encryption module 602 is used for the second terminal to encrypt the to-be-encrypted stored data using the corresponding private key to obtain encrypted data;
[0121] The sending module 603 is used for the second terminal to send a storage request to the background server so that the background server stores the encrypted data and the certificate fingerprint corresponding to the private key in the database; wherein the storage request includes the encrypted data and the certificate fingerprint corresponding to the private key.
[0122] The data storage device based on encrypted storage provided by the present invention encrypts data by using asymmetric encryption in the local terminal, encrypts the data to be encrypted and stored using a private key to obtain encrypted data, and then sends the encrypted data and the certificate fingerprint corresponding to the private key to the background server, so that the background server stores the encrypted data and the certificate fingerprint corresponding to the private key in the database. Since the data sources of each certificate fingerprint are different and completely independent, most of the data can be filtered out through the certificate fingerprint during the retrieval process, which greatly reduces the amount of decrypted data and improves the retrieval efficiency. The entire encryption and decryption stage is on the terminal side, and the data transmitted and stored in the network are all ciphertext data, which effectively strengthens the individual's control over their own sensitive data, enhances the storage security of data, and prevents data leakage.
[0123] Optionally, the data storage device 600 based on encrypted storage further includes:
[0124] A computing module, configured to perform a hash operation on the encrypted storage data to obtain a second hash value; convert the first N bytes of the second hash value into an integer type to obtain a second integer value; N is a positive integer;
[0125] The sending module 603 is specifically used to: send the storage request to the background server, so that the background server stores the encrypted data, the second integer value and the certificate fingerprint corresponding to the private key in the database; wherein the storage request also includes the second integer value.
[0126] Optionally, the data storage device 600 based on encrypted storage further includes:
[0127] A generation module, used to locally generate a public-private key pair, the public-private key pair comprising a public key and a private key;
[0128] The generating module is further used to generate a corresponding public key certificate based on the public key, and determine the certificate fingerprint of the public key certificate;
[0129] The sending module 603 is specifically used to send the public key certificate to other terminals based on preset permissions.
[0130] Figure 7 is a schematic diagram of the physical structure of the electronic device provided by the present invention, such as Figure 7As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other via the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the above-mentioned data retrieval method based on encrypted storage, or execute the above-mentioned data storage method based on encrypted storage.
[0131] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0132] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the data retrieval method based on encrypted storage provided by the above methods, or execute the data storage method based on encrypted storage provided by the above methods.
[0133] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the data retrieval method based on encrypted storage provided by the above methods, or to execute the data storage method based on encrypted storage provided by the above methods.
[0134] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0135] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data retrieval method based on encrypted storage, characterized in that: include: The first terminal obtains the search condition; The first terminal assigns the pre-acquired certificates of the plurality of second terminals to the threads in the thread pool, and each thread calculates the certificate fingerprint assigned to the certificate; each certificate is generated by the corresponding second terminal based on the respective public key; When it is determined according to the search condition that the search type is a definite value search, a hash operation is performed on the search condition to obtain a first hash value; the first N bytes of the first hash value are converted into an integer type to obtain a first integer value; N is a positive integer; For each thread in the thread pool, the first terminal calls the thread to send the search request to the background server; the search request includes the first integer value and the certificate fingerprint of the certificate corresponding to the thread; the first integer value is used as the first index value of the background server during the search, and the certificate fingerprint is used as the second index value of the background server during the search; after receiving the search result returned by the background server, the thread decrypts the search result based on the certificate to obtain decrypted data, and stores the decrypted data that meets the search condition in the result list; The first terminal determines search data based on the data in the result list.
2. The data retrieval method based on encrypted storage according to claim 1, characterized in that: The method further comprises: After the search result is decrypted based on the certificate, the decrypted data that does not meet the search condition is discarded.
3. A data storage method based on encrypted storage, characterized in that: include: The second terminal obtains the data to be encrypted and stored; The second terminal encrypts the to-be-encrypted stored data using the corresponding private key to obtain encrypted data; The second terminal performs a hash operation on the to-be-encrypted stored data to obtain a second hash value; Convert the first N bytes of the second hash value into an integer type to obtain a second integer value; N is a positive integer; The second terminal sends the storage request to the backend server, so that the backend server stores the encrypted data, the second integer value and the certificate fingerprint corresponding to the private key in a database; The storage request includes the encrypted data and the certificate fingerprint corresponding to the private key, and the storage request also includes the second integer value.
4. The data storage method based on encrypted storage according to claim 3, characterized in that: The method further comprises: The second terminal generates a public-private key pair locally, wherein the public-private key pair includes a public key and a private key; The second terminal generates a corresponding public key certificate based on the public key, and determines a certificate fingerprint of the public key certificate; The second terminal sends the public key certificate to other terminals based on preset authority.
5. A data retrieval device based on encrypted storage, characterized in that: include: A first acquisition module, used to acquire search conditions; A calculation module, used to assign the pre-acquired certificates of multiple second terminals to threads in the thread pool, each thread calculating the certificate fingerprint assigned to the certificate; each certificate is generated by the corresponding second terminal based on the respective public key; A retrieval module, for determining, based on the retrieval condition, that the retrieval type is a determined value retrieval, performing a hash operation on the retrieval condition to obtain a first hash value; converting the first N bytes of the first hash value into an integer type to obtain a first integer value; N is a positive integer; for each thread in the thread pool, the first terminal calls the thread to send the retrieval request to the background server; the retrieval request includes the first integer value and the certificate fingerprint of the certificate corresponding to the thread; the first integer value is used as the first index value of the background server during retrieval, and the certificate fingerprint is used as the second index value of the background server during retrieval; after the thread receives the search result returned by the background server, it decrypts the search result based on the certificate to obtain decrypted data, and stores the decrypted data that meets the search condition in a result list; The determination module is used to determine the retrieval data based on the data in the result list.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it implements the data retrieval method based on encrypted storage as described in claim 1 or 2, or implements the data storage method based on encrypted storage as described in claim 3 or 4.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for retrieving data based on encrypted storage as claimed in claim 1 or 2 is implemented, or the method for storing data based on encrypted storage as claimed in claim 3 or 4 is implemented.
8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for retrieving data based on encrypted storage as claimed in claim 1 or 2 is implemented, or the method for storing data based on encrypted storage as claimed in claim 3 or 4 is implemented.
