Rapid decryption method for encrypted file

By mapping encrypted files to virtual memory space and using buffers to alternately store decrypted data, the problems of increased disk space occupation and reduced I/O efficiency in traditional decryption methods are solved, and efficient and secure encrypted file decryption is achieved.

CN120068099AInactive Publication Date: 2025-05-30GUANGZHOU TOZED KANGWEI INTELLIGENT TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510034051.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-05-30
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional encrypted file decryption methods, in the case of limited embedded systems or storage resources, lead to increased disk space usage and reduced I/O operation efficiency, and there is a risk of power outage, resulting in incomplete partial decrypted data.

Method used

By mapping encrypted files to the computer's virtual memory space, using buffers in memory to alternately store the decrypted data blocks, and directly overwrite the decrypted content at the original file location, avoiding the creation of additional temporary files and reducing disk space usage and I/O operations.

Benefits of technology

It significantly reduces disk space usage and I/O operations, improves decryption speed and stability, solves the problem of partial decryption files caused by power outage in traditional methods, and ensures the efficiency and security of the decryption process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120068099A_ABST
    Figure CN120068099A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of file processing, and discloses a quick decryption method for an encrypted file, which comprises the following steps of: uploading the encrypted file to a computer, mapping the encrypted file of which the size is modified to a virtual memory space of the computer, and determining a corresponding mapping space; decrypting the encrypted file according to a preset encryption block size sequence, decrypting one encryption block every time, and temporarily storing the decrypted content in a buffer area; when the second encryption block and the subsequent encryption block are decrypted, the decryption content corresponding to the previous encryption block is copied to the position pointed by the current write pointer from the buffer area, and the read pointer and the write pointer are moved until all the encryption blocks are decrypted; after decryption is completed, the virtual memory space, mapped to the computer, of the encrypted file is relieved, a corresponding decrypted file is determined, the decrypted file is synchronized to the computer, and the size of the decrypted file is modified into the actual size of the encrypted file after final decryption. According to the method and the device, the encrypted file can be efficiently decrypted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of file processing, and particularly to a fast decryption method for encrypted files. Background Art

[0002] In modern information technology, file encryption is an important means to protect sensitive data. Symmetric encryption algorithms such as AES-256-CBC are commonly used to process plaintext in fixed-size blocks and add necessary padding. However, traditional decryption methods create new files to store decrypted data, which in the case of embedded systems or limited storage resources, requires at least twice the disk space of the original file, increasing storage costs, and frequent I / O operations reduce efficiency.

[0003] In addition, traditional decryption methods also have the risk of power failure. Sudden power failure may cause incomplete writing of some decrypted data to the new file, resulting in unusable files and wasted disk space. Therefore, there is an urgent need to develop a new technical solution that reduces disk space occupancy, reduces the number of I / O operations, and improves decryption speed to solve these problems in the prior art.

[0004] As can be seen from the above, how to achieve efficient decryption of encrypted files remains to be solved. Summary of the Invention

[0005] In order to achieve efficient decryption of encrypted files, this application provides a fast decryption method for encrypted files.

[0006] In a first aspect, this application provides a fast decryption method for encrypted files, adopting the following technical solution:

[0007] A fast decryption method for encrypted files includes: obtaining an encrypted file that needs to be decrypted, uploading the encrypted file to a computer, modifying the size of the encrypted file, mapping the encrypted file with the modified size to the virtual memory space of the computer, and determining the corresponding mapped space; initializing a read pointer and a write pointer to point to the starting address of the mapped area, decrypting the encrypted file in the order of a predetermined encrypted block size, decrypting one encrypted block each time and temporarily storing the decrypted content in a buffer; when decrypting the second and subsequent encrypted blocks, copying the decrypted content corresponding to the previous encrypted block from the buffer to the position pointed to by the current write pointer, and moving the read pointer and the write pointer until all encrypted blocks are decrypted; after completing the decryption, unmapping the encrypted file from the virtual memory space of the computer, obtaining the decrypted content in the virtual memory space to determine the corresponding decrypted file, and synchronizing the decrypted file back to the computer, modifying the size of the decrypted file to the actual size after the final decryption of the encrypted file.

