Encrypted file writing method and system, storage medium and electronic device
By generating quantum-resistant cryptographic parameters and building polynomial rings, it is used to encrypt and optimize file writing and reading on solid-state drives, solving the problem that traditional encryption methods cannot cope with the threat of quantum computers, and achieving high security and performance of target files optimization.
Patent Information
- Application Number
- CN202410789927.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-06-19
AI Technical Summary
In the prior art, traditional encryption methods cannot effectively protect data when facing quantum computer attacks, resulting in the target file being cracked during the undecrypted period, and the performance optimization of quantum attacks stored on solid-state hard disks is not fully considered.
By generating quantum-resistant cryptographic parameters, building a polynomial ring and performing fast number theory transformation, generating a server-side public key for client-side encryption files, and optimizing the writing and reading of encrypted files on solid-state drives, using a write-wait decision tree to Improve page efficiency.
Effectively prevent quantum computers from cracking target files, improve the security of data during the undecrypted period, and optimize the ciphertext storage and reading performance on solid-state hard disks.
Smart Images

Figure CN118364496B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a method and system for writing encrypted files, a storage medium, and an electronic device. Background Art
[0002] At present, traditional encryption methods that rely on large integer factorization and discrete logarithm problems may be quickly cracked in quantum attacks, which puts traditional encryption methods at risk. Quantum-resistant cryptography can maintain data security under the attack of quantum computers. With the rapid development of quantum computers, the deployment of post-quantum cryptography with quantum-resistant characteristics has become increasingly important.
[0003] The relevant technologies have not yet realized the importance of quantum-resistant storage, there is no quantum-resistant secure storage, and no consideration from the perspective of quantum-resistant security and performance. For example: how to perform internal tasks on demand within the time range of host read and write operations. Since the encryption process of quantum-resistant passwords is usually more complicated than that of traditional passwords, it may have some negative impact on the performance of the server. When using quantum-resistant passwords, it is necessary to balance data protection and performance needs; and for the problem of storing ciphertext, the relevant technologies have not yet realized the problem of read optimization for storage on solid-state drives (SSDs).
[0004] Therefore, with regard to the relevant technologies, encrypting the target files by traditional encryption methods cannot cope with the threat of quantum computers, resulting in the problem that the target files are cracked by quantum computers before the decryption period, which has not yet been effectively solved. Summary of the invention
[0005] The embodiments of the present application provide a method and system for writing an encrypted file, a storage medium, and an electronic device, so as to at least solve the problem in the related art that encrypting a target file by a traditional encryption method cannot cope with the threat of a quantum computer, resulting in the target file being cracked by a quantum computer before the decryption period.
[0006] According to an embodiment of the present application, a method for writing an encrypted file is provided, and the method for writing an encrypted file is applied to a server side, wherein the server side includes: a solid-state hard disk, and the solid-state hard disk is used to store a target file sent by a client, wherein: when an anti-quantum requirement sent by the client is received, a corresponding anti-quantum cryptographic parameter is generated according to the anti-quantum requirement; a server-side public key is generated according to the anti-quantum cryptographic parameter, and the server-side public key is sent to the client, so that the client encrypts the target file according to the server-side public key, and sends the encrypted target file to the server; the received encrypted target file is written to the solid-state hard disk.
[0007] In an exemplary embodiment, generating corresponding anti-quantum cryptographic parameters according to the anti-quantum requirements includes: determining the dimension of a lattice corresponding to a lattice difficulty problem according to the anti-quantum requirements; constructing a polynomial ring according to the dimension of the lattice; and performing a fast number theory transformation on the polynomial ring to determine the anti-quantum cryptographic parameters.
[0008] In an exemplary embodiment, writing the received encrypted target file into the solid-state drive includes: determining a first size relationship between the number of pages occupied by the encrypted target file and a target number; when the first size relationship indicates that the number of pages is greater than the target number, determining the file size of the encrypted target file, and writing the encrypted target file into the solid-state drive based on a multiple relationship between the file size and the page size of pages in the solid-state drive; when the first size relationship indicates that the number of pages is equal to the target number, determining the file size, and writing the encrypted target file into the solid-state drive based on the proportion of the file size in the pages of the solid-state drive.
[0009] In an exemplary embodiment, the encrypted target file is written to the solid-state drive according to a multiple relationship between the file size and the page size of the pages in the solid-state drive, including: when the multiple relationship indicates that the file size is an integer multiple of the page size, determining a first page set in the solid-state drive, and writing the encrypted target file in the first page set, wherein the pages in the first page set are pages in the solid-state drive where no data is written; when the multiple relationship indicates that the file size is not an integer multiple of the page size, calculating a remainder between the file size and the page size, and writing the encrypted target file to the solid-state drive according to the remainder.
[0010] In an exemplary embodiment, writing the encrypted target file to the solid-state drive according to the remainder includes: determining a second size relationship between the remainder and a first numerical value; when the second size relationship indicates that the remainder is greater than or equal to the first numerical value, determining a second page set in the solid-state drive and writing the encrypted target file in the second page set, and when the encrypted target file is successfully written to the second page set, writing invalid data in a blank area of a page in the second page set, wherein the pages in the second page set are pages in the solid-state drive where no data is written; when the second size relationship indicates that the remainder is less than the first numerical value, determining a third size relationship between the remainder and the second numerical value, and writing the encrypted target file to the solid-state drive according to the third size relationship, wherein the second numerical value is less than the first numerical value.
[0011] In an exemplary embodiment, writing the encrypted target file to the solid-state drive according to the third size relationship includes: adjusting the state of the solid-state drive from a write state to a write wait state, and determining a first write wait time of the write wait state according to the third size relationship; determining whether a first file is received within a first time period corresponding to the current time and the first write wait time, and writing the encrypted target file to the solid-state drive according to whether the first file is received.
[0012] In an exemplary embodiment, the encrypted target file is written to the solid-state drive based on whether the first file is received, including: if the first file is received within the first time period, merging the first file with the encrypted target file, and writing the encrypted second file to the solid-state drive based on a multiple relationship between the file size of the merged second file and the page size of the pages in the solid-state drive; if the first file is not received within the first time period, determining a third page set in the solid-state drive, and writing the encrypted target file in the third page set, and if the encrypted target file is successfully written to the third page set, writing invalid data in a blank area of a page in the third page set, wherein the pages in the third page set are pages in the solid-state drive where no data is written.
[0013] In an exemplary embodiment, the encrypted target file is written to the solid-state drive according to the proportion of the file size to the pages of the solid-state drive, including: determining a fourth size relationship between the proportion and a third numerical value; when the fourth size relationship indicates that the proportion is greater than or equal to the third numerical value, determining a fifth size relationship between the proportion and the fourth numerical value, and writing the encrypted target file to the solid-state drive according to the fifth size relationship, wherein the fourth numerical value is greater than the third numerical value; when the fourth size relationship indicates that the proportion is less than the third numerical value, determining a sixth size relationship between the proportion and the fifth numerical value, and writing the encrypted target file to the solid-state drive according to the sixth size relationship, wherein the fifth numerical value is less than the third numerical value.
[0014] In an exemplary embodiment, the encrypted target file is written to the solid-state drive according to the fifth size relationship, including: when the fifth size relationship indicates that the proportion is greater than the fourth value, determining the first page in the solid-state drive and writing the encrypted target file in the first page, and when the encrypted target file is successfully written to the first page, writing invalid data in a blank area of the first page, wherein the first page is a page in the solid-state drive on which no data is written.
[0015] In an exemplary embodiment, the encrypted target file is written to the solid-state drive according to the fifth size relationship, including: when the fifth size relationship indicates that the proportion is less than or equal to the fourth value, the state of the solid-state drive is adjusted from a write state to a write wait state, and a second write wait time of the write wait state is determined according to the fifth size relationship; determining whether a third file is received within a second time period corresponding to the current time and the second write wait time, and writing the encrypted target file to the solid-state drive according to whether the third file is received.
[0016] In an exemplary embodiment, the encrypted target file is written to the solid-state drive according to whether the third file is received, including: if the third file is received within the second time period, merging the third file with the encrypted target file, and writing the encrypted fourth file to the solid-state drive according to a multiple relationship between the file size of the merged fourth file and the page size of the page in the solid-state drive; if the third file is not received within the second time period, determining the second page in the solid-state drive and writing the encrypted target file in the second page, and if the encrypted target file is successfully written to the second page, writing invalid data in a blank area of the page in the second page, wherein the second page is a page in the solid-state drive where no data is written.
[0017] In an exemplary embodiment, writing the encrypted target file to the solid-state drive according to the sixth size relationship includes: adjusting the state of the solid-state drive from a write state to a write wait state, and determining a third write wait time of the write wait state according to the sixth size relationship; determining whether a fifth file is received within a third time period corresponding to the current time and the third write wait time; if the fifth file is received within the third time period, merging the fifth file with the encrypted target file, and writing the encrypted sixth file to the solid-state drive according to a multiple relationship between the file size of the merged sixth file and the page size of the page in the solid-state drive; if the fifth file is not received within the third time period, determining a third page in the solid-state drive, writing the encrypted target file in the third page, and if the encrypted target file is successfully written to the third page, writing invalid data in a blank area of the page in the third page, wherein the third page is a page in the solid-state drive where no data is written.
[0018] In an exemplary embodiment, after writing the received encrypted target file into the solid-state drive, the method further includes: upon receiving an authentication request from the client, receiving a signature file sent by the client, wherein the signature file is a file generated after the client signs a seventh file by using a client private key, and the authentication request is used to indicate that the client requests to perform a target operation on the encrypted target file; obtaining the client public key of the client, and verifying the signature file based on the client public key; if the signature file verification passes, decrypting the encrypted target file by using a server-side private key to generate the target file; comparing the target file with the signature file, and determining whether the client passes the authentication based on a first comparison result.
[0019] In an exemplary embodiment, determining whether the client has passed the authentication based on a first comparison result includes: when the first comparison result indicates that the target file and the signature file are consistent, determining that the client authentication is successful, and sending a first notification to the client to enable the client to perform the target operation on the encrypted target file, wherein the first notification is used to indicate that the client authentication is successful; when the first comparison result indicates that the target file and the signature file are inconsistent, determining that the client authentication has failed, and sending a second notification to the client to prohibit the client from performing the target operation on the encrypted target file, wherein the second notification is used to indicate that the client authentication has failed.
[0020] According to another embodiment of the present application, a method for writing an encrypted file is provided, and the method for writing an encrypted file is applied to a client, wherein the client is used to send a target file to a server, and the server includes: a solid-state hard disk, and the solid-state hard disk is used to store the target file, wherein: an anti-quantum requirement is sent to the server, so that the server generates corresponding anti-quantum cryptographic parameters according to the anti-quantum requirement, and generates a server-side public key according to the anti-quantum cryptographic parameters, and sends the server-side public key to the client; when the server-side public key is received, the target file is encrypted according to the server-side public key, and the encrypted target file is sent to the server, so that the server writes the received encrypted target file into the solid-state hard disk.
[0021] In an exemplary embodiment, before sending the encrypted target file to the server, the method also includes: extracting keywords of the target file upon receiving the server public key; converting the keywords into hash values according to a hash algorithm; and sending the hash values to the server so that the server establishes a label for the encrypted target file according to the hash values.
[0022] In an exemplary embodiment, after sending the anti-quantum requirement to the server, the method further includes: upon receiving the anti-quantum cryptographic parameters sent by the server, generating a client public key according to the anti-quantum cryptographic parameters, and sending the client public key to the server so that the server stores the client public key.
[0023] In an exemplary embodiment, after sending the encrypted target file to the server, the method further includes: sending an authentication request to the server, wherein the authentication request is used to instruct the client to request to perform a target operation on the encrypted target file; when it is determined that the server has received the authentication request, sending a signature file to the server so that the server verifies the signature file according to the client public key, and when the signature file is verified, decrypting the encrypted target file by using the server private key to generate the target file, comparing the target file with the signature file, and determining whether the client passes the authentication based on a first comparison result, wherein the signature file is a file generated after the client signs the seventh file by using the client private key.
[0024] According to another embodiment of the present application, a system for writing encrypted files is provided, including: a server side, for generating corresponding anti-quantum cryptographic parameters according to the anti-quantum requirements sent by a client side; generating a server-side public key according to the anti-quantum cryptographic parameters, and sending the server-side public key to the client side, so that the client side encrypts the target file according to the server-side public key, and sends the encrypted target file to the server side; writing the received encrypted target file into a solid-state hard disk; a client side, for sending the anti-quantum requirements to the server side, so that the server side generates the anti-quantum cryptographic parameters according to the anti-quantum requirements, generates the server-side public key according to the anti-quantum cryptographic parameters, and sends the server-side public key to the client side; when receiving the server-side public key, encrypting the target file according to the server-side public key, and sending the encrypted target file to the server side, so that the server side writes the received encrypted target file into the solid-state hard disk.
[0025] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.
[0026] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in the above method embodiment.
[0027] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiment are implemented.
[0028] Through the writing method of the encrypted file of the present application, when the anti-quantum requirement sent by the client is received, the corresponding anti-quantum cryptographic parameters are generated according to the anti-quantum requirement, the server-side public key is generated according to the anti-quantum cryptographic parameters, and the server-side public key is sent to the client, so that the client encrypts the target file according to the server-side public key, generates the encrypted target file, and sends the encrypted target file to the server; the server writes the received encrypted target file into the solid-state hard disk. In other words, the present application determines the anti-quantum cryptographic parameters according to the received anti-quantum requirement, and generates the server-side public key according to the anti-quantum cryptographic parameters, and uses the security of the anti-quantum cryptography to ensure the security of the server-side public key; at the same time, the client of the present application encrypts the target file through the server-side public key to ensure the security of the encrypted target file in the solid-state hard disk. Through the above technical solution, the problem that the target file is encrypted by the traditional encryption method in the related technology and cannot cope with the threat of quantum computers, resulting in the target file being cracked by the quantum computer before the decryption period is solved. It is ensured that the quantum computer cannot crack the target file during the undecryption period of the target file, thereby improving the security of the target file. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a flow chart of a server side of a method for writing an encrypted file according to an embodiment of the present application;
[0030] Figure 2 It is a hardware structure block diagram of a client of a method for writing an encrypted file in an embodiment of the present application;
[0031] Figure 3 It is a flowchart of a client of a method for writing an encrypted file according to an embodiment of the present application;
[0032] Figure 4 It is a flowchart of a method for optimizing the secure storage performance of a solid-state disk that is resistant to quantum attacks according to an optional embodiment of the present application;
[0033] Figure 5 This is an overall architecture diagram of a method for optimizing the secure storage performance of a solid-state disk that is resistant to quantum attacks according to an optional embodiment of the present application;
[0034] Figure 6 is a device structure diagram of a method for optimizing the secure storage performance of a solid-state disk that is resistant to quantum attacks according to an optional embodiment of the present application;
[0035] Figure 7 is a polynomial ring for NTT computing environment according to an optional embodiment of the present application And the schematic diagram of splitting isomorphism under polynomial ring;
[0036] Figure 8 is a schematic diagram of encrypting a data file for constructing a search index according to an optional embodiment of the present application;
[0037] Fig. 9 is a schematic diagram of searching for stored encrypted information according to a search index according to an optional embodiment of the present application;
[0038] Fig.10 is a schematic diagram of a decision tree for storing encrypted small files according to an optional embodiment of the present application;
[0039] Fig.11 is a schematic diagram of a decision tree for storing encrypted large files according to an optional embodiment of the present application;
[0040] Fig.12 It is a structural block diagram of a system for writing encrypted files according to an embodiment of the present application. DETAILED DESCRIPTION
[0041] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0042] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0043] The method embodiment provided in the embodiments of the present application can be applied to the server side. Figure 1 is a flow chart of a server-side method for writing an encrypted file according to an embodiment of the present application, wherein the server-side includes: a solid-state hard disk, the solid-state hard disk is used to store the target file sent by the client, such as Figure 1 As shown, the process includes the following steps:
[0044] Step S102, upon receiving the quantum resistance requirement sent by the client, generating corresponding quantum resistance cryptographic parameters according to the quantum resistance requirement;
[0045] Among them, the above-mentioned anti-quantum requirements stipulate the complexity of anti-quantum cryptography, and the corresponding anti-quantum parameters can be generated according to the anti-quantum requirements.
[0046] Step S104, generating a server-side public key according to the quantum-resistant cryptographic parameters, and sending the server-side public key to the client, so that the client encrypts the target file according to the server-side public key, and sends the encrypted target file to the server;
[0047] Among them, a quantum-resistant password can be generated according to the quantum-resistant password parameters, and the quantum-resistant password can be used as a server-side public key.
[0048] Step S106, writing the received encrypted target file into the solid state drive.
[0049] Through the writing method of the encrypted file of the present application, when the anti-quantum requirement sent by the client is received, the corresponding anti-quantum cryptographic parameters are generated according to the anti-quantum requirement, the server-side public key is generated according to the anti-quantum cryptographic parameters, and the server-side public key is sent to the client, so that the client encrypts the target file according to the server-side public key, generates the encrypted target file, and sends the encrypted target file to the server; the server writes the received encrypted target file into the solid-state hard disk. In other words, the present application determines the anti-quantum cryptographic parameters according to the received anti-quantum requirement, and generates the server-side public key according to the anti-quantum cryptographic parameters, and uses the security of the anti-quantum cryptography to ensure the security of the server-side public key; at the same time, the client of the present application encrypts the target file through the server-side public key to ensure the security of the encrypted target file in the solid-state hard disk. Through the above technical solution, the problem that the target file is encrypted by the traditional encryption method in the related technology and cannot cope with the threat of quantum computers, resulting in the target file being cracked by the quantum computer before the decryption period is solved. It is ensured that the quantum computer cannot crack the target file during the undecryption period of the target file, thereby improving the security of the target file.
[0050] Optionally, the step S102 of generating corresponding anti-quantum cryptographic parameters according to the anti-quantum requirements includes: determining the dimension of a lattice corresponding to the lattice difficulty problem according to the anti-quantum requirements; constructing a polynomial ring according to the dimension of the lattice; and performing a fast number theory transformation on the polynomial ring to determine the anti-quantum cryptographic parameters.
[0051] It can be understood that the dimension of the lattice corresponding to the lattice difficulty problem can be determined by anti-quantum requirements, the method corresponding to the lattice difficulty problem is the lattice cryptography method, and the fast number theory transformation can increase the complexity of the generated anti-quantum cryptography parameters in the embodiment of the present application. The main method of generating anti-quantum cryptography parameters in this application is through the lattice cryptography method and the polynomial ring method. Through the above technical solution, the security of anti-quantum cryptography can be maximized, and a variant lattice cryptography calculated using the NTT environment is realized, which optimizes the computing performance while ensuring the security of anti-quantum attacks.
[0052] Optionally, the step S106 of writing the received encrypted target file into the solid state drive includes: determining a first size relationship between the number of pages occupied by the encrypted target file and the target number; and defining two situations according to the first size relationship:
[0053] It can be understood that the target number can be 1. The purpose of the above steps is to determine whether the encrypted target file can be written through 1 page in the solid-state drive. The first size relationship between the number of pages occupied by the encrypted target file and the target number can be used to determine whether the decrypted target file is a large file or a small file. There are different methods for writing large files and small files into the solid-state drive.
[0054] (1) when the first size relationship indicates that the number of pages is greater than the target number, determining the file size of the encrypted target file, and writing the encrypted target file into the solid state drive according to a multiple relationship between the file size and the page size of the pages in the solid state drive;
[0055] Specific:
[0056] The encrypted target file is written into the solid-state drive according to the multiple relationship between the file size and the page size of the pages in the solid-state drive, including: when the multiple relationship indicates that the file size is an integer multiple of the page size, determining a first page set in the solid-state drive, and writing the encrypted target file into the first page set, wherein the pages in the first page set are pages in the solid-state drive where no data is written; when the multiple relationship indicates that the file size is not an integer multiple of the page size, calculating the remainder of the file size and the page size, and writing the encrypted target file into the solid-state drive according to the remainder.
[0057] It can be understood that, when the number of pages is greater than the target number, that is, when the number of pages is greater than 1, it can be determined that the encrypted target file is a large file.
[0058] For large files, the multiple relationship between the file size and the page size of the pages in the solid state drive can be determined, and then the encrypted target file is written to the solid state drive.
[0059] When it is determined that the file size is an integer multiple of the page size of the pages in the solid state drive, for example, the file size is 4 pages, the encrypted target file can be directly written into the blank page set in the solid state drive.
[0060] When it is determined that the file size is not an integer multiple of the page size of the pages in the SSD, for example, the file size is 4.8 pages, it is necessary to determine the remainder of the file size and the page size, that is, 0.8, and write the encrypted target file to the SSD based on the remainder.
[0061] Wherein, writing the encrypted target file into the solid-state drive according to the remainder includes: determining a second size relationship between the remainder and a first numerical value; when the second size relationship indicates that the remainder is greater than or equal to the first numerical value, determining a second page set in the solid-state drive, and writing the encrypted target file into the second page set, and when the encrypted target file is successfully written into the second page set, writing invalid data into a blank area of a page in the second page set, wherein the pages in the second page set are pages in the solid-state drive where no data is written; when the second size relationship indicates that the remainder is less than the first numerical value, determining a third size relationship between the remainder and the second numerical value, and writing the encrypted target file into the solid-state drive according to the third size relationship, wherein the second numerical value is less than the first numerical value.
[0062] Among them, writing the encrypted target file into the solid-state hard disk according to the third size relationship includes: adjusting the state of the solid-state hard disk from a write state to a write wait state, and determining a first write wait time of the write wait state according to the third size relationship; determining whether a first file is received within a first time period corresponding to the current time and the first write wait time, and writing the encrypted target file into the solid-state hard disk according to whether the first file is received.
[0063] Wherein, writing the encrypted target file into the solid-state drive according to whether the first file is received includes: in the case where the first file is received within the first time period, merging the first file with the encrypted target file, and writing the encrypted second file into the solid-state drive according to a multiple relationship between the file size of the merged second file and the page size of the pages in the solid-state drive; in the case where the first file is not received within the first time period, determining a third page set in the solid-state drive, and writing the encrypted target file into the third page set, and in the case where the encrypted target file is successfully written into the third page set, writing invalid data into a blank area of a page in the third page set, wherein the pages in the third page set are pages in the solid-state drive where no data is written.
[0064] Among them, the above-mentioned first value can be 0.8. When it is determined that the remainder is greater than or equal to 0.8, the encrypted target file can be directly written into the blank page set in the solid state drive, and invalid data can be written into the blank area in the blank page set.
[0065] When it is determined that the remainder is less than 0.8, it is necessary to determine the magnitude relationship between the remainder and the second value, and the second value may be 0.5.
[0066] The state of the solid state drive needs to be adjusted from the write state to the write wait state. When it is determined that the remainder is greater than 0.5, a write wait time can be determined, and when the remainder is less than or equal to 0.5, another write wait time can be determined. That is, different write wait times can be determined in the two cases of determining that the remainder is greater than the second value and determining that the remainder is less than or equal to the second value.
[0067] Further, it is determined whether the first file to be written to the target hard disk is received within the first time period between the current time and the write waiting time. If it is determined that the first file is received, the encrypted target file and the first file can be merged, and the encrypted second file can be written to the solid state drive according to the multiple relationship between the file size of the merged second file and the page size of the page in the solid state drive. If it is determined that the first file is not received, the first file can be written to a blank page set in the solid state drive, and invalid data can be written to the blank area.
[0068] (2) When the first size relationship indicates that the number of pages is equal to the target number, determine the file size, and write the encrypted target file into the solid state drive according to the ratio of the file size to the pages of the solid state drive. Specifically:
[0069] Writing the encrypted target file into the solid-state drive according to the proportion of the file size in the pages of the solid-state drive includes: determining a fourth size relationship between the proportion and a third numerical value; when the fourth size relationship indicates that the proportion is greater than or equal to the third numerical value, determining a fifth size relationship between the proportion and the fourth numerical value, and writing the encrypted target file into the solid-state drive according to the fifth size relationship, wherein the fourth numerical value is greater than the third numerical value; when the fourth size relationship indicates that the proportion is less than the third numerical value, determining a sixth size relationship between the proportion and the fifth numerical value, and writing the encrypted target file into the solid-state drive according to the sixth size relationship, wherein the fifth numerical value is less than the third numerical value.
[0070] Among them, writing the encrypted target file into the solid-state drive according to the fifth size relationship includes: when the fifth size relationship indicates that the proportion is greater than the fourth value, determining the first page in the solid-state drive and writing the encrypted target file in the first page, and when the encrypted target file is successfully written into the first page, writing invalid data in a blank area of the first page, wherein the first page is a page in the solid-state drive where no data is written.
[0071] Among them, writing the encrypted target file into the solid-state hard disk according to the fifth size relationship includes: when the fifth size relationship indicates that the proportion is less than or equal to the fourth value, adjusting the state of the solid-state hard disk from a write state to a write wait state, and determining a second write wait time of the write wait state according to the fifth size relationship; determining whether a third file is received within a second time period corresponding to the current time and the second write wait time, and writing the encrypted target file into the solid-state hard disk according to whether the third file is received.
[0072] Wherein, writing the encrypted target file into the solid-state drive according to whether the third file is received includes: if the third file is received within the second time period, merging the third file with the encrypted target file, and writing the encrypted fourth file into the solid-state drive according to the multiple relationship between the file size of the merged fourth file and the page size of the page in the solid-state drive; if the third file is not received within the second time period, determining the second page in the solid-state drive, and writing the encrypted target file into the second page, and if the encrypted target file is successfully written into the second page, writing invalid data into a blank area of the page in the second page, wherein the second page is a page in the solid-state drive where no data is written.
[0073] Wherein, writing the encrypted target file into the solid-state drive according to the sixth size relationship includes: adjusting the state of the solid-state drive from a write state to a write wait state, and determining a third write wait time of the write wait state according to the sixth size relationship; determining whether a fifth file is received within a third time period corresponding to the current time and the third write wait time; if the fifth file is received within the third time period, merging the fifth file with the encrypted target file, and writing the encrypted sixth file into the solid-state drive according to a multiple relationship between the file size of the merged sixth file and the page size of the page in the solid-state drive; if the fifth file is not received within the third time period, determining a third page in the solid-state drive, and writing the encrypted target file into the third page, and if the encrypted target file is successfully written into the third page, writing invalid data into a blank area of the page in the third page, wherein the third page is a page in the solid-state drive where no data is written.
[0074] According to the above technical solution, when the number of pages is equal to the target number, that is, when the number of pages is equal to 1, it can be determined that the encrypted target file is a small file. For small files, the ratio of the file size to the pages of the solid-state drive and the size relationship of the third value can be determined to write the encrypted target file to the solid-state drive. Among them, the third value can be 0.5, that is, it can be determined whether the target file occupies half of the pages in the solid-state drive.
[0075] When it is determined that the proportion is greater than or equal to 0.5, the size relationship between the proportion and the fourth value can be determined, and the fourth value can be 0.8. When it is determined that the proportion is greater than the fourth value, the encrypted target file can be written to a blank page in the solid-state hard disk, and invalid data can be written to the blank area of the blank page. When it is determined that the proportion is less than or equal to the fourth value, the state of the solid-state hard disk can be adjusted from the write state to the write wait state. Determine a write wait time, and determine whether a third file to be written to the solid-state hard disk is received in the second time period between the current time and the second write wait time. When it is determined that the third file is received, the encrypted target file and the third file can be merged, and the encrypted fourth file can be written to the solid-state hard disk according to the multiple relationship between the file size of the merged fourth file and the page size of the page in the solid-state hard disk. When it is determined that the third file is not received, the encrypted target file can be written to a blank page in the solid-state hard disk, and invalid data can be written to the blank area in the blank page.
[0076] When it is determined that the proportion is less than 0.5, the magnitude relationship between the proportion and the fifth value is determined, and the fifth value may be 0.2.
[0077] The state of the solid state drive is adjusted from the write state to the write wait state. When the ratio is greater than or equal to 0.2, a write wait time can be determined, and when the remainder is less than 0.2, another write wait time can be determined. That is, different write wait times can be determined in the two cases of determining that the remainder is greater than or equal to the fifth value and determining that the remainder is less than the fifth value.
[0078] Further, it is determined whether the fifth file to be written to the target hard disk is received within the third time period between the current time and the write waiting time. If it is determined that the fifth file is received, the encrypted target file and the fifth file can be merged, and the encrypted sixth file can be written into the solid state drive according to the multiple relationship between the file size of the merged sixth file and the page size of the page in the solid state drive. If it is determined that the fifth file is not received, the fifth file can be written into a blank page set in the solid state drive, and invalid data can be written into the blank area.
[0079] It can be seen from the above technical solution that by using different writing methods for large files and small files, the page efficiency of encrypted storage on the solid-state drive is optimized, the reading efficiency is improved, and the reading performance of the solid-state drive is improved.
[0080] Optionally, after writing the received encrypted target file into the solid-state hard disk in the above-mentioned step S106, the method further includes: upon receiving an authentication request from the client, receiving a signature file sent by the client, wherein the signature file is a file generated after the client signs a seventh file by using a client private key, and the authentication request is used to indicate that the client requests to perform a target operation on the encrypted target file; obtaining the client public key of the client, and verifying the signature file according to the client public key; if the signature file verification passes, decrypting the encrypted target file by using the server private key to generate the target file; comparing the target file with the signature file, and determining whether the client passes the authentication according to the first comparison result.
[0081] Wherein, determining whether the client has passed the authentication based on the first comparison result includes: when the first comparison result indicates that the target file and the signature file are consistent, determining that the client authentication is successful, and sending a first notification to the client so that the client performs the target operation on the encrypted target file, wherein the first notification is used to indicate that the client authentication is successful; when the first comparison result indicates that the target file and the signature file are inconsistent, determining that the client authentication has failed, and sending a second notification to the client to prohibit the client from performing the target operation on the encrypted target file, wherein the second notification is used to indicate that the client authentication has failed.
[0082] It is understandable that the above-mentioned target operation can be: modification, deletion, reading or search operations. After writing the encrypted target file to the SSD, the client can request to search, read or modify the encrypted target file in the SSD. The client can sign the seventh file by the client private key. The signed seventh file is the signature file. The signature file is verified by the client public key stored on the server. If the verification passes, it proves that the client has the right to access the SSD. At this time, the encrypted target file can be decrypted by the server private key, and then the signature file and the target file are compared. When the signature file is consistent with the target file, the client is allowed to perform the target operation on the encrypted target file; when the signature file is inconsistent with the target file, the client is prohibited from performing the target operation on the encrypted target file.
[0083] Through the above technical solution, the security against quantum attacks can be guaranteed. Furthermore, the encrypted target files can be deployed on the SSD side of the server to achieve quantum attack resistance for communication and authentication.
[0084] The method embodiments provided in the embodiments of the present application can also be applied to a client, such as a mobile terminal, a computer terminal or a similar computing device. Figure 2 1 is a hardware structure block diagram of a client of a method for writing an encrypted file according to an embodiment of the present application. Figure 2 As shown, a client (eg, a computer terminal) may include one or more ( Figure 2 Only one is shown in the figure) a processor 202 (the processor 202 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 204 for storing data, wherein the above-mentioned client may also include a transmission device 206 and an input / output device 208 for communication functions. It can be understood by those skilled in the art that Figure 2 The structure shown is only for illustration and does not limit the structure of the client. Figure 2 More or fewer components as shown, or with Figure 2 Different configurations shown.
[0085] The memory 204 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for writing encrypted files in the embodiment of the present application. The processor 202 executes various functional applications and data processing by running the computer program stored in the memory 204, that is, to implement the above method. The memory 204 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 instances, the memory 204 may further include a memory remotely arranged relative to the processor 202, and these remote memories may be connected to the client 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.
[0086] The transmission device 206 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the client. In one example, the transmission device 206 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 206 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0087] Figure 3 is a flowchart of a client of a method for writing an encrypted file according to an embodiment of the present application, wherein the client is used to send a target file to a server, and the server includes: a solid state drive, and the solid state drive is used to store the target file, such as Figure 1 As shown, the process includes the following steps:
[0088] Step S302, sending the anti-quantum requirement to the server, so that the server generates corresponding anti-quantum cryptographic parameters according to the anti-quantum requirement, generates a server-side public key according to the anti-quantum cryptographic parameters, and sends the server-side public key to the client;
[0089] Step S304, upon receiving the server public key, encrypt the target file according to the server public key, and send the encrypted target file to the server, so that the server writes the received encrypted target file into the solid state drive.
[0090] Through the writing method of the encrypted file of the present application, the anti-quantum requirement is sent to the server side, so that the server side generates the corresponding anti-quantum cryptographic parameters according to the anti-quantum requirement, and generates the server-side public key according to the anti-quantum cryptographic parameters, and sends the server-side public key to the client side; when the client receives the server-side public key, it can encrypt the target file according to the server-side public key, and send the encrypted target file to the server side, so that the server side writes the encrypted target file to the solid-state hard disk. In other words, the present application determines the anti-quantum cryptographic parameters according to the received anti-quantum requirement, and generates the server-side public key according to the anti-quantum cryptographic parameters, and uses the security of the anti-quantum cryptography to ensure the security of the server-side public key; at the same time, the client of the present application encrypts the target file through the server-side public key to ensure the security of the encrypted target file in the solid-state hard disk. Through the above technical solution, the problem that the target file is encrypted by the traditional encryption method in the related technology and cannot cope with the threat of quantum computers, resulting in the target file being cracked by the quantum computer before the decryption period is solved. It is ensured that the quantum computer cannot crack the target file during the undecryption period of the target file, thereby improving the security of the target file.
[0091] Optionally, before sending the encrypted target file to the server in the above step S304, the method also includes: extracting keywords of the target file when receiving the public key of the server; converting the keywords into hash values according to a hash algorithm; and sending the hash values to the server, so that the server establishes a label for the encrypted target file according to the hash value.
[0092] It is understandable that, when receiving the server-side public key, the keyword of the target file can be extracted, and then the keyword can be converted into a hash value. After sending the hash value to the server-side, the server-side can create a label of the encrypted target file based on the hash value, and the label can be used as a search index for the encrypted target file. For example, the label of the encrypted target file can be created based on the last five digits of the hash value.
[0093] According to the above technical solution, the reading efficiency of the encrypted target file in the SSD can be improved.
[0094] Optionally, after sending the anti-quantum requirement to the server in the above step S302, the method further includes: upon receiving the anti-quantum cryptographic parameters sent by the server, generating a client public key according to the anti-quantum cryptographic parameters, and sending the client public key to the server, so that the server stores the client public key.
[0095] Optionally, after sending the encrypted target file to the server in the above step S304, the method further includes: sending an authentication request to the server, wherein the authentication request is used to instruct the client to request to perform a target operation on the encrypted target file; when it is determined that the server has received the authentication request, sending a signature file to the server, so that the server verifies the signature file according to the client public key, and when the signature file is verified, decrypting the encrypted target file by using the server private key to generate the target file, comparing the target file with the signature file, and determining whether the client passes the authentication based on the first comparison result, wherein the signature file is a file generated after the client signs the seventh file by using the client private key.
[0096] In order to better understand the process of the above-mentioned encrypted file writing method, the implementation process of the above-mentioned encrypted file writing method is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.
[0097] In related technologies, with the rapid development of cloud services, cloud services provide convenient and cost-effective solutions in storage, computing and data processing. However, with the continuous increase in the amount of data stored in the cloud, data security and privacy protection have become key issues. For cloud servers, to ensure the long-term security of future data, sensitive information that needs long-term protection must be prepared in advance; to prevent unauthorized parties from backing up highly confidential encrypted data first, and then decrypting highly sensitive data before the decryption period after the quantum computer is available.
[0098] In addition, cryptographic protocols based on cloud services are developing rapidly, such as Searchable Symmetric Encryption (SSE) and Fully Homomorphic Encryption (FHE). These protocols support clients to encrypt data locally and then upload the encrypted data to the cloud server, thereby ensuring that only the client can decrypt the data, and support searching and computing operations on the encrypted data. However, encrypting important data through multiple encryption schemes such as SSE and FHE may lead to low page efficiency of SSD storage and low writing and reading performance of ciphertext on SSD.
[0099] In response to the above problems, an optional embodiment of the present application proposes a method and device for optimizing the secure storage performance of a solid-state disk that is resistant to quantum attacks. Through the optional embodiment of the present application, the problem of highly confidential files being cracked by quantum computers before the decryption period in the related technology can be solved, as well as the problem of low page efficiency of SSD storage and low writing and reading performance of ciphertext on the SSD caused by encrypting important data in the related technology. The risk of highly confidential files being cracked by quantum computers before the decryption period is avoided, and the page efficiency of SSD storage is optimized, so that the writing and reading performance of ciphertext on the SSD is optimized.
[0100] Figure 4 is a flow chart of a method for optimizing the secure storage performance of a solid-state disk that is resistant to quantum attacks according to an optional embodiment of the present application. Figure 5 This is an overall architecture diagram of a method for optimizing the secure storage performance of a solid-state disk that is resistant to quantum attacks according to an optional embodiment of the present application. Figure 6 is a device structure diagram of a method for optimizing the secure storage performance of a solid-state disk against quantum attacks according to an optional embodiment of the present application, wherein: Figure 6 The information interaction between the cloud server and the solid state drive is defined. It is understandable that in some embodiments, the information interaction between the cloud server and the server (the server may include Figure 6 The external components in the interconnection expansion bus SSD, namely the controller and flash memory) exchange information (ie, the present application Figure 6 ), and in some embodiments, information interaction can be performed directly between the server and the client, such as Figure 4 As shown:
[0101] Step S401, system initialization operation.
[0102] like Figure 5 , Figure 6As shown, the client initiates an anti-quantum security requirement to the server and indicates the security level requirement. After receiving the anti-quantum security requirement, the server forwards the anti-quantum security requirement to the module for generating parameters supporting NTT anti-quantum cryptography. The module for generating parameters supporting NTT anti-quantum cryptography generates the corresponding parameters supporting NTT anti-quantum cryptography (i.e., the anti-quantum cryptography parameters of this application), and returns the corresponding parameters supporting NTT anti-quantum cryptography to the client.
[0103] Specific:
[0104] The security of lattice cryptography based on the lattice problem depends on the solution and reduction of the lattice problem. The difficulty of lattice cryptography is linearly related to the dimension. Assuming the dimension (also called the number of dimensions) is n (that is, the dimension of the lattice in this application), if the heuristic deduction with the lowest complexity is adopted, the time complexity of the attack on the lattice cryptography is at least about The above can threaten the security of the lattice password. However, the larger the dimension n is, the more it may affect the operating efficiency of the password module, so the server and the client need to establish a protocol dialogue. The server will classify the security according to the importance of the content of the protocol session, and then adopt different parameter versions.
[0105] To ensure security, the attack complexity must be at least , that is, security at least satisfies For higher confidentiality, n can be increased based on security choices. In addition, to ensure security requirements and avoid subdomain attacks, integers in passwords are required. , and in order to facilitate NTT operations, it is required that there must be a primitive root under the module q, and further that q is required to be a prime number.
[0106] NTRU (a lattice cipher based on a lattice problem) is a lattice cipher based on a lattice problem, implemented through an operation based on a polynomial ring, where q is the modulus of the polynomial coefficients, and the polynomial ring is generally n is the dimension of NTRU. In the NTRU operation, the polynomial multiplication of the polynomial ring accounts for the largest proportion of the operation, while the NTT operation (i.e., the fast number theory transformation of this application) is a fast multiplication with increased complexity. The operation complexity of normal multiplication is , and the complexity of NTT fast multiplication is In order to create a NTRU parameter version suitable for the NTT environment, the optional embodiment of the present application proposes a general polynomial ring that is convenient for calculation in the NTT environment. (i.e., the polynomial ring of this application) construction method.
[0107] Figure 7 is a polynomial ring for NTT computing environment according to an optional embodiment of the present application And the schematic diagram of splitting isomorphism under polynomial ring, such as Figure 7 As shown:
[0108] The restriction on n is required to be: , where z is a positive integer. n can be expanded as: , where a is a positive integer and b is a prime number or 1. Take a positive integer m and ask for the Euler function of m , and m is a positive integer multiple of b.
[0109] Polynomial expansion that favors NTT environments:
[0110] Must exist yes The root, therefore, It is the unit element Root.
[0111] .
[0112] Where j is a positive integer, represents a positive integer j that is less than m and relatively prime to m The product of, if b=1, then c is 0; if B≠1, then c is 1.
[0113] pass , we can get , and then we can get a polynomial ring.
[0114] in, The process steps for obtaining a polynomial ring.
[0115] Further, there are:
[0116] .
[0117] in, , is the root of the identity element, yes to the power of 2b-1.
[0118] The above formula can then be expanded into a polynomial, and the NTT expansion requirement must be met during the polynomial expansion process.
[0119] Since q is prime, there exists a primitive root g, since , so .therefore, The nth root of unity is in the range of integers modulo q. ,Right now ,Right now It satisfies the conditions ,therefore, In NTT operation Since there are multiple primitive roots g, we can compare and select from multiple roots and try to select A number for convenience of calculation.
[0120] Through the above analysis, we can determine the polynomial ring that is convenient for the NTT computing environment And the specific process of splitting isomorphism under polynomial rings, such as Figure 7 As shown:
[0121] Figure 7 of Used to indicate the constant term modulo q polynomial modulo Polynomials in domain space.
[0122] You can Convert to constant term modulo q polynomial modulo A polynomial and constant term modulo q in the domain space modulo A polynomial unique expression in the domain space. (i.e. Figure 7 of and ).
[0123] By analogy, we can get Figure 7 The third floor, the fourth floor, …
[0124] In a specific embodiment, the polynomial ring convenient for the NTT computing environment can be And the steps of splitting isomorphism under the polynomial ring are converted into computer language, and then the parameters that meet different security requirements (i.e., the quantum-resistant cryptographic parameters of this application) are quickly found through computer language.
[0125] Step S402: Authentication preparation operation.
[0126] like Figure 5 , Figure 6 As shown, the client broadcasts the client public key supporting NTT parameter anti-quantum cryptography to the server. After the server confirms that it has obtained the client public key, it returns a confirmation signal to the client and broadcasts the server-side SSD public key supporting NTT parameter anti-quantum cryptography to the client (that is, the server-side public key of this application, that is, Figure 5 The public key of NTT parameter quantum-resistant cryptography is supported on the cloud server solid-state drive in the . Specifically:
[0127] Key generation: random selection , the required coefficient .
[0128] Furthermore, ,Right now . You can generate new NTT: beg The inverse of the following, for and , . From this, the public key can be generated: Both the client public key and the server public key can be generated using the above method.
[0129] Among them, mod q stands for modulus q, which refers to the remainder within q, and p is the constant term coefficient.
[0130] The above variant cipher uses a polynomial ring that is beneficial to the NTT computing environment. While ensuring security and having the ability to resist quantum computer attacks, the calculation speed of the lattice password is improved. Important data on the solid-state drive is protected against quantum attacks.
[0131] Step S403, the encrypted file (i.e., the encrypted target file of the present application) is uploaded to the cloud server (the existence of the cloud server is limited in the optional embodiment of the present application, and in a specific embodiment, the encrypted file can also be uploaded to the server side, and the following cloud servers can all be server sides).
[0132] like Figure 5 , Figure 6 As shown, the client encrypts the user tag and file information with the public key of the solid-state hard disk on the cloud server, and sends the encrypted file (i.e., the encrypted target file of this application, i.e. Figure 5 , Figure 6 The encrypted files in the file) and the index corresponding to each encrypted file are sent to the cloud server through the external component interconnection expansion bus (i.e. PCle) (subsequent information interaction between the cloud server and the solid-state drive can be done through PCle), and the user identification and file information corresponding to the file are encrypted with the server-side SSD public key as the authentication credential. Specifically:
[0133] Figure 8 is a schematic diagram of encrypting a data file for building a search index according to an optional embodiment of the present application, such as Figure 8 As shown:
[0134] The client encrypts the data file (i.e., the target file of this application) and sends the encrypted file to the cloud server for storage. Specifically, the cloud server can broadcast the public key information of the cloud server to the client, and the client encrypts the user ID and file information with the public key of the cloud server and sends it to the cloud server as a credential for subsequent authentication.
[0135] At the same time, a search index is built and bound to the encrypted file. The search index is not directly exposed and sent to the cloud server, but is sent to the cloud server after being hashed.
[0136] The steps of building a search index are as follows: the client extracts keywords, generates a hash of the extracted keywords through a hash algorithm, and then sends the hash of the keyword to the cloud server, so that the cloud server can extract (i.e. Figure 8 The last 5 digits of the hash are extracted (the last 5 digits are only examples of optional embodiments of the present application and can be changed in specific embodiments), and multiple index tables are established according to the last 5 digits of the hash (i.e. Figure 8 The encrypted files are stored in categories.
[0137] The cloud server takes the last five digits of the hash value as a label and establishes multiple index tables to classify and store encrypted files, which can improve search efficiency.
[0138] Among them, the process of encrypting the data file can be achieved through a polynomial ring: For the message polynomial, randomly choose a random small polynomial ,conduct , . The ciphertext can be generated: .
[0139] After the search index is established, the stored encrypted information can be searched based on the search index. Fig. 9 is a schematic diagram of searching for stored encrypted information according to a search index according to an optional embodiment of the present application, such as Fig. 9 As shown:
[0140] The client generates a query and sends the query keyword information to the cloud server after passing it through a hash function. The cloud server first extracts the last five digits of the hash value of the keyword information, searches the index table corresponding to the last five digits of the hash value, and then finds the corresponding matching user ID and file information in the index table.
[0141] To avoid errors in receiving file information, the cloud server can choose to decrypt the credential information (i.e., the decrypted target file of this application) and compare it with the stored file information to see if it is consistent; if not, the client is required to resend it until the file information is consistent.
[0142] The decryption process can be implemented through a polynomial ring: ,and then , we can conclude .
[0143] Step S404: cloud server storage.
[0144] like Figure 5 , Figure 6 As shown in the figure, when the cloud server stores the encrypted file, it goes through the write wait decision tree module for storage optimization. Furthermore, the client can obtain the permission to search or change the encrypted file, encrypt (user label, file information) with the client private key, and send the encrypted information to the server to initiate a read request. Specifically, the process of storage optimization by the write wait decision tree module is as follows:
[0145] The read and write performance on SSD depends on the page efficiency on SSD, which is also an important indicator for predicting throughput. Page efficiency is defined as the number of pages that the cloud server must access when processing a query divided by the number of pages of the query answer. For SSD storage, SSD storage can be regarded as a page array. When searching for index w, the read pattern will induce a large number of page accesses. We define the required page access as PgRd. The page cost of storing the corresponding data is defined as (p1, ...,). If |PgRd|≤P(p1, ...,), then the page efficiency is determined as P. Ideally, an encrypted file just stores an integer multiple of pages. However, in reality, the ideal situation is difficult to achieve. Generally, in order to maximize the use of storage space, if the current encrypted file is not full of pages, the next encrypted file will continue to write to the current unfull page, which will cause a decrease in read performance.
[0146] In order to solve the above-mentioned problem of low reading performance, an optional embodiment of the present application optimizes the storage of encrypted files by waiting for the decision tree module, specifically:
[0147] First, determine whether the file size exceeds the page size. If it does not exceed the page size, enter Fig.10 If the page size is exceeded, the decision tree will be entered. Fig.11 Schematic diagram of the decision tree in .
[0148] (1) If Fig.10 As shown:
[0149] Determine whether the file capacity (i.e., the proportion of this application) is less than 50% of the page (i.e., the third value of this application). If it is less than 50% of the page, further determine whether the file capacity is less than 20% of the page (i.e., the fifth value of this application); if it is greater than 50% of the page, further determine whether the file capacity is greater than 80% of the page (i.e., the fourth value of this application).
[0150] If it is determined that the page capacity is less than 20% of the page, the write wait state is entered, and the write wait time is determined to be t3. If it is determined that the page capacity is greater than or equal to 20% of the page, the write wait state is entered, and the write wait time is determined to be t4 (t3 and t4 are the third write wait time of this application). It is further determined whether there is a new file before t3 and t4 (i.e., the fifth file of this application, i.e., Figure 1 In the case where it is determined that there are new files to be written, the new files are packaged together with the above files and written to the SSD. In the case where it is determined that there are no new files to be written, writing starts from a new page (i.e., the third page of this application), and invalid data is filled in the subsequent fields of the page.
[0151] When it is determined that the page capacity is greater than 80% of the page, writing starts from a new page (ie, the first page of this application), and invalid data is filled in subsequent fields of the page.
[0152] If it is determined that the page capacity is less than or equal to 80% of the page, enter the write waiting state, and determine the write waiting time as t2 (t2 is the second write waiting time of this application). Further determine whether there is a new file (i.e., the third file of this application) to be written into the SSD before t2. If it is determined that there is a new file to be written, the new file is packaged together with the above files and written into the SSD. If it is determined that there is no new file to be written, start writing from the new page (i.e., the second page of this application), and fill invalid data in the subsequent fields of the page.
[0153] (2) If Fig.11 As shown:
[0154] exist Fig.11 First, determine whether the page capacity is an integer multiple of the page (ie, the page size of this application).
[0155] When the page capacity is an integer multiple of the page size, writing starts directly from the new page (i.e., the first page set of this application);
[0156] In the case where the page capacity is not an integer multiple of the page size, determine whether the page capacity exceeds (N+0.8) times the page (i.e., the second size relationship between the remainder of the file size of the present application and the page size and the first value), where N is a positive integer. In the case where it exceeds (N+0.8) times the page, write starts from a new page (i.e., the second page set of the present application), and fills invalid data in subsequent fields of the page.
[0157] If it does not exceed (N+0.8) times of the page, determine whether the page capacity exceeds (N+0.5) times of the page (0.5 is the second value of this application). If it exceeds (N+0.5) times of the page, enter the write waiting state, and determine the write waiting time as t5. If it does not exceed (N+0.5) times of the page, enter the write waiting state, and determine the write waiting time as t6 (t5 and t6 are the first write waiting time of this application). Further determine whether there is a new file (i.e., the first file of this application) to be written to the SSD before t5 and t6. If it is determined that there is a new file to be written, package the new file and the above files together and write them to the SSD. If it is determined that there is no new file to be written, start writing from the new page (i.e., the third page set of this application), and fill invalid data in the subsequent fields of the page.
[0158] Through the above step S404, two decision trees are made for large files and small files respectively to round up pages, thereby optimizing the reading performance of the solid state drive.
[0159] Step S405: the client and the server perform authentication to obtain the encrypted file operation authority.
[0160] like Figure 5 , Figure 6 As shown, the server can query the authentication license of the quantum-resistant cryptographic module of the solid-state drive to query the flash memory through the quantum-resistant cryptographic module to see whether there is a file required by the client. Figure 6 The anti-quantum cryptographic module in the client reads the file and decrypts the file. Then, a comparison and authentication is performed between the client and the SSD on the server (it can be understood that the SSD may exist in the above-mentioned server or in another server, and the above-mentioned server controls the other server). Only when the authentication is successful will the file operation permission be opened and the client can operate the encrypted file.
[0161] Specifically, if the client wants to search, change or delete encrypted files, it needs to obtain authentication. For authentication, both parties use a variant of quantum-resistant cryptography that is beneficial to the NTT environment as a public key cryptography. The client broadcasts the client's public key information to the cloud server, and the cloud server broadcasts the cloud server's public key information to the client. The client encrypts the same user ID and file information with the cloud server's own server-side SSD public key and sends it to the cloud server. The cloud server stores the encrypted information in the flash memory space of the SSD, waiting for the client to initiate an authentication request.
[0162] The client initiates an authentication request. The client signs the user ID and file information with its own private key (i.e., the signature file of this application) and sends it to the cloud server. The cloud server calls the quantum-resistant cryptographic module to decrypt the previously stored authentication credentials with the cloud server's own server-side private key. The cloud server calls the quantum-resistant cryptographic module to verify the information sent by the client (i.e., the signature file of this application) with the client's client public key. It determines whether the information is consistent. If it is consistent, the authentication is passed, and the client obtains the permission to search, change, or delete encrypted files; if it is inconsistent, the authentication cannot pass. After passing the verification, the client can Fig. 9 The method in reads the encrypted file according to the search index and then performs various operations.
[0163] The optional embodiment of the present application provides a method for optimizing the secure storage performance of a quantum-resistant solid-state disk. In order to maximize the security of quantum-resistant cryptography, a general polynomial ring that is convenient for NTT environment calculation is used. The construction method is applied to NTRU, and a variant lattice cipher is implemented using NTT environment calculation. While ensuring the security against quantum attacks, the computing performance is optimized; it is deployed on the SSD side of the server to achieve quantum attack resistance for communication and authentication. The optional embodiment of the present application also provides a page optimization decision tree for ciphertext storage on SSD, which maximizes page efficiency and improves ciphertext reading performance on SSD.
[0164] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0165] In this embodiment, a system for writing encrypted files is also provided, which is used to implement the above embodiments and preferred implementations, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for 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 conceivable.
[0166] Fig.12 is a structural block diagram of a system for writing encrypted files according to an embodiment of the present application, such as Fig.12 As shown, the system includes:
[0167] The server 122 is used to generate corresponding quantum-resistant cryptographic parameters according to the quantum-resistant cryptographic parameters when receiving the quantum-resistant requirements sent by the client; generate a server-side public key according to the quantum-resistant cryptographic parameters, and send the server-side public key to the client, so that the client encrypts the target file according to the server-side public key, and sends the encrypted target file to the server; write the received encrypted target file into the solid-state hard disk;
[0168] The client 124 is used to send the anti-quantum requirement to the server, so that the server generates the anti-quantum cryptographic parameters according to the anti-quantum requirement, generates the server public key according to the anti-quantum cryptographic parameters, and sends the server public key to the client; when receiving the server public key, encrypt the target file according to the server public key, and send the encrypted target file to the server, so that the server writes the received encrypted target file into the solid-state drive.
[0169] Through the writing system of the encrypted file of the present application, when the anti-quantum requirement sent by the client is received, the corresponding anti-quantum cryptographic parameters are generated according to the anti-quantum requirement, the server-side public key is generated according to the anti-quantum cryptographic parameters, and the server-side public key is sent to the client, so that the client encrypts the target file according to the server-side public key, generates the encrypted target file, and sends the encrypted target file to the server; the server writes the received encrypted target file into the solid-state hard disk. In other words, the present application determines the anti-quantum cryptographic parameters according to the received anti-quantum requirement, and generates the server-side public key according to the anti-quantum cryptographic parameters, and uses the security of the anti-quantum cryptography to ensure the security of the server-side public key; at the same time, the client of the present application encrypts the target file through the server-side public key to ensure the security of the encrypted target file in the solid-state hard disk. Through the above technical solution, the problem that the target file cannot be cracked by the quantum computer in the undecrypted period by encrypting the target file by the traditional encryption method in the related technology is solved. It is ensured that the quantum computer cannot crack the target file in the undecrypted period of the target file, and the security of the target file is improved.
[0170] In an exemplary embodiment, the server end 122 is further used to determine the dimension of the lattice corresponding to the lattice difficulty problem according to the anti-quantum requirement; construct a polynomial ring according to the dimension of the lattice; and perform fast number theory transformation on the polynomial ring to determine the anti-quantum cryptographic parameters.
[0171] In an exemplary embodiment, the server end 122 is also used to determine a first size relationship between the number of pages occupied by the encrypted target file and a target number; when the first size relationship indicates that the number of pages is greater than the target number, determine the file size of the encrypted target file, and write the encrypted target file to the solid-state drive based on a multiple relationship between the file size and the page size of the pages in the solid-state drive; when the first size relationship indicates that the number of pages is equal to the target number, determine the file size, and write the encrypted target file to the solid-state drive based on the proportion of the file size in the pages of the solid-state drive.
[0172] In an exemplary embodiment, the server end 122 is also used to determine a first page set in the solid-state drive and write the encrypted target file into the first page set when the multiple relationship indicates that the file size is an integer multiple of the page size, wherein the pages in the first page set are pages in the solid-state drive where no data is written; and to calculate a remainder between the file size and the page size when the multiple relationship indicates that the file size is not an integer multiple of the page size, and write the encrypted target file into the solid-state drive according to the remainder.
[0173] In an exemplary embodiment, the server end 122 is also used to determine a second size relationship between the remainder and the first numerical value; when the second size relationship indicates that the remainder is greater than or equal to the first numerical value, determine a second page set in the solid state drive, and write the encrypted target file in the second page set, and when the encrypted target file is successfully written to the second page set, write invalid data in a blank area of the page in the second page set, wherein the page in the second page set is a page in the solid state drive to which no data is written; when the second size relationship indicates that the remainder is less than the first numerical value, determine a third size relationship between the remainder and the second numerical value, and write the encrypted target file to the solid state drive according to the third size relationship, wherein the second numerical value is less than the first numerical value.
[0174] In an exemplary embodiment, the server end 122 is also used to adjust the state of the solid-state hard disk from a write state to a write wait state, and determine a first write wait time of the write wait state based on the third size relationship; determine whether a first file is received within a first time period corresponding to the current time and the first write wait time, and write the encrypted target file to the solid-state hard disk based on whether the first file is received.
[0175] In an exemplary embodiment, the server end 122 is also used to merge the first file with the encrypted target file when the first file is received within the first time period, and write the encrypted second file into the solid-state drive according to a multiple relationship between the file size of the merged second file and the page size of the pages in the solid-state drive; if the first file is not received within the first time period, determine a third page set in the solid-state drive, and write the encrypted target file into the third page set, and if the encrypted target file is successfully written into the third page set, write invalid data into a blank area of the page in the third page set, wherein the pages in the third page set are pages in the solid-state drive where no data is written.
[0176] In an exemplary embodiment, the server end 122 is also used to determine a fourth size relationship between the proportion and a third numerical value; when the fourth size relationship indicates that the proportion is greater than or equal to the third numerical value, determine a fifth size relationship between the proportion and the fourth numerical value, and write the encrypted target file to the solid-state drive according to the fifth size relationship, wherein the fourth numerical value is greater than the third numerical value; when the fourth size relationship indicates that the proportion is less than the third numerical value, determine a sixth size relationship between the proportion and the fifth numerical value, and write the encrypted target file to the solid-state drive according to the sixth size relationship, wherein the fifth numerical value is less than the third numerical value.
[0177] In an exemplary embodiment, the server end 122 is also used to determine the first page in the solid-state drive and write the encrypted target file in the first page when the fifth size relationship indicates that the proportion is greater than the fourth value, and to write invalid data in a blank area of the first page when the encrypted target file is successfully written to the first page, wherein the first page is a page in the solid-state drive on which no data is written.
[0178] In an exemplary embodiment, the server end 122 is also used to adjust the state of the solid-state hard disk from a write state to a write wait state when the fifth size relationship indicates that the proportion is less than or equal to the fourth value, and determine a second write wait time of the write wait state according to the fifth size relationship; determine whether a third file is received within a second time period corresponding to the current time and the second write wait time, and write the encrypted target file to the solid-state hard disk according to whether the third file is received.
[0179] In an exemplary embodiment, the server end 122 is also used to merge the third file with the encrypted target file when the third file is received within the second time period, and write the encrypted fourth file into the solid-state drive according to a multiple relationship between the file size of the merged fourth file and the page size of the page in the solid-state drive; when the third file is not received within the second time period, determine the second page in the solid-state drive and write the encrypted target file into the second page, and when the encrypted target file is successfully written into the second page, write invalid data into a blank area of the page in the second page, wherein the second page is a page in the solid-state drive where no data is written.
[0180] In an exemplary embodiment, the server end 122 is also used to adjust the state of the solid-state hard disk from a write state to a write wait state, and determine a third write wait time of the write wait state according to the sixth size relationship; determine whether a fifth file is received within a third time period corresponding to the current time and the third write wait time; if the fifth file is received within the third time period, merge the fifth file with the encrypted target file, and write the encrypted sixth file to the solid-state hard disk according to a multiple relationship between the file size of the merged sixth file and the page size of the page in the solid-state hard disk; if the fifth file is not received within the third time period, determine the third page in the solid-state hard disk, write the encrypted target file in the third page, and if the encrypted target file is successfully written to the third page, write invalid data in a blank area of the page in the third page, wherein the third page is a page in the solid-state hard disk where no data is written.
[0181] In an exemplary embodiment, the server 122 is also used to receive a signature file sent by the client upon receiving an authentication request from the client, wherein the signature file is a file generated after the client signs a seventh file through a client private key, and the authentication request is used to instruct the client to request to perform a target operation on the encrypted target file; obtain the client public key of the client, and verify the signature file based on the client public key; if the signature file verification is successful, decrypt the encrypted target file through the server private key to generate the target file; compare the target file and the signature file, and determine whether the client has passed the authentication based on the first comparison result.
[0182] In an exemplary embodiment, the server end 122 is also used to determine that the client authentication is successful when the first comparison result indicates that the target file and the signature file are consistent, and send a first notification to the client to enable the client to perform the target operation on the encrypted target file, wherein the first notification is used to indicate that the client authentication is successful; when the first comparison result indicates that the target file and the signature file are inconsistent, determine that the client authentication has failed, and send a second notification to the client to prohibit the client from performing the target operation on the encrypted target file, wherein the second notification is used to indicate that the client authentication has failed.
[0183] In an exemplary embodiment, the client 124 is also used to extract keywords of the target file upon receiving the server public key; convert the keywords into hash values according to a hash algorithm; and send the hash values to the server so that the server establishes a label for the encrypted target file according to the hash values.
[0184] In an exemplary embodiment, the client 124 is further configured to, upon receiving the quantum-resistant cryptographic parameters sent by the server, generate a client public key according to the quantum-resistant cryptographic parameters, and send the client public key to the server so that the server stores the client public key.
[0185] In an exemplary embodiment, the client 124 is also used to send an authentication request to the server, wherein the authentication request is used to instruct the client to request to perform a target operation on the encrypted target file; when it is determined that the server has received the authentication request, a signature file is sent to the server so that the server verifies the signature file according to the client public key, and when the signature file is verified, the encrypted target file is decrypted by the server private key to generate the target file, the target file is compared with the signature file, and it is determined whether the client passes the authentication based on the first comparison result, wherein the signature file is a file generated after the client signs the seventh file by the client private key.
[0186] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.
[0187] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0188] An embodiment of the present application further provides an electronic device, 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 the above method embodiment.
[0189] In an exemplary embodiment, the electronic 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.
[0190] An embodiment of the present application further provides a computer program product, including a computer program, which is implemented to perform the steps in the above method embodiment when executed by a processor.
[0191] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0192] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0193] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for writing an encrypted file, characterized in that: include: The method for writing an encrypted file is applied to a server side, wherein the server side includes: a solid state hard disk, and the solid state hard disk is used to store a target file sent by a client, wherein: Upon receiving the quantum resistance requirement sent by the client, generating corresponding quantum resistance cryptographic parameters according to the quantum resistance requirement; Generate a server-side public key according to the quantum-resistant cryptographic parameters, and send the server-side public key to the client, so that the client encrypts the target file according to the server-side public key, and sends the encrypted target file to the server; Writing the received encrypted target file into the solid state drive; Wherein, writing the received encrypted target file into the solid state drive includes: Determine a first size relationship between the number of pages occupied by the encrypted target file and the target number; In a case where the first size relationship indicates that the number of pages is greater than the target number, determining a file size of the encrypted target file, and writing the encrypted target file into the solid-state drive according to a multiple relationship between the file size and a page size of pages in the solid-state drive; In a case where the first size relationship indicates that the number of pages is equal to the target number, determining the file size, and writing the encrypted target file into the solid-state drive according to the proportion of the file size to the pages of the solid-state drive; Wherein, writing the encrypted target file into the solid state drive according to a multiple relationship between the file size and the page size of the page in the solid state drive comprises: In a case where the multiple relationship indicates that the file size is an integer multiple of the page size, determining a first page set in the solid state drive, and writing the encrypted target file into the first page set, wherein the pages in the first page set are pages in the solid state drive where no data is written; When the multiple relationship indicates that the file size is not an integer multiple of the page size, a remainder of the file size and the page size is calculated, and the encrypted target file is written to the solid state drive according to the remainder.
2. The method according to claim 1, characterized in that Generate corresponding anti-quantum cryptographic parameters according to the anti-quantum requirements, including: Determining the dimension of the lattice corresponding to the lattice difficulty problem according to the quantum resistance requirement; constructing a polynomial ring according to the dimension of the lattice; A fast number theory transformation is performed on the polynomial ring to determine the quantum-resistant cryptographic parameters.
3. The method according to claim 1, characterized in that Writing the encrypted target file into the solid state drive according to the remainder includes: Determine a second magnitude relationship between the remainder and the first value; In the case where the second size relationship indicates that the remainder is greater than or equal to the first value, determining a second page set in the solid state drive, and writing the encrypted target file in the second page set, and in the case where the encrypted target file is successfully written into the second page set, writing invalid data into a blank area of a page in the second page set, wherein the pages in the second page set are pages in the solid state drive where no data is written; When the second size relationship indicates that the remainder is smaller than the first value, a third size relationship between the remainder and the second value is determined, and the encrypted target file is written to the solid-state drive according to the third size relationship, wherein the second value is smaller than the first value.
4. The method according to claim 3, characterized in that Writing the encrypted target file into the solid state drive according to the third size relationship includes: Adjusting the state of the solid state hard disk from a write state to a write wait state, and determining a first write wait time of the write wait state according to the third size relationship; Determine whether a first file is received within a first time period corresponding to the current time and the first write waiting time, and write the encrypted target file into the solid state drive according to whether the first file is received.
5. The method according to claim 4, characterized in that Writing the encrypted target file into the solid state drive according to whether the first file is received includes: When the first file is received within the first time period, merging the first file with the encrypted target file, and writing the encrypted second file into the solid state drive according to a multiple relationship between a file size of the merged second file and a page size of a page in the solid state drive; If the first file is not received within the first time period, a third page set in the solid state drive is determined, and the encrypted target file is written into the third page set, and if the encrypted target file is successfully written into the third page set, invalid data is written into a blank area of a page in the third page set, wherein the pages in the third page set are pages in the solid state drive on which no data is written.
6. The method according to claim 1, characterized in that Writing the encrypted target file into the solid state drive according to the proportion of the file size to the pages of the solid state drive includes: Determining a fourth magnitude relationship between the proportion and the third value; In the case where the fourth size relationship indicates that the proportion is greater than or equal to the third value, determining a fifth size relationship between the proportion and the fourth value, and writing the encrypted target file into the solid-state drive according to the fifth size relationship, wherein the fourth value is greater than the third value; When the fourth size relationship indicates that the proportion is smaller than the third value, a sixth size relationship between the proportion and the fifth value is determined, and the encrypted target file is written to the solid-state drive according to the sixth size relationship, wherein the fifth value is smaller than the third value.
7. The method according to claim 6, characterized in that Writing the encrypted target file into the solid state drive according to the fifth size relationship includes: When the fifth size relationship indicates that the proportion is greater than the fourth value, the first page in the solid-state drive is determined, and the encrypted target file is written in the first page, and when the encrypted target file is successfully written to the first page, invalid data is written in a blank area of the first page, wherein the first page is a page in the solid-state drive on which no data is written.
8. The method according to claim 6, characterized in that Writing the encrypted target file into the solid state drive according to the fifth size relationship includes: When the fifth size relationship indicates that the proportion is less than or equal to the fourth value, adjusting the state of the solid-state hard disk from the write state to the write wait state, and determining a second write wait time of the write wait state according to the fifth size relationship; Determine whether a third file is received within a second time period corresponding to the current time and the second write waiting time, and write the encrypted target file into the solid state drive according to whether the third file is received.
9. The method according to claim 8, characterized in that Writing the encrypted target file into the solid state drive according to whether the third file is received includes: When the third file is received within the second time period, the third file is merged with the encrypted target file, and the encrypted fourth file is written into the solid state drive according to a multiple relationship between a file size of the merged fourth file and a page size of a page in the solid state drive; If the third file is not received within the second time period, determine the second page in the solid state drive and write the encrypted target file in the second page, and if the encrypted target file is successfully written to the second page, write invalid data in a blank area of the page in the second page, wherein the second page is a page in the solid state drive where no data is written.
10. The method according to claim 6, characterized in that Writing the encrypted target file into the solid state drive according to the sixth size relationship includes: Adjusting the state of the solid state hard disk from the write state to the write wait state, and determining a third write wait time of the write wait state according to the sixth size relationship; determining whether a fifth file is received within a third time period corresponding to the current time and the third write waiting time; In the case where the fifth file is received within the third time period, merging the fifth file with the encrypted target file, and writing the encrypted sixth file into the solid state drive according to a multiple relationship between a file size of the merged sixth file and a page size of a page in the solid state drive; In the case where the fifth file is not received within the third time period, the third page in the solid state drive is determined, and the encrypted target file is written in the third page, and in the case where the encrypted target file is successfully written in the third page, invalid data is written in a blank area of the page in the third page, wherein the third page is a page in the solid state drive where no data is written.
11. The method according to claim 1, characterized in that: After writing the received encrypted target file into the solid state drive, the method further includes: In the case of receiving the authentication request from the client, receiving a signature file sent by the client, wherein the signature file is a file generated after the client signs the seventh file using the client private key, and the authentication request is used to instruct the client to request to perform a target operation on the encrypted target file; Obtaining a client public key of the client, and verifying the signature file according to the client public key; When the signature file is verified, the encrypted target file is decrypted by using the server-side private key to generate the target file; The target file is compared with the signature file, and it is determined whether the client passes the authentication according to a first comparison result.
12. The method according to claim 11, characterized in that Determining whether the client passes the authentication according to the first comparison result includes: If the first comparison result indicates that the target file and the signature file are consistent, determine that the client authentication is successful, and send a first notification to the client so that the client performs the target operation on the encrypted target file, wherein the first notification is used to indicate that the client authentication is successful; When the first comparison result indicates that the target file and the signature file are inconsistent, it is determined that the client authentication has failed, and a second notification is sent to the client to prohibit the client from performing the target operation on the encrypted target file, wherein the second notification is used to indicate that the client authentication has failed.
13. A method for writing an encrypted file, characterized in that: include: The method for writing an encrypted file is applied to a client, wherein the client is used to send a target file to a server, and the server includes: a solid state hard disk, and the solid state hard disk is used to store the target file, wherein: Sending a quantum resistance requirement to the server, so that the server generates corresponding quantum resistance cryptographic parameters according to the quantum resistance requirement, generates a server public key according to the quantum resistance cryptographic parameters, and sends the server public key to the client; When receiving the server-side public key, encrypting the target file according to the server-side public key, and sending the encrypted target file to the server, so that the server writes the received encrypted target file into the solid-state hard disk; The step of sending the encrypted target file to the server so that the server writes the received encrypted target file into the solid state drive comprises: Sending the encrypted target file to the server side so that the server side determines a first size relationship between the number of pages occupied by the encrypted target file and a target number; when the first size relationship indicates that the number of pages is greater than the target number, determining the file size of the encrypted target file, and writing the encrypted target file to the solid-state drive according to a multiple relationship between the file size and the page size of the pages in the solid-state drive; when the first size relationship indicates that the number of pages is equal to the target number, determining the file size, and writing the encrypted target file to the solid-state drive according to the proportion of the file size in the pages of the solid-state drive; Wherein, writing the encrypted target file into the solid state drive according to a multiple relationship between the file size and the page size of the page in the solid state drive comprises: Instruct the server to determine a first page set in the solid-state drive and write the encrypted target file into the first page set when the multiple relationship indicates that the file size is an integer multiple of the page size, wherein the pages in the first page set are pages in the solid-state drive where no data is written; and to calculate a remainder between the file size and the page size when the multiple relationship indicates that the file size is not an integer multiple of the page size, and write the encrypted target file into the solid-state drive according to the remainder.
14. The method according to claim 13, characterized in that Before sending the encrypted target file to the server, the method further includes: Upon receiving the server-side public key, extracting keywords of the target file; Convert the keyword into a hash value according to a hash algorithm; The hash value is sent to the server, so that the server creates a label for the encrypted target file according to the hash value.
15. The method according to claim 13, characterized in that After sending the quantum resistance requirement to the server, the method further includes: When receiving the quantum-resistant cryptographic parameters sent by the server, a client public key is generated according to the quantum-resistant cryptographic parameters, and the client public key is sent to the server so that the server stores the client public key.
16. The method according to claim 13, characterized in that After sending the encrypted target file to the server, the method further includes: Sending an authentication request to the server, wherein the authentication request is used to instruct the client to request to perform a target operation on the encrypted target file; When it is determined that the server has received the authentication request, a signature file is sent to the server so that the server verifies the signature file according to the client public key, and when the signature file is verified, the encrypted target file is decrypted by the server private key to generate the target file, the target file is compared with the signature file, and whether the client passes the authentication is determined based on a first comparison result, wherein the signature file is a file generated after the client signs the seventh file by using the client private key.
17. A system for writing encrypted files, characterized in that: include: The server side is used to generate corresponding anti-quantum cryptographic parameters according to the anti-quantum cryptographic parameters when receiving the anti-quantum requirements sent by the client side; generate a server-side public key according to the anti-quantum cryptographic parameters, and send the server-side public key to the client side, so that the client side encrypts the target file according to the server-side public key, and sends the encrypted target file to the server side; write the received encrypted target file into the solid-state hard disk; The client is used to send the anti-quantum requirement to the server, so that the server generates the anti-quantum cryptographic parameters according to the anti-quantum requirement, generates the server public key according to the anti-quantum cryptographic parameters, and sends the server public key to the client; when receiving the server public key, encrypt the target file according to the server public key, and send the encrypted target file to the server, so that the server writes the received encrypted target file into the solid-state hard disk; The server side is further used to determine a first size relationship between the number of pages occupied by the encrypted target file and a target number; when the first size relationship indicates that the number of pages is greater than the target number, determine the file size of the encrypted target file, and write the encrypted target file into the solid-state drive according to a multiple relationship between the file size and the page size of the pages in the solid-state drive; when the first size relationship indicates that the number of pages is equal to the target number, determine the file size, and write the encrypted target file into the solid-state drive according to the proportion of the file size in the pages of the solid-state drive; The server side is also used to determine the first page set in the solid state drive and write the encrypted target file into the first page set when the multiple relationship indicates that the file size is an integer multiple of the page size, wherein the pages in the first page set are pages in the solid state drive where no data is written; and calculate the remainder of the file size and the page size when the multiple relationship indicates that the file size is not an integer multiple of the page size, and write the encrypted target file into the solid state drive according to the remainder.
18. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method according to any one of claims 1 to 16 when executed by a processor.
19. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: include: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 16 are implemented.
20. A computer program product comprising a computer program, characterized in that The computer program is used by a processor to execute the method described in any one of claims 1 to 16.
