File encryption method, decryption method, encryption device, and decryption device
Patent Information
- Application Number
- CN202611038389.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-13
- Publication Date
- 2026-10-16
AI Technical Summary
[0004]本申请提供一种文件加密方法、解密方法、加密装置及解密装置,用以解决文件分发中安全性低的问题
[0068] The file encryption method, decryption method, encryption device, and decryption device provided in this application compress the original file to obtain a compressed file and record the metadata of the original file.
Smart Images

Figure CN122926485A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information security, and in particular to a file encryption method, decryption method, encryption device, and decryption device. Background Technology
[0002] With the increasing demand for digital office work and file transfer, secure file distribution has become a core requirement. Current secure file distribution methods require the additional transmission of a password, which the receiving terminal then uses to decrypt the file. This method extends the file security boundary during password transmission, posing a risk of password leakage.
[0003] Therefore, improving the security of file distribution has become an urgent problem to be solved. Summary of the Invention
[0004] This application provides a file encryption method, decryption method, encryption device, and decryption device to solve the problem of low security in file distribution.
[0005] In a first aspect, this application provides a file encryption method applied to a sending terminal, comprising: compressing an original file to obtain a compressed file, and recording the metadata of the original file;
[0006] Generate a random password, encrypt the compressed file according to the random password, and generate an encrypted file block;
[0007] The random password is asymmetrically encrypted using the public key of the receiving terminal to generate an encrypted password block;
[0008] The tail signature is determined based on the metadata, the encrypted password block, and the encrypted file block;
[0009] A file distribution package is constructed based on the metadata, the encrypted password block, the encrypted file block, and the tail signature.
[0010] Optionally, encrypting the compressed file according to the random password to generate an encrypted file block includes:
[0011] The compressed file is symmetrically encrypted using the random password to obtain the ciphertext of the compressed file and the authentication tag.
[0012] The encrypted file block is generated based on the encrypted compressed file and the authentication tag.
[0013] Optionally, the step of using the public key of the receiving terminal to perform asymmetric encryption on the random password to generate an encrypted password block includes:
[0014] The public key is verified. If the verification passes, the public key is used to perform asymmetric encryption on the random password to obtain the encryption key.
[0015] The encrypted password block is generated based on the encryption key and encryption identification information.
[0016] Optionally, the step of compressing the original file to obtain a compressed file and recording the metadata of the original file includes:
[0017] Obtain the file attributes and hash value of the original file;
[0018] The original file is compressed to obtain the compressed file, and the attributes of the compressed file are recorded.
[0019] The file attributes, the hash value, and the compressed file attributes are recorded as the metadata.
[0020] Optionally, constructing the file distribution package based on the metadata, the encrypted cryptographic block, the encrypted file block, and the tail signature includes:
[0021] Determine the header identifier and version number of the file distribution package;
[0022] The file distribution package is constructed in the order of the header identifier, the version number, the metadata, the encrypted password block, the encrypted file block, and the tail signature.
[0023] Optionally, the step of using the public key of the receiving terminal to perform asymmetric encryption on the random password to generate an encrypted password block includes:
[0024] When there are multiple receiving terminals, the random password is asymmetrically encrypted using the public key of each receiving terminal to generate an encrypted password block corresponding to each receiving terminal.
[0025] Secondly, this application provides a file decryption method applied to a receiving terminal, comprising: receiving a file distribution packet sent by a sending terminal, wherein the file distribution packet is obtained by encrypting the original file using the method described in the first aspect and / or various possible implementations of the first aspect;
[0026] The file distribution packet is parsed to obtain the metadata, encrypted password block, encrypted file block, and tail signature in the file distribution packet;
[0027] The integrity of the file distribution package is verified based on the tail signature. If the verification is successful, the encrypted password block is decrypted using the private key to obtain the random password.
[0028] The encrypted file block is decrypted using the random password to obtain the compressed file;
[0029] The compressed file is decompressed based on the metadata to obtain the original file, and the integrity of the original file is verified based on the metadata.
[0030] Optionally, the file distribution package further includes a header identifier and a version number, and the integrity verification of the file distribution package based on the tail signature includes:
[0031] Based on the header identifier and the version number, the legitimacy of the file distribution package is confirmed;
[0032] If the file distribution package is confirmed to be legitimate, the integrity of the file distribution package is verified based on the tail signature.
[0033] Thirdly, this application provides a file encryption device, comprising: a compression module, a first generation module, a second generation module, a determination module, and a construction module, wherein:
[0034] The compression module is used to compress the original file to obtain a compressed file and record the metadata of the original file.
[0035] The first generation module is used to generate a random password, encrypt the compressed file according to the random password, and generate an encrypted file block;
[0036] The second generation module is used to perform asymmetric encryption on the random password using the public key of the receiving terminal to generate an encrypted password block;
[0037] The determining module is used to determine the tail signature based on the metadata, the encrypted password block, and the encrypted file block;
[0038] The construction module is used to construct a file distribution package based on the metadata, the encrypted password block, the encrypted file block, and the tail signature.
[0039] Optionally, the first generation module is further configured to:
[0040] The original file is symmetrically encrypted using the random password to obtain the compressed ciphertext and the authentication tag.
[0041] The encrypted file block is generated based on the encrypted compressed file and the authentication tag.
[0042] Optionally, the second generation module is further configured to:
[0043] The public key is verified. If the verification passes, the public key is used to perform asymmetric encryption on the random password to obtain the encryption key.
[0044] The encrypted password block is generated based on the encryption key and encryption identification information.
[0045] Optionally, the compression module is further configured to:
[0046] Obtain the file attributes and hash value of the original file;
[0047] The original file is compressed to obtain the compressed file, and the attributes of the compressed file are recorded.
[0048] The file attributes, the hash value, and the compressed file attributes are recorded as the metadata.
[0049] Optionally, the building module is further configured to:
[0050] Determine the header identifier and version number of the file distribution package;
[0051] The file distribution package is constructed in the order of the header identifier, the version number, the metadata, the encrypted password block, the encrypted file block, and the tail signature.
[0052] Optionally, the second generation module is further configured to:
[0053] When there are multiple receiving terminals, the random password is asymmetrically encrypted using the public key of each receiving terminal to generate an encrypted password block corresponding to each receiving terminal.
[0054] Fourthly, this application provides a file decryption device, the device comprising: a receiving module, a parsing module, a verification module, a decryption module, and a decompression module, wherein:
[0055] The receiving module is used to receive a file distribution packet sent by the sending terminal, wherein the file distribution packet is obtained by encrypting the original file using the device described in the third aspect.
[0056] The parsing module is used to parse the file distribution package to obtain the metadata, encrypted password block, encrypted file block and tail signature in the file distribution package;
[0057] The verification module is used to perform integrity verification on the file distribution package based on the tail signature. If the verification is successful, the encrypted password block is decrypted using the private key to obtain the random password.
[0058] The decryption module is used to decrypt the encrypted file block using the random password to obtain the compressed file;
[0059] The decompression module is used to decompress the compressed file based on the metadata to obtain the original file, and to perform integrity verification on the original file based on the metadata.
[0060] Optionally, the file distribution package also includes a header identifier and a version number, and the verification module is further used for:
[0061] Based on the header identifier and the version number, the legitimacy of the file distribution package is confirmed;
[0062] If the file distribution package is confirmed to be legitimate, the integrity of the file distribution package is verified based on the tail signature.
[0063] Fifthly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0064] The memory stores computer-executed instructions;
[0065] The processor executes computer execution instructions stored in the memory, causing the processor to perform the file encryption method as described in the first or second aspect.
[0066] In a sixth aspect, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the file encryption method as described in the first or second aspect.
[0067] In a seventh aspect, this application provides a computer program product, including a computer program that, when executed by a processor, implements the file encryption method described in the first or second aspect above.
[0068] The file encryption method, decryption method, encryption device, and decryption device provided in this application compress the original file to obtain a compressed file and record the metadata of the original file.
[0069] Generate a random password, encrypt the compressed file using the random password, and generate an encrypted file block;
[0070] The public key of the receiving terminal is used to perform asymmetric encryption on the random password to generate an encrypted password block;
[0071] The tail signature is determined based on the metadata, encrypted password block, and encrypted file block;
[0072] The file distribution package is constructed based on metadata, encrypted cryptographic blocks, encrypted file blocks, and a tail signature.
[0073] The file encryption method, decryption method, encryption device, and decryption device provided in this application compress the original file and record its metadata. They then encrypt the compressed file using a generated random password to obtain an encrypted file block. Finally, they use the public key of the receiving terminal to perform asymmetric encryption on the random password to obtain an encrypted password block. By combining the metadata, encrypted password block, encrypted file block, and tail signature, a file distribution package is constructed. This approach combines file content protection with receiving terminal authorization control, reduces security risks associated with additional password transmission, and provides the distributed file with an independent and secure encapsulation form, thereby improving the security of file distribution. Attached Figure Description
[0074] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0075] Figure 1 A flowchart illustrating a file encryption method provided in this application embodiment. Figure 1 ;
[0076] Figure 2 A flowchart illustrating a file encryption method provided in this application embodiment. Figure 2 ;
[0077] Figure 3 A flowchart illustrating a file decryption method provided in an embodiment of this application;
[0078] Figure 4 This is a schematic diagram illustrating an application scenario of a file encryption and decryption method provided in an embodiment of this application;
[0079] Figure 5 This is a schematic diagram of the structure of a file encryption device provided in an embodiment of this application;
[0080] Figure 6 This is a schematic diagram of the structure of a file decryption device provided in an embodiment of this application;
[0081] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0082] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0083] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.
[0084] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of the relevant data all comply with the relevant laws, regulations, and standards of the relevant countries and regions, have taken necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation access points for users to choose to authorize or refuse.
[0085] Furthermore, the technical solution involved in this application, which involves big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.) and the use of artificial intelligence technology for automated decision-making, and makes decisions that have a significant impact on personal rights based on the results of automated decision-making, provides users with corresponding operation entry points for users to choose to agree to or reject the results of automated decision-making; if the user chooses to reject, the process will proceed to the expert decision-making process.
[0086] It should be noted that the file encryption method, decryption method, encryption device and decryption device provided in this application can be used in the field of information security, or in any field other than information security. The application field of the file encryption method, decryption method, encryption device and decryption device in this application is not limited.
[0087] The file encryption and decryption methods provided in this application can be applied to scenarios such as internal document circulation within an enterprise, data exchange between organizations, and personal file transfer. Related equipment may include a sending terminal that executes the file encryption method, a receiving terminal that executes the file decryption method, and a distribution link such as email, instant messaging, or physical media for transmitting file distribution packages.
[0088] Existing file encryption methods include using compression software for encryption, encrypting files based on public and private keys, and using document management systems or cloud-based encryption clients.
[0089] Encryption using compression software requires a valid password to decompress the file, and this password must be transmitted separately via communication links such as email. The transmission of the password carries the risk of loss, interception, or leakage.
[0090] Encrypting files using public and private keys allows for file encryption or signature verification using an asymmetric encryption system. The sending terminal encrypts the file using the recipient's public key, and the receiving terminal decrypts it using the private key. While this encryption method offers high security, it requires users to manage the public and private key pairs, resulting in a high learning curve for users.
[0091] Document management systems can be used to manage file permissions hierarchically, audit access, or control validity periods. However, document management systems rely on centralized server deployment, cannot be used in offline scenarios, and have high maintenance costs.
[0092] Cloud-based encryption clients can perform end-to-end file encryption, automatically encrypting and decrypting files while synchronizing locally. They can achieve cross-platform synchronization, but they rely on network verification and require regular key updates, resulting in high long-term costs. Furthermore, they cannot be managed offline and struggle to reliably distribute files and verify permissions in offline or weak network conditions.
[0093] In view of this, how to reduce the risk of leakage caused by transmitting passwords separately during file distribution, while taking into account targeted authorization and offline availability, has become an urgent problem to be solved. To solve the above problems, this application provides a file encryption method and a file decryption method. The file encryption method is applied to the sending terminal, and the file decryption method is applied to the receiving terminal. In the file distribution system composed of the sending terminal and the receiving terminal, the original file is first compressed and metadata is recorded. Then, a random password is generated and the compressed file is encrypted to generate an encrypted file block. At the same time, the public key of the receiving terminal is used to perform asymmetric encryption on the random password to generate an encrypted password block. The tail signature is determined based on the metadata, the encrypted password block, and the encrypted file block, and then a file distribution package is constructed, thereby realizing file protection and targeted delivery in the same distribution system.
[0094] The execution entity in this application embodiment can be a file encryption device or a control device for the file encryption device. The control device for the file encryption device can be implemented through software and / or hardware. For example, the control device for the file encryption device can be a processor within the file encryption device.
[0095] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0096] Figure 1 A flowchart illustrating a file encryption method provided in this application embodiment. Figure 1 The encryption method used to encrypt this file is applied to the sending terminal, such as... Figure 1 As shown, the method includes:
[0097] S101. Compress the original file to obtain a compressed file, and record the metadata of the original file.
[0098] The original file is the input file to be processed, and is used as the object for compression and subsequent encryption.
[0099] A compressed file is an intermediate file formed by compressing the original file, and is used as input for subsequent encryption processing.
[0100] Metadata consists of attribute information describing the original file and the compression result, which is used to provide a basis for subsequent construction of file distribution packages and file recovery.
[0101] For example, when file encryption is required, the user selects one or more files as the original files on the sending terminal, performs compression on the original files, and records the original files and compression-related data as metadata.
[0102] Optionally, compression processing can be performed on the original file, and different compression algorithms can be selected according to requirements such as compression ratio and compression speed. For example, if the original file size is small and fast sending and receiving are required, a compression algorithm with a faster compression speed can be selected; if the original file size is large, storage space is limited, a high compression ratio is required, and frequent decompression is not necessary, a compression algorithm with a high compression ratio but longer computation time can be selected.
[0103] By compressing the original files, storage space is saved and multiple files can be easily processed in batches. Metadata reflecting the information of the original files is recorded, and the sending terminal can retain the basic attribute data of the original files when building the file distribution package in the future.
[0104] S102. Generate a random password, encrypt the compressed file according to the random password, and generate an encrypted file block.
[0105] The random password is a temporary key used for symmetric encryption to protect the encrypted data.
[0106] An encrypted file block is a data block formed after a compressed file is encrypted, used to carry ciphertext data and information required for decryption.
[0107] For example, upon receiving a compressed file, the sending terminal generates a high-strength random password using a pseudo-random number generator. The random password can be a random string with a length of at least 256 characters. The sending terminal then reads the contents of the compressed file and calls a preset encryption algorithm to perform encryption processing, generating a corresponding encrypted file block. The encrypted file block may include ciphertext data, and optionally may include auxiliary parameters or verification information required for decryption.
[0108] Optionally, when the compressed file is large, the sending terminal can use a segmented processing method to encrypt the compressed file in order to control memory usage.
[0109] In this step, the random password is not exposed in the plaintext of the distribution packet; it is only used as a temporary key for this file encryption task, forming an independent ciphertext protection layer for the compressed file. The encrypted file block encapsulates the ciphertext body and related information, allowing subsequent file distribution packets to still be parsed even under offline transmission conditions.
[0110] S103. Use the public key of the receiving terminal to perform asymmetric encryption on the random password to generate an encrypted password block.
[0111] The public key of the receiving terminal is the public key corresponding to the private key held by the receiving terminal. It is used to perform targeted encryption on the random password, so that the random password can only be recovered by the corresponding private key.
[0112] Asymmetric encryption is a cryptographic method that uses a public key to encrypt and a private key to decrypt, and is used to avoid transmitting random passwords over a separate link.
[0113] The encrypted cipher block is a data block formed by encrypting a random cipher with the receiving terminal's public key. It is used to carry targeted and protected key data in the file distribution packet.
[0114] In this step, a random password is used as the content to be encrypted, and a preset asymmetric encryption algorithm is used to perform asymmetric encryption on the random password based on the public key of the receiving terminal.
[0115] After the random password is asymmetrically encrypted using the receiving terminal's public key, the encrypted password block in the file distribution package no longer needs to rely on external links for transmission. The receiving terminal can only recover the random password and further decrypt the encrypted file block if it holds the corresponding private key, thereby completing the targeted binding between the file and the authorized receiving terminal.
[0116] S104. Determine the tail signature based on the metadata, encrypted password block, and encrypted file block.
[0117] The tail signature is a verification information calculated based on the core content of the file distribution package. It can be used to represent the complete state of metadata, encrypted cryptographic blocks, and encrypted file blocks at the time of generation, and can be used by the receiving terminal to perform tamper detection before or during decryption.
[0118] Having obtained the metadata, encrypted cipher block, and encrypted file block, the sending terminal determines the tail signature based on these three parts in a predetermined order. Since the tail signature covers the entire content of the metadata, encrypted cipher block, and encrypted file block, if any of these contents change, the signature recalculated by the receiving terminal will be inconsistent with the tail signature, allowing the receiving terminal to suspend the processing flow.
[0119] The tail signature is not an independent additional explanatory information, but a verification result that binds the main content of the distribution package as a whole. It directly affects the integrity judgment of the distribution package in offline distribution scenarios, enabling the receiving terminal to perform local tamper detection on the received distribution files without relying on a centralized service.
[0120] S105. Construct a file distribution package based on metadata, encrypted password blocks, encrypted file blocks, and tail signature.
[0121] The file distribution package is the final file object used for external transmission or offline delivery. It integrates metadata, encrypted cryptographic blocks formed by targeted protection cryptographic data, encrypted file areas formed by file ciphertext, and a tail signature composed of integrity verification information into a single carrier.
[0122] For example, the different regions within a file distribution package can be located using a length field.
[0123] The file distribution packet encapsulates metadata, encrypted cryptographic blocks, encrypted file blocks, and tail signatures into a self-contained structure, enabling the sending terminal to transmit protected content and authorization information synchronously by transmitting only a single file. The receiving terminal can also sequentially perform packet structure verification, integrity verification, key recovery, and file decryption in an offline environment.
[0124] The file encryption method provided in this embodiment compresses the original file and records its metadata. It then encrypts the compressed file using a generated random password to obtain an encrypted file block. Finally, it uses the public key of the receiving terminal to perform asymmetric encryption on the random password to obtain an encrypted password block. By combining the metadata, encrypted password block, encrypted file block, and tail signature, a file distribution package is constructed. This method combines file content protection with receiving terminal authorization control, reduces the security risks caused by additional password transmission, and gives the distributed file an independent and secure encapsulation form, thereby improving the security of file distribution.
[0125] The following combination Figure 2 The present application provides a further description of a file encryption method according to an embodiment.
[0126] Figure 2 A flowchart illustrating a file encryption method provided in this application embodiment. Figure 2 .like Figure 2 As shown, in this embodiment... Figure 1 Based on the embodiments, the metadata of the original files is described in detail. The file encryption method provided in this embodiment includes:
[0127] S201. Obtain the file attributes and hash value of the original file.
[0128] The file attributes of the original file can include the file name, file size, and modification timestamp, etc.
[0129] For example, the hash value of a file can be generated using a 256-bit Secure Hash Algorithm (SHA-256) or other algorithms that can calculate the hash value of a file.
[0130] S202. Compress the original file to obtain a compressed file and record the compressed file attributes.
[0131] Compression file attributes can include compression parameters such as the size of the compressed file, the compressed file identifier, and the compression ratio.
[0132] S203. Record file attributes, hash values, and compressed file attributes as metadata.
[0133] Once the file attributes, hash value, and compressed file attributes are obtained, they are combined according to a preset field structure to form metadata for subsequent encapsulation and verification.
[0134] For example, metadata can be encoded in binary, JavaScript Object Notation (JSON), or Type-Length-Value (TLV) format.
[0135] This metadata is saved along with the compressed file during file encapsulation, enabling the receiving terminal to identify the file's source and type based on file attributes, perform integrity verification on the decompressed file content based on hash values, and confirm whether the compression status matches based on the compressed file attributes, thereby establishing a correspondence between the compression result and the original file characteristics.
[0136] By combining the file attributes, hash values, and compressed file attributes of the original file into metadata, the data required for file identification, verification, and management can be retained without relying on external indexing information. This enables the compressed file to have traceability and consistency verification capabilities during distribution, decompression, and verification.
[0137] Optionally, encrypting the compressed file with a random password to generate an encrypted file block includes: symmetrically encrypting the compressed file with a random password to obtain the compressed file ciphertext and authentication tag; and generating an encrypted file block based on the compressed file ciphertext and authentication tag.
[0138] The encrypted compressed file is data obtained by symmetric encryption of the compressed file using a preset symmetric encryption algorithm and a random password as the symmetric key.
[0139] An authentication tag is a verification digest generated during the encryption process using an authentication-enabled encryption algorithm. It can be used to verify whether encrypted file blocks have been tampered with.
[0140] In this step, the sending terminal uses a random password as the key for symmetric encryption and a preset symmetric encryption algorithm to encrypt the compressed file, obtaining the ciphertext of the compressed file and an authentication tag. Then, the ciphertext and authentication tag are combined according to a predetermined encoding method to generate an encrypted file block. Because the authentication tag is generated simultaneously with the ciphertext of the compressed file, the receiving terminal can complete the integrity verification using the authentication tag before decryption, and recover the original file content using the same random password after successful verification.
[0141] By centralizing file content protection and integrity verification within the same encrypted file block, the compressed file ciphertext remains unreadable during transmission, storage, and handover, while the authentication tag provides the basis for subsequent decryption verification. Since the encrypted file block is directly composed of the compressed file ciphertext and the authentication tag, its structure is clear and easily encapsulated into a file distribution package, facilitating collaboration with subsequent encrypted cipher blocks, metadata, and tail signatures.
[0142] Optionally, the public key of the receiving terminal is used to perform asymmetric encryption on the random password to generate an encrypted password block, including: verifying the public key; if the verification passes, using the public key to perform asymmetric encryption on the random password to obtain an encryption key; and generating an encrypted password block based on the encryption key and encryption identification information.
[0143] Encryption identification information is a fixed field used to describe information such as the current encryption algorithm identifier, version rules, or receiving terminal identifier. The receiving terminal can determine the decryption algorithm or decryption mode based on the encryption identification information, thereby preventing problems such as incorrect decryption algorithms, version incompatibility, or decryption errors.
[0144] For example, public key verification may include at least one of format verification, security parameter verification, or integrity verification. Format verification determines whether the receiving terminal's public key is a valid and resolvable public key structure; security parameter verification determines whether the public key length meets security requirements; and integrity verification prevents the public key from being tampered with or replaced.
[0145] If the public key verification passes, a preset asymmetric encryption algorithm is invoked to asymmetricly encrypt the random password using the public key, thereby obtaining the encryption key. This encryption key is then concatenated, encapsulated, or structured with encryption identification information to form an encrypted cryptographic block. The encrypted cryptographic block can be written using a combination of fixed-length fields and variable-length identifier fields, so that the receiving terminal can accurately parse the encrypted data based on the encryption identification information.
[0146] In this embodiment, the random password is protected by the receiving terminal's public key without being leaked in plaintext, and together with the encrypted identification information, it constitutes an identifiable and parseable encrypted password block, enabling the key content in the file distribution package to be delivered in a targeted manner and kept independently packaged, thereby meeting the requirements of asymmetric protection and subsequent decryption identification.
[0147] For scenarios with multiple receiving terminals, existing methods often require repeated file processing or reorganization of distribution content when adding or deleting authorized objects, resulting in cumbersome operations, low efficiency, and increased risk of errors.
[0148] To address the aforementioned issues, in this embodiment of the application, the random password is asymmetrically encrypted using the public key of the receiving terminal to generate an encrypted password block. This includes: when there are multiple receiving terminals, the random password is asymmetrically encrypted using the public key of each receiving terminal to generate an encrypted password block corresponding to each receiving terminal.
[0149] When there are multiple receiving terminals, the sending terminal receives the public keys of each receiving terminal and verifies them individually. If the public key verification passes, an asymmetric encryption algorithm is used to asymmetricly encrypt the random password according to the public key of each receiving terminal, thus obtaining the encryption key corresponding to each receiving terminal.
[0150] For example, when there are multiple receiving terminals, the encrypted cryptographic block may include a receiving terminal index, an encryption key corresponding to each receiving terminal, and encryption identification information. The receiving terminal index is a sequential number assigned by the sending terminal to each receiving terminal, used to quickly locate and distinguish the encryption key corresponding to different receiving terminals in the encrypted cryptographic blocks of multiple receiving terminals. For example, the receiving terminal index can be an incremental sequence number of 1, 2, 3, or a custom receiving terminal number.
[0151] By applying asymmetric encryption to multiple receiving terminals separately, generating encrypted password blocks for each terminal, a single file distribution package can be distributed to multiple users. This eliminates the need to create a separate file distribution package for each receiving terminal, avoiding redundancy and saving server storage and bandwidth costs. All receiving terminals share a single file distribution package, improving file distribution efficiency.
[0152] Optionally, a file distribution package is constructed based on metadata, encrypted cryptographic blocks, encrypted file blocks, and a tail signature, including: determining the header identifier and version number of the file distribution package; and constructing the file distribution package in the order of the header identifier, version number, metadata, encrypted cryptographic blocks, encrypted file blocks, and tail signature.
[0153] The header identifier is packet header information used to identify the file type. Its function is to enable the receiving terminal to identify whether the file is a specific distribution packet or a specific file type. It can be used for compatibility verification and helps the receiving terminal determine whether the file distribution packet format matches. The version number is used to identify the file iteration status and can be used to distinguish file modification or change information. The header identifier and version number can be carried by a fixed-length byte field or a variable-length encoded field. The header identifier is used to limit the packet body parsing type, and the version number is used to indicate the format version corresponding to the parsing rule.
[0154] When constructing a file distribution packet, the header identifier and version number in the packet header area are first determined. Then, the metadata, encrypted password block, encrypted file block, and tail signature are written into the same file container in a predetermined order, and the boundaries of each field are marked. This allows the receiving terminal to identify the type based on the header identifier, determine format compatibility based on the version number, and then parse the metadata to locate the encrypted password block and encrypted file block. The tail signature is usually placed at the end of the packet body and is used to associate the aforementioned content with integrity. It can be generated by combining the metadata digest, encrypted password block digest, and encrypted file block digest, thus establishing a correspondence between the packet body content and the signature.
[0155] The file distribution packet uses a header identifier as the packet type entry, a version number as the parsing constraint, and combines metadata, encrypted password blocks, encrypted file blocks, and a tail signature to complete the overall encapsulation, enabling the receiving terminal to still recognize the packet structure and complete the unpacking process in an offline environment.
[0156] In this embodiment, the file distribution packet can simultaneously carry file identification information, version compatibility information, metadata information, and encrypted content information within the same carrier. The receiving terminal can complete format determination and content parsing without relying on external services. Furthermore, by setting the combination of header identifier and version number, distribution packets of different formats can maintain distinguishability in the same transmission link.
[0157] This application also provides a file decryption method, applied to a receiving terminal. Figure 3 This is a flowchart illustrating a file decryption method provided in an embodiment of this application. Figure 3 As shown, the method includes:
[0158] S301, Receive file distribution packets sent by the sending terminal.
[0159] The file distribution package is obtained by encrypting the original file using the above-mentioned file encryption method.
[0160] In this step, the file distribution packet serves as a data packet for the receiving terminal to decrypt, carrying the information required for subsequent decryption. Specifically, it is an overall data unit generated by the sending terminal and sent to the receiving terminal. This overall data unit includes at least structured content for parsing and an encrypted file distribution packet for subsequent decryption.
[0161] In this embodiment, the receiving terminal can be a terminal device with data reception, data parsing, and file recovery capabilities. Specifically, it can be a personal computer, portable computing device, dedicated secure terminal, or mobile terminal with a secure storage area and cryptographic operation module. Receiving a file distribution packet sent by the sending terminal indicates that the receiving terminal obtains the file distribution packet from an external input link and writes the file distribution packet into local memory or controlled storage space as input for subsequent parsing processing.
[0162] For example, the receiving terminal can receive file distribution packets via network transmission or via offline media. When receiving via network transmission, the sending terminal can send the file distribution packet via email attachments, instant messaging files, file transfer protocol links, or a local area network shared directory. After detecting the arrival of the target file in the corresponding client, receiving service process, or monitoring directory, the receiving terminal reads the binary content of the file distribution packet and records receiving context information such as the receiving time, source identifier, and file length. When receiving via offline media, the file distribution packet can be stored in a removable storage device, optical disc, dedicated encrypted media, or near-field transmission medium. After detecting media mounting or completing near-field data import, the receiving terminal copies the file distribution packet to its local processing directory and locks this copy as the input file for a single decryption task.
[0163] S302. Parse the file distribution packet to obtain the metadata, encrypted password block, encrypted file block and tail signature in the file distribution packet.
[0164] In this step, the receiving terminal can read and locate the relevant content in the file distribution packet according to the preset encapsulation format, and extract metadata, encrypted password blocks, encrypted file blocks and tail signatures respectively.
[0165] S303. Perform integrity verification on the file distribution packet based on the tail signature. If the verification is successful, use the private key to decrypt the encrypted password block to obtain a random password.
[0166] If the integrity verification passes, it is confirmed that the file distribution package has not been tampered with, truncated, or damaged. Then, the encrypted password block is decrypted using the private key to obtain the random password.
[0167] The key data in the encrypted key block is bound to the identity of the receiving terminal. When the sending terminal generates the file distribution packet, it has encrypted the random password with the corresponding receiving terminal's public key and written it into the encrypted key block. After the receiving terminal parses the key record belonging to itself, it calls the local private key to complete the key recovery and obtains the encryption key actually used to decrypt the file content.
[0168] When there is only one receiving terminal, the data corresponding to the encrypted cipher block can be directly parsed to obtain the key data. When there are multiple receiving terminals, each terminal first parses its index to determine the key data corresponding to that terminal. The key data may include at least one of an encryption key or encryption identification information. If the encryption key is obtained, a decryption algorithm is determined based on the encryption identification information. This algorithm is then used to decrypt the encryption key using the receiving terminal's private key, thereby obtaining the random cipher.
[0169] S304. Use a random password to decrypt the encrypted file blocks to obtain the compressed file.
[0170] When the receiving terminal obtains a random password, it uses the random password to decrypt the ciphertext of the encrypted file block in the compressed file, thereby obtaining the compressed file. The data content of the decrypted compressed file is consistent with the content before encryption.
[0171] S305. Decompress the compressed file based on metadata to obtain the original file, and perform integrity verification on the original file based on metadata.
[0172] In this step, the compressed file attributes are first obtained based on the metadata to obtain information such as the compression algorithm type. Then, the compressed file is decompressed using the corresponding compression algorithm. All files in the compressed file are extracted in turn, and the corresponding file attributes such as file name, file size and modification timestamp in the metadata are referenced to write the corresponding files locally and set the corresponding attributes.
[0173] The integrity of the original file is verified based on the metadata. The entire contents of the decompressed file are read sequentially, the hash value of the file is calculated, and the hash value is compared with the hash value pre-stored in the metadata. If the two hash values match, the integrity verification passes, thus confirming that the original decompressed file has not been tampered with.
[0174] The file decryption method provided in this embodiment receives a file distribution packet sent by a sending terminal, parses the file distribution packet to obtain metadata, encrypted password blocks, encrypted file blocks, and a tail signature, thereby obtaining the basic data for subsequent parsing of the file distribution packet; performs integrity verification on the file distribution packet based on the tail signature to prevent tampering of the file distribution packet; if the verification passes, the encrypted password blocks are decrypted using a private key to obtain a random password; the encrypted file blocks are decrypted using the random password to obtain a compressed file; the compressed file is decompressed based on the metadata to obtain the original file, and the integrity of the original file is verified based on the metadata to determine the integrity of the decompressed original file, thereby completing the recovery of the original file without transmitting a separate password and meeting the independent decryption requirements in multi-receiving terminal distribution scenarios.
[0175] Optionally, the file distribution package also includes a header identifier and a version number. The integrity of the file distribution package is verified based on the tail signature, including: verifying the legality of the file distribution package based on the header identifier and version number; and verifying the integrity of the file distribution package based on the tail signature if the file distribution package is verified to be legal.
[0176] In this embodiment, the header identifier is used to determine the file type, and the version number is used to distinguish the file iteration status. Based on the header identifier, it can be confirmed whether the file distribution package is compatible with the receiving terminal. The version number can be used to determine the original file revision version in the file distribution package, and thus determine whether the original file is the latest file.
[0177] Once the legitimacy of the file distribution package is confirmed, the receiving terminal first calculates the signature value based on the extracted metadata, encrypted password block, and encrypted file block data, and compares it with the tail signature to complete the integrity verification.
[0178] By verifying the legitimacy of file distribution packages using header identifiers and version numbers, invalid files can be quickly filtered out, and version compatibility management can be implemented to avoid parsing errors between file distribution packages of different formats. After confirming the legitimacy of the file distribution package, an integrity check is performed based on the tail signature. This two-level verification strategy involves first screening for legitimacy, and then verifying integrity based on the tail signature. The first-level check intercepts illegal data packets and reduces invalid password operations, while the integrity check confirms that the file distribution package has not been tampered with.
[0179] The following combination Figure 4 The file encryption and decryption methods of the embodiments of this application will be further described, such as... Figure 4 As shown, the file encryption method is applied to the sending terminal, and the file decryption method is applied to the receiving terminal.
[0180] At the sending terminal, the user selects the original file to be encrypted. The sending terminal reads the file's filename, size, modification time, and other file attribute information, as well as its hash value. It then compresses the original file, recording compression parameters such as the compressed file size, compressed file identifier, and compression ratio. The file attribute information, hash value, and compression parameters are recorded as metadata, which can be in JSON format.
[0181] After the metadata is generated, the sending terminal generates a random password. This random password can be a 256-bit random string generated by a pseudo-random number generator and stored using Base64 encoding for easy encapsulation and transmission. This random password is then used to perform symmetric encryption on the compressed file, yielding the compressed file ciphertext and an authentication tag. The encryption algorithm can be AES-256-GCM. Finally, encrypted file blocks are generated based on the compressed file ciphertext and the authentication tag.
[0182] Subsequently, the random cipher is asymmetrically encrypted using the receiving terminal's public key. Before encryption, the public key is verified, including checking the validity of the key format and whether the security parameters meet the requirements. For example, organization A uses an RSA public key, organization B uses an ECC public key, and organization C uses an RSA public key. The RSA key length is no less than 2048 bits. After successful verification, an encryption key and encryption identification information are generated based on the public key and the random cipher. If there are multiple receiving terminals, a corresponding encryption key is generated for each receiving terminal based on its public key, and a corresponding receiving terminal index is established. For a single receiving terminal, an encrypted cipher block is generated based on the encryption key and encryption identification information. For multiple receiving terminals, an encrypted cipher block is constructed based on the receiving terminal index, encryption key, and encryption identification information.
[0183] After obtaining the metadata, encrypted password block, and encrypted file block, the sending terminal calculates a tail signature based on these elements. The tail signature can be calculated using HMAC-SHA256. It then determines the header identifier and version number of the file distribution packet, for example, the header identifier is "SECPKGMT" and the version number is "V1". Next, the header identifier, version number, metadata, encrypted password block, encrypted file block, and tail signature are combined according to a predetermined encapsulation format to construct the file distribution packet, for example, forming a ".secure" format file "data.secure", which is then sent to the corresponding receiving terminal via email or physical media.
[0184] After receiving the file distribution packet, the receiving terminal first reads the packet header data, checking the header identifier, version number, and other content to confirm the packet's legitimacy. If the packet is confirmed to be legitimate, it calculates a new tail signature based on the packet content and compares the recalculated tail signature with the tail signature carried within the packet. If they match, it parses the encrypted cryptographic block to obtain the encryption key data. In the case of multiple receiving terminals, each terminal can combine its own private key and metadata information to locate the encryption key data corresponding to its own terminal from the encrypted cryptographic block.
[0185] After obtaining the encryption key data, the receiving terminal determines the decryption algorithm based on the encryption identifier information in the encryption key data, uses the corresponding decryption algorithm to decrypt the encryption key according to the receiving terminal's private key, thereby obtaining a random password, and decompresses the compressed file according to the random password to obtain a compressed file.
[0186] Then, based on the compressed file attributes in the metadata, the compression algorithm type and other information are determined. The corresponding compression algorithm is used to decompress the compressed file, and all files in the compressed file are extracted in turn. The hash value of the file is then calculated and compared with the hash value of the original file recorded in the metadata. If the two are the same, the decompressed file is identified as the original file.
[0187] Figure 5 This is a schematic diagram of a file encryption device provided in an embodiment of this application, as shown below. Figure 5 As shown, the file encryption device 500 provided in this application embodiment includes: a compression module 501, a first generation module 502, a second generation module 503, a determination module 504, and a construction module 505, wherein:
[0188] Compression module 501 is used to compress the original file to obtain a compressed file and record the metadata of the original file;
[0189] The first generation module 502 is used to generate a random password, encrypt the compressed file according to the random password, and generate an encrypted file block;
[0190] The second generation module 503 is used to perform asymmetric encryption on the random password using the public key of the receiving terminal to generate an encrypted password block.
[0191] Module 504 is used to determine the tail signature based on metadata, encrypted cryptographic blocks, and encrypted file blocks;
[0192] Module 505 is used to build a file distribution package based on metadata, encrypted cryptographic blocks, encrypted file blocks, and a tail signature.
[0193] Optionally, the first generation module 502 is further configured to:
[0194] The original file is symmetrically encrypted using a random password to obtain the compressed ciphertext and authentication tag.
[0195] An encrypted file block is generated based on the ciphertext of the compressed file and the authentication tag.
[0196] Optionally, the second generation module 503 is also used for:
[0197] The public key is verified. If the verification passes, the public key is used to perform asymmetric encryption on the random password to obtain the encryption key.
[0198] An encrypted cryptographic block is generated based on the encryption key and encryption identification information.
[0199] Optionally, the compression module 501 is also used for:
[0200] Get the file attributes and hash value of the original file;
[0201] Compress the original file to obtain a compressed file, and record the attributes of the compressed file;
[0202] Record file attributes, hash values, and compressed file attributes as metadata.
[0203] Optionally, the building module 505 is also used for:
[0204] Determine the header identifier and version number of the file distribution package;
[0205] The file distribution package is constructed in the following order: header identifier, version number, metadata, encrypted password block, encrypted file block, and tail signature.
[0206] Optionally, the second generation module 506 is also used for:
[0207] When there are multiple receiving terminals, the public key of each receiving terminal is used to perform asymmetric encryption on the random password to generate the encrypted password block corresponding to each receiving terminal.
[0208] Figure 6 This is a schematic diagram of a file decryption device provided in an embodiment of this application, as shown below. Figure 6 As shown, the file decryption device 600 provided in this embodiment includes: a receiving module 601, a parsing module 602, a verification module 603, a decryption module 604, and a decompression module 605, wherein:
[0209] The receiving module 601 is used to receive a file distribution packet sent by the sending terminal. The file distribution packet is obtained by encrypting the original file using a device such as that of a third party.
[0210] The parsing module 602 is used to parse the file distribution packet to obtain the metadata, encrypted password block, encrypted file block and tail signature in the file distribution packet;
[0211] The verification module 603 is used to perform integrity verification on the file distribution package based on the tail signature. If the verification is successful, the encrypted password block is decrypted using the private key to obtain a random password.
[0212] The decryption module 604 is used to decrypt the encrypted file blocks using a random password to obtain a compressed file;
[0213] The decompression module 605 is used to decompress the compressed file based on metadata to obtain the original file, and to perform integrity verification on the original file based on metadata.
[0214] Optionally, the file distribution package also includes a header identifier and a version number, and the verification module 603 is further used for:
[0215] The legitimacy of the file distribution package is confirmed based on the header identifier and version number;
[0216] If the file distribution package is confirmed to be legitimate, the integrity of the file distribution package is verified based on the tail signature.
[0217] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 7 As shown, the electronic device 700 of this embodiment may include: at least one processor 701, and a memory 702 communicatively connected to the at least one processor; wherein, the memory 702 stores instructions that can be executed by the at least one processor 701, and the instructions are executed by the at least one processor 701 to cause the electronic device to perform the method as described in any of the above embodiments.
[0218] Alternatively, the memory 702 can be either standalone or integrated with the processor 701.
[0219] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the foregoing embodiments, and will not be repeated here.
[0220] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method of any of the foregoing embodiments.
[0221] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method of any of the foregoing embodiments.
[0222] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0223] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0224] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0225] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or in the form of software program modules.
[0226] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0227] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0228] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0229] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only.
[0230] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.
Claims
1. A file encryption method, characterized in that, Applied to a transmitting terminal, the method includes: The original file is compressed to obtain a compressed file, and the metadata of the original file is recorded. Generate a random password, encrypt the compressed file according to the random password, and generate an encrypted file block; The random password is asymmetrically encrypted using the public key of the receiving terminal to generate an encrypted password block; The tail signature is determined based on the metadata, the encrypted password block, and the encrypted file block; A file distribution package is constructed based on the metadata, the encrypted password block, the encrypted file block, and the tail signature.
2. The method according to claim 1, characterized in that, The step of encrypting the compressed file according to the random password to generate an encrypted file block includes: The compressed file is symmetrically encrypted using the random password to obtain the ciphertext of the compressed file and the authentication tag. The encrypted file block is generated based on the encrypted compressed file and the authentication tag.
3. The method according to claim 1, characterized in that, The step of using the public key of the receiving terminal to perform asymmetric encryption on the random password to generate an encrypted password block includes: The public key is verified. If the verification passes, the public key is used to perform asymmetric encryption on the random password to obtain the encryption key. The encrypted password block is generated based on the encryption key and encryption identification information.
4. The method according to any one of claims 1-3, characterized in that, The process of compressing the original file to obtain a compressed file and recording the metadata of the original file includes: Obtain the file attributes and hash value of the original file; The original file is compressed to obtain the compressed file, and the attributes of the compressed file are recorded. The file attributes, the hash value, and the compressed file attributes are recorded as the metadata.
5. The method according to any one of claims 1-3, characterized in that, The step of constructing a file distribution package based on the metadata, the encrypted cryptographic block, the encrypted file block, and the tail signature includes: Determine the header identifier and version number of the file distribution package; The file distribution package is constructed in the order of the header identifier, the version number, the metadata, the encrypted password block, the encrypted file block, and the tail signature.
6. The method according to any one of claims 1-3, characterized in that, The step of using the public key of the receiving terminal to perform asymmetric encryption on the random password to generate an encrypted password block includes: When there are multiple receiving terminals, the random password is asymmetrically encrypted using the public key of each receiving terminal to generate an encrypted password block corresponding to each receiving terminal.
7. A file decryption method, characterized in that, Applied to a receiving terminal, the method includes: The system receives a file distribution packet sent by a sending terminal, wherein the file distribution packet is obtained by encrypting the original file using the method described in any one of claims 1-5; The file distribution packet is parsed to obtain the metadata, encrypted password block, encrypted file block, and tail signature in the file distribution packet; The integrity of the file distribution package is verified based on the tail signature. If the verification is successful, the encrypted password block is decrypted using the private key to obtain the random password. The encrypted file block is decrypted using the random password to obtain the compressed file; The compressed file is decompressed based on the metadata to obtain the original file, and the integrity of the original file is verified based on the metadata.
8. The method according to claim 7, characterized in that, The file distribution package also includes a header identifier and a version number. The integrity verification of the file distribution package based on the tail signature includes: Based on the header identifier and the version number, the legitimacy of the file distribution package is confirmed; If the file distribution package is confirmed to be legitimate, the integrity of the file distribution package is verified based on the tail signature.
9. A file encryption device, characterized in that, The device includes: a compression module, a first generation module, a second generation module, a determination module, and a construction module, wherein: The compression module is used to compress the original file to obtain a compressed file and record the metadata of the original file. The first generation module is used to generate a random password, encrypt the compressed file according to the random password, and generate an encrypted file block; The second generation module is used to perform asymmetric encryption on the random password using the public key of the receiving terminal to generate an encrypted password block; The determining module is used to determine the tail signature based on the metadata, the encrypted password block, and the encrypted file block; The construction module is used to construct a file distribution package based on the metadata, the encrypted password block, the encrypted file block, and the tail signature.
10. A file decryption device, characterized in that, The device includes: a receiving module, a parsing module, a verification module, a decryption module, and a decompression module, wherein: The receiving module is used to receive a file distribution packet sent by the sending terminal, wherein the file distribution packet is obtained by encrypting the original file using the device as described in claim 9; The parsing module is used to parse the file distribution package to obtain the metadata, encrypted password block, encrypted file block and tail signature in the file distribution package; The verification module is used to perform integrity verification on the file distribution package based on the tail signature. If the verification is successful, the encrypted password block is decrypted using the private key to obtain the random password. The decryption module is used to decrypt the encrypted file block using the random password to obtain the compressed file; The decompression module is used to decompress the compressed file based on the metadata to obtain the original file, and to perform integrity verification on the original file based on the metadata.