[0008] By adopting the above technical solution, decrypting the encrypted file by mapping it to virtual memory avoids creating additional temporary files, thus significantly reducing disk space occupancy and the number of I / O operations; using the buffer in memory to alternately store the decrypted data blocks and directly overwrite the decrypted content at the original file location ensures the efficiency and security of the decryption process, while solving the problem of partial decrypted file residues caused by power outages in traditional methods, achieving efficient and secure decryption of encrypted files.

[0009] Optionally, before decrypting each encrypted block and temporarily storing the decrypted content in the buffer, where the buffer includes a first buffer and a second buffer, the method further includes: initializing the first buffer and the second buffer, and the first buffer and the second buffer are used to alternately store the data blocks obtained by two consecutive decryptions, where the first decrypted block is stored in the first buffer and the second decrypted block is stored in the second buffer.

[0010] By adopting the above technical solution, initializing two buffers to alternately store the data blocks obtained by two consecutive decryptions ensures that the first decrypted block is stored in the first buffer and the second decrypted block is stored in the second buffer, thereby improving memory usage efficiency and optimizing the decryption process; this method avoids repeatedly reading and writing data at the same location, reduces the complexity of memory operations, and improves the overall decryption speed and stability.

[0011] Optionally, the method further includes: adopting the AES-256-CBC mode and determining the encrypted block size based on the fixed length of the AES-256-CBC mode.

[0012] By adopting the above technical solution, adopting the AES-256-CBC encryption mode and determining the size of each encrypted block according to its fixed block length requirement ensures that the data blocks in the decryption process conform to the algorithm standard, thus ensuring the accuracy and security of decryption.

[0013] Optionally, during the process of modifying the size of the decrypted file to the actual size after the final decryption of the encrypted file, the method further includes: obtaining the number of encrypted blocks corresponding to all encrypted blocks during the decryption process; determining the corresponding total actual size based on the number of encrypted blocks and the encrypted block size; determining the actual size after the final decryption of the encrypted file based on the total actual size.

[0014] By adopting the above technical solution, by counting the number of all encrypted blocks during the decryption process and calculating the total actual size in combination with the size of each encrypted block, the final size of the decrypted file is accurately adjusted, which ensures that the decrypted file has neither redundant padding data nor missing any content, maintaining the integrity and consistency of the file.

[0015] Optionally, during the process of adjusting the size of the encrypted file, the method further includes: calculating the actual size of the last encrypted block, adding padding bytes to the last encrypted block based on the AES-256-CBC mode, and expanding the encrypted file to the size after adding padding bytes to the last encrypted block.

[0016] By adopting the above technical solution, by calculating the actual size of the last encrypted block and adding necessary padding bytes according to the AES-256-CBC mode, it is ensured that all encrypted blocks meet the fixed block length requirements; this step guarantees the smooth progress of the decryption process and prevents data processing errors or incomplete decryption caused by inappropriate file sizes.

[0017] Optionally, during the process of initializing the read pointer and the write pointer to point to the starting address of the mapped area, the method further includes: determining the starting address of each encrypted block in the mapped area; setting the read pointer to point to the starting address of the first encrypted block, and setting the write pointer to point to the starting address of the first encrypted block.

[0018] By adopting the above technical solution, by determining the starting address of each encrypted block in the mapped area and setting both the read pointer and the write pointer to point to the starting address of the first encrypted block, it is ensured that the decryption operation starts from the correct starting point, precisely controlling the read and write positions of the data, thus guaranteeing the accuracy and efficiency of the decryption process.

[0019] Optionally, before mapping the encrypted file, the method further includes: checking whether the available space on the computer is sufficient to accommodate the encrypted file after modifying the size; if the computer space is insufficient, prompt the user or automatically select another storage location for operation.

[0020] By adopting the above technical solution, by checking the available space on the computer, it is ensured that there is enough storage to accommodate the encrypted file after resizing; if the space is insufficient, the user will be prompted or another storage location will be automatically selected, thus avoiding decryption failures caused by insufficient disk space and guaranteeing the smooth progress of the decryption process.

[0021] In a second aspect, the present application provides a fast decryption device for encrypted files, adopting the following technical solution:

[0022] A fast decryption device for encrypted files includes:

[0023] A mapping module, which obtains the encrypted file to be decrypted, uploads the encrypted file to the computer, and modifies the size of the encrypted file, for mapping the encrypted file after modifying the size to the virtual memory space of the computer and determining the corresponding mapped space;

[0024] The decryption module initializes the read pointer and the write pointer to point to the starting address of the mapped area, and is used to decrypt the encrypted file in the order of a predetermined encrypted block size. Each time, one encrypted block is decrypted and the decrypted content is temporarily stored in the buffer. When decrypting the second and subsequent encrypted blocks, the decrypted content corresponding to the previous encrypted block is copied from the buffer to the position pointed to by the current write pointer, and the read pointer and the write pointer are moved until all encrypted blocks are decrypted.

[0025] The decrypted file determination module, after the decryption is completed, unmaps the encrypted file from the virtual memory space of the computer, obtains the decrypted content in the virtual memory space to determine the corresponding decrypted file, and synchronizes the decrypted file back to the computer, modifying the size of the decrypted file to the actual size after the final decryption of the encrypted file.

[0026] In a third aspect, the present application provides a fast decryption method for an encrypted file, adopting the following technical solution:

[0027] A fast decryption method for an encrypted file includes a processor, and a program of the fast decryption method for an encrypted file described in any one of the above is run in the processor.

[0028] In a fourth aspect, the present application provides a storage medium, adopting the following technical solution:

[0029] A storage medium stores a program of the fast decryption method for an encrypted file described in any one of the above.

[0030] In summary, the present application includes at least one of the following beneficial technical effects:

[0031] By mapping the encrypted file to the virtual memory for decryption, this method avoids creating additional temporary files, significantly reducing the disk space occupation and the number of I / O operations. Using the double buffer in the memory to alternately store the decrypted data blocks and directly overwrite the decrypted content at the original file position, this method not only improves the memory usage efficiency, but also optimizes the decryption process, reducing the complexity of memory operations, thereby enhancing the overall decryption speed and stability. In addition, by precisely adjusting the final size of the decrypted file, the integrity and consistency of the decrypted file are ensured, solving the problem of partial decrypted file residues caused by power outages in traditional methods.

[0032] In addition, to further enhance the security and reliability of the decryption process, the method adopts the AES-256-CBC encryption mode, processes each encrypted block according to the fixed block length requirement, and adds necessary padding bytes to the last encrypted block to ensure that all encrypted blocks meet the algorithm standard. At the same time, when initializing the read and write pointers, the starting address of each encrypted block is determined, ensuring that the decryption operation starts from the correct position and precisely controlling the reading and writing of data. By pre-checking the available space on the computer and prompting the user or automatically selecting other storage locations, the decryption failure caused by insufficient disk space is effectively avoided, ensuring the smooth progress of the decryption process. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 is a flowchart of a fast decryption method for encrypted files shown according to an exemplary embodiment.

[0034] Figure 2 is a block diagram of the structure of a fast decryption device for encrypted files shown according to an exemplary embodiment. DETAILED DESCRIPTION

[0035] The following describes in detail the embodiments of the present application, and the examples of the embodiments are shown in the drawings.

[0036] In the description of this specification, the description with reference to the terms "certain embodiments", "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Moreover, the specific features, structures, materials, or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0037] The embodiments of the present application disclose a fast decryption method for encrypted files, with reference to Figure 1 , including:

[0038] S100, obtain the encrypted file to be decrypted, upload the encrypted file to the computer, modify the size of the encrypted file, map the encrypted file with the modified size to the virtual memory space of the computer, and determine the corresponding mapped space.

[0039] Among them, the user or the system specifies the path of the encrypted file to be decrypted, and the program reads the file and loads it into the memory for subsequent processing; if the encrypted file is not on the local disk, it is transmitted to the storage device (such as a hard disk, SSD, etc.) of the target computer through a network or other transmission methods.

[0040] For modifying the file size, in the embodiments of the present application, first of all, it should be noted that the AES-256-CBC mode is adopted, and the encryption block size is determined based on the fixed length of the AES-256-CBC mode.

[0041] First of all, the program needs to obtain the total number of bytes of the encrypted file, which can be achieved by reading the file metadata or directly reading the end position of the file; according to the standard size of each encryption block in the AES-256-CBC mode (16 bytes), calculate how many complete encryption blocks are in the file, which can be obtained by dividing the total file length by 16 to get the quotient and remainder, and the quotient is the number of complete encryption blocks. The remainder obtained by the above division operation is the actual size of the last encryption block. If the remainder is 0, it means that the last encryption block is a complete 16-byte block; otherwise, it will be less than 16 bytes.

[0042] Then, according to the actual size of the last encryption block, determine how many padding bytes need to be added to make the block reach 16 bytes. For example, if the last encryption block has only 5 bytes, then 11 padding bytes need to be added. According to the PKCS#7 padding scheme, the value of each padding byte should be the number of padding bytes to be added. Continuing with the above example, each of the 11 padding bytes will be set to 0x0B (11 in hexadecimal). If the last encryption block is already a complete 16 bytes, a complete 16-byte padding block still needs to be added, and the value of each byte is 0x10 (16 in hexadecimal), because even if there is no actual data to be padded, there needs to be a clear marker to distinguish the end position of decryption.

[0043] Finally, at the file system level, the program needs to modify the size of the encrypted file so that it includes the newly added padding bytes, which means the new size of the file is equal to the original file size plus the required number of padding bytes; the program writes the calculated padding bytes to the end of the file, which usually involves opening the file for append write operation and ensuring that the written content strictly complies with the previously calculated padding rules; after completing the file size adjustment, the program should read the end part of the file again to confirm that the padding bytes have been correctly added and the file size has been updated as expected.

[0044] Use the memory mapping function provided by the operating system (such as mmap in Linux / Unix systems) to directly map the encrypted file on the disk into the virtual address space of the process, which enables the program to directly read and write the file content without explicitly opening and closing the file; in addition, the starting address and ending address of the mapped area need to be recorded so that subsequent decryption operations can accurately access each encryption block in the file.

[0045] Among them, it should be noted here that before mapping the encrypted file, the method further includes:

[0046] S101, check whether the available space on the computer is sufficient to accommodate the encrypted file after modification.

[0047] Among them, first, the program needs to obtain the total capacity and used space of the target storage device (such as hard disk, SSD, etc.), compare the calculated required space with the available space of the disk. If the available space is greater than or equal to the required space, it is considered that there is enough space to continue the operation; otherwise, proceed to the next step of processing.

[0048] S102, if the computer space is insufficient, prompt the user or automatically select another storage location for operation.

[0049] Among them, if it is detected that the disk space is insufficient, the program will generate a warning message, notifying the user through the graphical interface or command-line interface that the space at the current storage location is insufficient to complete the decryption operation. The message should contain information about the specific storage requirements and the current available space, and suggest that the user provide an alternative storage location with sufficient space.

[0050] Then, provide the user with two options - manually specify a new storage location or let the program automatically search for other available storage devices. For the latter, the program will scan all connected storage devices (such as external hard disks, USB drives, etc.) to find a location with sufficient available space.

[0051] Regardless of which method the user chooses, the program needs to verify again whether the selected new storage location meets the space requirements; if it still does not meet the requirements, repeat the above prompt and selection process until a suitable storage location is found. Once a new storage location is determined, the program will migrate the encrypted file from the original location to the new storage location and update all relevant paths and references to ensure that subsequent mapping and other operations can proceed smoothly.

[0052] By dynamically adjusting the storage location, it is ensured that the decryption operation can be carried out with sufficient space, avoiding operation interruptions or failures caused by insufficient disk space, and improving the user experience and system flexibility.

[0053] S110, initialize the read pointer and write pointer to point to the starting address of the mapped area, decrypt the encrypted file in the order of the predetermined encryption block size, decrypt one encryption block each time and temporarily store the decrypted content in the buffer; when decrypting the second and subsequent encryption blocks, copy the decrypted content corresponding to the previous encryption block from the buffer to the position pointed to by the current write pointer, and move the read pointer and write pointer until all encryption blocks are decrypted.

[0054] After the file is mapped to the virtual memory space, the operating system returns the starting address and length of the mapped area; starting from the starting address of the mapped area, the starting address of each encrypted block is calculated one by one according to the fixed size of the encrypted block. For example, if the starting address of the mapped area is 0x1000, the starting address of the first encrypted block is 0x1000, and the starting address of the second encrypted block is 0x1010 (i.e., 0x1000 + 16), and so on. Store the starting address of each encrypted block in a list, array, or other data structure to facilitate quickly finding and accessing the location of a specific encrypted block during the subsequent decryption process.

[0055] The read pointer is used to indicate the position of the encrypted block currently being read. At the beginning of decryption, the read pointer is set to the starting address of the mapped area, which is also the starting address of the first encrypted block; the write pointer is used to indicate the position where the decrypted content should be written. Similarly, at the beginning of decryption, the write pointer is also set to the starting address of the mapped area. This is because the decrypted data will directly overwrite the original encrypted content to maintain the consistency of the file structure.

[0056] Before setting the pointers, ensure that the starting address of the mapped area actually corresponds to the first encrypted block and that this address is within the valid mapped range. This step can prevent data corruption or out-of-bounds access problems caused by incorrect pointer positions.

[0057] In addition, use the AES-256-CBC algorithm to decrypt the first encrypted block and temporarily save the result in a pre-allocated buffer area (such as the first buffer); for the second and subsequent encrypted blocks, for each newly decrypted block, immediately copy the content of the previous decrypted block from the buffer to the position pointed to by the current write pointer, and then update the pointer position to continue decrypting the next block.

[0058] In the embodiment of the present application, before the program starts decryption, allocate sufficient memory space for the two buffer areas (the first buffer area and the second buffer area); initialize the two buffer areas to be empty or filled with default values (such as zeros), and at the same time assign a unique identifier to each buffer area (such as buffer_1 and buffer_2) to clearly distinguish them.

[0059] Read the data of the first encrypted block from the mapped area and decrypt it using the AES-256-CBC algorithm, and store the decrypted data in the first buffer area; then read and decrypt the second encrypted block, and this time store the decrypted data in the second buffer area. At this time, the content in the first buffer area is already the first data block that has been decrypted, and the second buffer area stores the content of the second decrypted block.

[0060] For the third and subsequent encrypted blocks, the buffer used is switched after each decryption. That is, if the result of the previous decryption was stored in the first buffer, then this time it is stored in the second buffer; and vice versa. This alternating pattern ensures that the data of the previous decryption block can be immediately accessed during each decryption operation, so as to overwrite it back to the original file location.

[0061] Whenever a new encrypted block is decrypted and the result is stored in the currently used buffer, the read pointer and write pointer are moved accordingly to point to the position of the next encrypted block to be processed; this ensures that the decryption process can proceed in sequence without skipping or duplicating any data blocks. After each decryption, check whether it is necessary to copy the content of the previous decryption block from another buffer to the position pointed to by the current write pointer. If so, perform this operation and update the pointer position, and then continue with the decryption of the next encrypted block. Continuously execute the above decryption and overwriting processes until all encrypted blocks have been processed, and finally obtain the fully decrypted file content.

[0062] By initializing the first buffer and the second buffer and adopting an alternating storage mechanism to process the data blocks obtained from two consecutive decryptions, this method not only improves the memory usage efficiency, reduces frequent memory read and write operations, but also optimizes the decryption process, enhancing the overall decryption speed and stability.

[0063] S120, after the decryption is completed, unmap the encrypted file from the computer's virtual memory space, obtain the decrypted content in the virtual memory space to determine the corresponding decrypted file, and synchronize the decrypted file back to the computer, modifying the size of the decrypted file to the actual size after the final decryption of the encrypted file.

[0064] Among them, when the decryption is completed, call the function provided by the operating system to unmap the file, so that the operating system no longer tracks the virtual memory mapping of this file; ensure that all changes have been safely written back to the actual file on the disk through the write-back mechanism.

[0065] During the process of modifying the size of the decrypted file to the actual size after the final decryption of the encrypted file, the method further includes:

[0066] First, before the decryption starts, initialize a counter to track the number of encrypted blocks that have been processed. Whenever an encrypted block is successfully decrypted, increment this counter. If the program design allows, relevant information (such as index, size, etc.) of each encrypted block can be dynamically saved during the decryption process for subsequent statistical use; when all encrypted blocks have been decrypted, read and record the final encrypted block count value, and this value represents the number of all complete encrypted blocks processed during the decryption process.

[0067] Then, according to the requirements of the AES-256-CBC mode, the standard size of each encryption block is 16 bytes (128 bits); multiply the number of encryption blocks by the fixed size of each encryption block (16 bytes) to obtain the total number of bytes occupied by all complete encryption blocks; recall the actual size of the last encryption block calculated at the start of decryption (i.e., the true size before padding), and add this value to the above total number of bytes to correct for the additional space due to padding bytes.

[0068] Finally, at the file system level, modify the metadata of the encrypted file to reflect its new size; if there are additional padding bytes or other unnecessary data in the original file, after determining the new size, these extra parts can be safely deleted, which can be achieved through file truncation operations to ensure that the file does not retain any useless information.

[0069] After completing the file size adjustment, it is recommended to read the end part of the file again to confirm that its content meets the expectations and that the file size has indeed been correctly updated. Verification algorithms (such as MD5, SHA-256) can be used to verify the integrity of the file.

[0070] By obtaining the total number of all encryption blocks during the decryption process and determining the total actual size based on the number of encryption blocks and the encryption block size, the size of the encrypted file is finally adjusted to the actual size after decryption. This method ensures that the decrypted file has neither redundant padding data nor any missing content, maintaining the integrity and consistency of the file. This method not only improves the accuracy and reliability of the file but also avoids data processing errors or incomplete decryption caused by inappropriate file sizes, ensuring the successful completion of the decryption process.

[0071] In summary, by mapping the encrypted file into virtual memory for decryption, this method avoids creating additional temporary files, significantly reducing disk space occupancy and the number of I / O operations. Using double buffers in memory to alternately store the decrypted data blocks and directly overwrite the decrypted content at the original file location, this method not only improves memory utilization efficiency but also optimizes the decryption process, reducing the complexity of memory operations, thereby enhancing the overall decryption speed and stability. In addition, by precisely adjusting the final size of the decrypted file, the integrity and consistency of the decrypted file are ensured, solving the problem of partial decrypted file residues caused by power outages in traditional methods.

[0072] To further enhance the security and reliability of the decryption process, this method adopts the AES-256-CBC encryption mode, processes each encrypted block according to the fixed block length requirement, and adds necessary padding bytes to the last encrypted block to ensure that all encrypted blocks comply with the algorithm standard. At the same time, when initializing the read and write pointers, the starting address of each encrypted block is determined, ensuring that the decryption operation starts from the correct position and precisely controlling the reading and writing of data. By pre-checking the available space on the computer and prompting the user or automatically selecting other storage locations, the decryption failure caused by insufficient disk space is effectively avoided, ensuring the smooth progress of the decryption process.

[0073] An embodiment of the present application discloses a fast decryption device for encrypted files. Referring to Figure 2 , the device includes but is not limited to:

[0074] The mapping module 200 obtains the encrypted file that needs to be decrypted, uploads the encrypted file to the computer, and modifies the size of the encrypted file to map the encrypted file with the modified size to the virtual memory space of the computer and determine the corresponding mapped space;

[0075] The decryption module 210 initializes the read pointer and the write pointer to point to the starting address of the mapped area, decrypts the encrypted file in the order of the predetermined encrypted block size, decrypts one encrypted block each time and temporarily stores the decrypted content in the buffer; when decrypting the second and subsequent encrypted blocks, copies the decrypted content corresponding to the previous encrypted block to the position pointed to by the current write pointer, and moves the read pointer and the write pointer until all encrypted blocks are decrypted;

[0076] The decrypted file determination module 220, after completing the decryption, unmaps the encrypted file from the virtual memory space of the computer, obtains the decrypted content in the virtual memory space to determine the corresponding decrypted file, and synchronizes the decrypted file back to the computer, modifying the size of the decrypted file to the actual size after the final decryption of the encrypted file.

[0077] An embodiment of the present application also discloses a fast decryption method for encrypted files, including a processor, and a program of the fast decryption method for encrypted files described in any one of the above is run in the processor.

[0078] An embodiment of the present application also discloses a storage medium storing a program of the fast decryption method for encrypted files described in any one of the above.

[0079] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present application. Those of ordinary skill in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present application.

Claims

1. A fast decryption method for encrypted files, characterized in that: include: Obtaining an encrypted file to be decrypted, uploading the encrypted file to a computer, modifying the size of the encrypted file, mapping the modified encrypted file to a virtual memory space of the computer, and determining a corresponding mapping space; Initialize the read pointer and write pointer to point to the starting address of the mapping area, decrypt the encrypted file according to the predetermined encryption block size sequence, decrypt one encryption block at a time and temporarily store the decrypted content in the buffer; when decrypting the second and subsequent encryption blocks, copy the decrypted content corresponding to the previous encryption block from the buffer to the position pointed to by the current write pointer, and move the read pointer and write pointer until all encryption blocks are decrypted; After decryption is completed, the encrypted file is unmapped to the computer's virtual memory space, the decrypted content in the virtual memory space is obtained to determine the corresponding decrypted file, and the decrypted file is synchronized back to the computer, and the size of the decrypted file is modified to the actual size of the encrypted file after final decryption.

2. The fast decryption method for encrypted files according to claim 1, characterized in that: Before decrypting an encrypted block each time and temporarily storing the decrypted content in a buffer, wherein the buffer includes a first buffer and a second buffer, the method further includes: Initialize the first buffer and the second buffer, the first buffer and the second buffer are used to alternately store data blocks obtained by two consecutive decryptions, wherein the first decrypted block is stored in the first buffer, and the second decrypted block is stored in the second buffer.

3. The fast decryption method for encrypted files according to claim 1, characterized in that: The method also includes: The AES-256-CBC mode is adopted, and the encryption block size is determined based on the fixed length of the AES-256-CBC mode.

4. The fast decryption method for encrypted files according to claim 3, characterized in that: In the process of modifying the size of the decrypted file to the actual size of the encrypted file after final decryption, the method further includes: Get the number of encrypted blocks corresponding to all encrypted blocks in the decryption process; Determining a corresponding actual size sum based on the number of encryption blocks and the encryption block size; The actual size of the encrypted file after final decryption is determined based on the actual size sum.

5. The fast decryption method for encrypted files according to claim 1, characterized in that: In the process of adjusting the encrypted file size, the method also includes: Calculate the actual size of the last encrypted block, add padding bytes to the last encrypted block based on AES-256-CBC mode, and extend the encrypted file to the size of the last encrypted block after adding padding bytes.

6. The fast decryption method for encrypted files according to claim 1, characterized in that: In the process of initializing the read pointer and the write pointer to point to the starting address of the mapping area, the method further includes: Determine the starting address of each encrypted block in the mapped area; Set the read pointer to point to the starting address of the first encrypted block, and set the write pointer to point to the starting address of the first encrypted block.

7. The fast decryption method for encrypted files according to claim 1, characterized in that: Before mapping the encrypted file, the method also includes: Check if the available space on your computer is sufficient to accommodate the encrypted file after the modified size; If the computer space is insufficient, the user will be prompted or another storage location will be automatically selected for operation.

8. A fast decryption device for encrypted files, characterized in that: include: A mapping module, which obtains an encrypted file to be decrypted, uploads the encrypted file to a computer, and modifies the size of the encrypted file, and is used to map the encrypted file after the modified size to a virtual memory space of the computer, and determine a corresponding mapping space; A decryption module, which initializes the read pointer and the write pointer to point to the starting address of the mapping area, is used to decrypt the encrypted file according to the predetermined encryption block size sequence, decrypts one encryption block at a time and temporarily stores the decrypted content in the buffer; when decrypting the second and subsequent encryption blocks, the decrypted content corresponding to the previous encryption block is copied from the buffer to the position pointed to by the current write pointer, and the read pointer and the write pointer are moved until all encryption blocks are decrypted; The decrypted file determination module, after completing the decryption, unmaps the encrypted file to the virtual memory space of the computer, obtains the decrypted content in the virtual memory space to determine the corresponding decrypted file, synchronizes the decrypted file back to the computer, and modifies the size of the decrypted file to the actual size of the encrypted file after final decryption.

9. A fast decryption method for encrypted files, characterized in that: The invention comprises a processor, wherein a program of the method for fast decryption of encrypted files as claimed in any one of claims 1 to 7 is run in the processor.

10. A storage medium, characterized in that: A program for a fast decryption method for encrypted files as described in any one of claims 1 to 7 is stored.

Citation Information

Patent Citations

  • Data lengthening modification method and application thereof in big data encryption

    CN106936820A

  • Method for realizing security file system in embedded system

    CN107358119A

  • Protection file reading and writing method and device, electronic equipment and storage medium

    CN113239380A

  • File encryption and decryption method and device, electronic equipment and storage medium

    CN117668884A

  • Impact data manager for dynamic data delivery

    US20170078094A1