A method for implementing a one-to-one compression, encryption, and decryption key document security tool
Through the compression encryption and decryption tool blocks of multiple encryption and one-to-one decryption, the risk of leakage and loss of important files during the compression process is solved, and the balance between file security and space saving is achieved.
Patent Information
- Application Number
- CN202111533115.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2041-12-15
AI Technical Summary
In the prior art, important confidential and critical files are at risk of leakage and loss during the compression process, and composite compression encryption and secondary encryption cannot be achieved, resulting in insufficient file security.
The compression encryption tool block and the decryption decompression tool block are adopted to achieve multiple encryption and one-to-one decryption of files through compression algorithms, multiple encryption algorithms and merge file stream modules, and combine MD5 strings and RSA algorithms to ensure file security.
While compressing files to save space, it enhances the security of files, reduces the risks of loss and leakage, ensures that each encryption corresponds to a unique decryption, and improves the confidentiality complexity of files.
Smart Images

Figure CN114417365B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data compression and encryption. Specifically, it relates to a method for implementing a one-to-one compression, encryption, and decryption key document security tool. Background Art
[0002] In today's information age, information security issues are becoming increasingly important. We often need a measure to protect our data from being leaked or damaged. Therefore, objectively, a powerful security measure is needed to protect confidential data from being stolen or tampered with. The way to solve this problem is data encryption. Encryption technology is the core technology of network and information security. Its basic design idea is to store and transmit the data to be sent after being transformed by an encryption algorithm. The authorized recipient uses the corresponding decryption algorithm to transform and restore the data. Illegal recipients cannot see or understand the data, thus achieving the purpose of information security. In addition, in today's era of data explosion, various data volumes have increased significantly. To save storage space and transmission efficiency, it is often necessary to compress files.
[0003] Currently, file encryption generally uses common compression such as RAR, ZIP, 7Z, etc. and password methods. For important confidential key files, the compressing personnel may forget to set a password, or the password may be too simple, or due to vulnerability attacks on different versions of compression software on the Internet, or due to the loss of a mobile hard disk, etc., resulting in file leakage. There is no combined means in the network and the market that can perform composite compression and encryption and perform secondary encryption on the compressed information to ensure the security of key files. The long-distance offline carrier transmission of files cannot guarantee 100% safe arrival, and there are risks of loss and leakage. Summary of the Invention
[0004] In order to overcome the above deficiencies in the prior art, the present invention provides a method for implementing a one-to-one compression, encryption, and decryption key document security tool that encrypts a file and re-encrypts the file information of the encrypted file while ensuring that the compressed key file saves space, thereby ensuring the security of the file.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0006] A method for implementing a one-to-one compression, encryption, and decryption key document security tool, the one-to-one compression, encryption, and decryption key document security tool includes a compression and encryption tool block and a corresponding decryption and decompression tool block. Among them, the compression and encryption tool block includes a compression algorithm module, a first encryption algorithm module, a second encryption algorithm module, a third encryption algorithm module, and a merged file stream module. The decryption and decompression tool block includes a key module and a decryption and decompression algorithm module. The method for implementing the one-to-one compression, encryption, and decryption key document security tool includes the following steps:
[0007] S1: Select the file to be compressed and encrypted as the original file;
[0008] S2: Use the compression algorithm module and the first encryption algorithm module to perform an interference algorithm on the original file in step S1 and then perform compression processing and output the first file stream. Use the second encryption algorithm module to encrypt the file information of the first file stream again and obtain the file header record, file tail record, and second file stream. Use the third encryption algorithm module to encrypt the file tail record and output the one-to-one secret key record and the third file stream. Then, through the merged file stream module, merge the file header record, second file stream, and third file stream to obtain the final compressed and encrypted file;
[0009] S3: Use the decryption key module to decrypt the encrypted and compressed file information to obtain the file structure information, and restore the original file compression stream through the decrypted information. Finally, use the compression restoration algorithm module to decompress and restore the final compressed and encrypted file;
[0010] S4: Output all the original files.
[0011] Further, the step S2 includes the following sub-steps:
[0012] S201: Encrypt the original file information in step S1 using the first encryption algorithm module, and then output the first file stream through the compression algorithm module;
[0013] S202: Use the second encryption algorithm module to encrypt the first file stream in step S201 and output the file header record, second file stream, and file tail record;
[0014] S203: Use the third encryption algorithm module to encrypt the file tail record in step S202 again and output the decrypted one-to-one secret key record and the third file stream;
[0015] S204: Use the merged file stream module to merge the file header record output in step S202, the second file stream, and the third file stream output in step S203 to obtain the final compressed and encrypted file.
[0016] Further, the step S3 includes the following sub-steps:
[0017] S301: Read the file tail record information of the encrypted and compressed file, and obtain the file tail record information in step S203 according to the file header record information;
[0018] S302: For the file stream after removing the file tail record and file header record information, use the decryption algorithm corresponding to the method in step S202 to obtain the decrypted file compression stream;
[0019] S303: Use the compression restoration algorithm module to interpret the file interference information based on the file header record output in step S301. After throwing out the interference information for a single file, output the original file.
[0020] Furthermore, random interference data is added to the first file stream in step S201, and the random interference data is discarded in step S303.
[0021] Furthermore, the random interference data consists of an MD5 string and a random-length string.
[0022] Furthermore, a fast encryption algorithm is performed on the second file stream in step S202, and the data stream is decrypted in step S302.
[0023] Furthermore, the second encryption algorithm module adopts a salted HASH algorithm model or an XXTEA algorithm model.
[0024] Furthermore, a one-to-one complex encryption algorithm is added to the third file stream in step S203, and the data is decrypted using a one-to-one secret key in step S301.
[0025] Furthermore, the first encryption algorithm module adopts an algorithm model matching the KV storage.
[0026] Furthermore, the third encryption algorithm module adopts an RSA algorithm model.
[0027] Compared with the prior art, the present invention has the following beneficial effects:
[0028] (1) By adopting diverse encryption means, the present invention performs spatial compression encryption on the file, and further performs multiple confidentiality encryptions on the entire compressed file, further reducing the file occupied space. At the same time, it also realizes the separation of the file and the decryption tool. By separately sending the compressed file and the decryption tool, the file to be decrypted can be protected more reliably, achieving a one-to-one correspondence between each encryption and a unique decryption tool, and the decryption tool can only decrypt the corresponding encrypted file, achieving a one-to-one mode, thereby reducing the possibility of leakage of the lost file, enhancing the confidentiality complexity of the compressed file, and ensuring the security of the file.
[0029] (2) Through the setting of the key process steps of compression encryption, the present invention uses the third encryption algorithm module to encrypt the file tail record information again and output a one-to-one secret key record, and uses the merged file stream module to merge the file header record, the second file stream, and the third file stream to obtain the final compressed encrypted file, which not only reduces the file occupied space, but also the output encrypted secret key record further enhances the security of the file.
[0030] (3) By setting the key process steps of decryption and decompression, the present invention enables the decryption of one-to-one key records only by using the decryption key module, realizing that each encryption corresponds to a unique decryption tool once, and achieving one-to-one protection of files.
[0031] (4) By adding random interference data to the files during the encryption process, the present invention enhances the encryption protection of the files. At the same time, the random interference data is composed of an MD5 string and a random-length string, further enhancing the complexity of the security level.
[0032] (5) The present invention encrypts by adopting a salted HASH algorithm model or an XXTEA algorithm model, and encrypts again by adopting an RSA algorithm model. These algorithm models not only have a simple structure, but also have strong portability and strong anti-decompression ability, and well realize the encryption function. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a flowchart of the implementation method of the security tool of the present invention.
[0034] Figure 2 is a schematic diagram of the key process of compression and encryption of the present invention.
[0035] Figure 3 is a schematic diagram of the key process of decryption and decompression of the present invention.
[0036] Figure 4 is a schematic diagram of the compression and encryption log information of the present invention.
[0037] Figure 5 is a schematic diagram of the decryption and decompression log information of the present invention.
[0038] Figure 6 is a schematic diagram of the comparison between the encrypted file content and the decrypted file content of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0039] The present invention will be further described below in conjunction with the drawings and embodiments. The implementation modes of the present invention include but are not limited to the following embodiments.
[0040] Embodiment
[0041] As Figures 1 to 3 shown, this embodiment provides a method for implementing a one-to-one compression and encryption key document security tool. The one-to-one compression and encryption key document security tool includes a compression and encryption tool block and a corresponding decryption and decompression tool block. Among them, the compression and encryption tool block includes a compression algorithm module, a first encryption algorithm module, a second encryption algorithm module, a third encryption algorithm module, and a merged file stream module. The decryption and decompression tool block includes a key module and a decryption and decompression algorithm module. The method for implementing the one-to-one compression and encryption key document security tool includes the following steps:
[0042] S1: Select the file to be compressed and encrypted as the original file;
[0043] S2: Use the compression algorithm module and the first encryption algorithm module to perform an interference algorithm on the original file in step S1 and then perform compression processing and output the first file stream. Use the second encryption algorithm module to encrypt the file information of the first file stream again and obtain the file header record, file tail record, and second file stream. Use the third encryption algorithm module to encrypt the file tail record and output the one-to-one secret key record and the third file stream. Then, use the merged file stream module to merge the file header record, second file stream, and third file stream to obtain the final compressed and encrypted file;
[0044] S3: Use the decryption key module to decrypt the encrypted and compressed file information to obtain the file structure information, and restore the original file compression stream through the decrypted information. Finally, use the compression restoration algorithm module to decompress and restore the final compressed and encrypted file again;
[0045] S4: Output all the original files.
[0046] In this embodiment, while ensuring the compression of key files to save space, the files are compressed and encrypted, and the file information in the compressed and encrypted files is encrypted again, so that the encrypted and compressed files and the decryption tool exist independently, reducing the possibility of leakage of lost files and enhancing the confidentiality complexity of the compressed files, thus ensuring the security of the files.
[0047] In this embodiment, step S2 includes the following sub-steps:
[0048] S201: Encrypt the original file information in step S1 using the first encryption algorithm module, and then output the first file stream through the compression algorithm module;
[0049] S202: Encrypt the first file stream in step S201 using the second encryption algorithm module and output the file header record, second file stream, and file tail record;
[0050] S203: Use the third encryption algorithm module to encrypt the file tail record in step S202 again and output the decrypted one-to-one secret key record and the third file stream;
[0051] S204: Use the merged file stream module to merge the file header record output in step S202, the second file stream, and the third file stream output in step S203 to obtain the final compressed and encrypted file.
[0052] In this embodiment, by setting up key processes for compression and encryption, using the third encryption algorithm module to re-encrypt the file tail record information and output a one-to-one secret key record, and using the merged file stream module to merge the file header record, the second file stream, and the third file stream to obtain the final compressed and encrypted file, not only reduces the file occupancy space, but also the output encrypted secret key record further enhances the security of the file.
[0053] In this embodiment, step S3 includes the following sub-steps:
[0054] S301: Read the file tail record information from the encrypted and compressed file, and obtain the file tail record information in step S203 according to the file header record information;
[0055] S302: For the file stream after removing the file tail record and the file header record information, use the decryption algorithm corresponding to the method in step S202 to obtain the decrypted file compression stream;
[0056] S303: Use the compression restoration algorithm module to interpret the file interference information in combination with the file header record output in step S301, and output the original file after a single file throws out the interference information.
[0057] In this embodiment, by setting up key processes for decryption and decompression, the one-to-one secret key record can be decrypted only by using the decryption secret key module, realizing a unique decryption tool for each encryption, and achieving one-to-one protection of the file.
[0058] In this embodiment, random interference data is added to the first file stream in step S201, and the random interference data is discarded in step S303. The random interference data is composed of an MD5 string and a random length string.
[0059] In this embodiment, by adding random interference data to the file during the encryption process, the encryption protection of the file is enhanced. At the same time, the random interference data is composed of an MD5 string and a random length string, further enhancing the confidentiality complexity. The MD5 in this embodiment is short for MD5 Message-Digest Algorithm, which is a message digest encryption algorithm. The random length string is composed of numbers, letters, and special symbols, and random characters are obtained by randomly selecting characters a certain number of times within a certain random length.
[0060] In this embodiment, a fast encryption algorithm is performed on the second file stream in step S202, and the data stream is decrypted in step S302; the second encryption algorithm module adopts a salted HASH algorithm model or an XXTEA algorithm model; a one-to-one complex encryption algorithm is added to the third file stream in step S203, and the data is decrypted using a one-to-one secret key in step S301; the first encryption algorithm module adopts an algorithm model matching the KV storage; the third encryption algorithm module adopts an RSA algorithm model.
[0061] In this embodiment, the first encryption algorithm module adopts an algorithm model matching the KV storage; the second encryption algorithm module adopts a salted HASH algorithm model or an XXTEA algorithm model; the third encryption algorithm module adopts an RSA algorithm model, where KV storage refers to Key-value storage, which is a database storage that stores data in a key-value correspondence.
[0062] In this embodiment, encryption is performed using the salted HASH algorithm model or the XXTEA algorithm model adopted, and at the same time, re-encryption is performed using the RSA algorithm model. These algorithm models are not only simple in structure, but also have strong portability and strong decompression resistance, and well realize the encryption function.
[0063] In this embodiment, in combination Figures 4 to 6 as shown, first select the file "Record111.txt" marked with a square box in Figure 6 as the original file to be compressed and encrypted, and use an encryption tool for encryption. The encryption log information is as Figure 4 shown. First, random scrambling information of MD5 + random string is written to the file, then the LZMA algorithm is used for file compression, then the HASH algorithm or the XXTEA algorithm is used for file encryption, and a file tail record is generated. Then, the RSA algorithm is used to encrypt the file tail record. Finally, the encrypted compressed file "t1.xb" is written, and an encrypted secret key record "kv.pass" is generated. Then, the corresponding decryption and decompression tool is used to decrypt the encrypted compressed file "t1.xb". The log information of the decryption and decompression tool is as Figure 5 shown. First, read the private key content of the encrypted secret key record "kv.pass", and read the encrypted file tail information according to the position of the file tail record in the entire compressed and encrypted file. Use the private key for decryption to obtain the basic information of the encrypted file and the file header record. Then, perform xxtea decryption and decompression using the LZMA algorithm according to the basic information of the file and the file header record, and use the KV relationship to discard the random interference data, so as to obtain the original file data. Compare the content of the decompressed file with the content of the file before decompression. As Figure 6 shown, the content is exactly the same.
[0064] When the present invention is in use, based on the compression algorithm module, the first encryption algorithm module, the second encryption algorithm module, the third encryption algorithm module, the merged file stream module, the secret key module, and the decryption and decompression algorithm module, the original file to be compressed and encrypted is compressed and encrypted by the compression algorithm module and the first encryption algorithm module, and the second encryption algorithm module is used to compress the encrypted and compressed data to obtain the file header record and the file tail record information. After the file tail record information is encrypted again, the final compressed and encrypted file is obtained through the merged file stream module. In the decryption and decompression process, the secret key module is used to decrypt the encrypted file information, and the decryption and decompression algorithm module is used to decrypt and decompress the final compressed and encrypted file. Finally, the file interference information is discarded, and the original file is output. The present invention adopts a multi-algorithm diversity encryption method to compress and encrypt the space of the file, and further performs secondary confidentiality encryption on the entire compressed file, further reducing the file occupancy space. At the same time, it also realizes the separation of the file and the decryption tool. By separately sending the compressed file and the decryption tool, the file to be decrypted can be protected more reliably, realizing a unique decryption tool for each encryption, and the decryption tool can only decrypt the corresponding encrypted file, achieving a one-to-one mode, so that the possibility of leakage of the lost file is reduced, strengthening the secrecy complexity of the compressed file and ensuring the security of the file.
[0065] The above embodiments are only the preferred embodiments of the present invention, and do not limit the protection scope of the present invention. Any changes made by adopting the design principle of the present invention and non-creative labor on this basis shall fall within the protection scope of the present invention.
Claims
1. A method for implementing a one-to-one compression, encryption and decryption key document security tool, characterized in that The one-to-one compression and decryption key document security tool includes a compression and encryption tool block and a corresponding decryption and decompression tool block. Among them, the compression and encryption tool block includes a compression algorithm module, a first encryption algorithm module, a second encryption algorithm module, a third encryption algorithm module, and a merged file stream module. The decryption and decompression tool block includes a secret key module and a decryption and decompression algorithm module. The implementation method of the one-to-one compression and decryption key document security tool includes the following steps: S1: Select the file to be compressed and encrypted as the original file; S2: Use the compression algorithm module and the first encryption algorithm module to perform an interference algorithm on the original file in step S1 and then perform compression processing to output the first file stream. Use the second encryption algorithm module to encrypt the file information of the first file stream again to obtain a file header record, a file tail record, and a second file stream. Use the third encryption algorithm module to encrypt the file tail record to output a one-to-one secret key record and a third file stream. Then, use the merged file stream module to merge the file header record, the second file stream, and the third file stream to obtain the final compressed and encrypted file; S3: Use the decryption secret key module to decrypt the final compressed and encrypted file to obtain file structure information, and restore the original file compression stream through the file structure information. Finally, use the compression restoration algorithm module to perform decompression and restoration processing on the final compressed and encrypted file again; S4: Output all the original files.
2. The implementation method of a one-to-one compression and decryption key document security tool according to claim 1, characterized in that, The step S2 includes the following sub-steps: S201: Use the first encryption algorithm module to encrypt the original file information in step S1, and then output the first file stream through the compression algorithm module; S202: Use the second encryption algorithm module to encrypt the first file stream in step S201 to output a file header record, a second file stream, and a file tail record; S203: Use the third encryption algorithm module to encrypt the file tail record in step S202 again to output a decrypted one-to-one secret key record and a third file stream; S204: Use the merged file stream module to merge the file header record output in step S202, the second file stream, and the third file stream output in step S203 to obtain the final compressed and encrypted file.
3. The implementation method of a one-to-one compression, encryption and decryption key document security tool according to claim 2, characterized in that The step S3 includes the following sub-steps: S301: Read the file tail record information of the final compressed and encrypted file, and obtain the file tail record information in step S203 according to the file header record information; S302: For the file stream after removing the file tail record information, use the decryption algorithm corresponding to the method in step S202 to obtain the decrypted file compression stream; S303: Use the compression restoration algorithm module to interpret the file interference information in combination with the file tail record information output in step S301, and output the original file after excluding the interference information for a single file.
4. The implementation method of a one-to-one compression, encryption and decryption key document security tool according to claim 3, characterized in that : Random interference data is added to the first file stream in step S201, and the random interference data is discarded in step S303.
5. A method for implementing a one-to-one compression, encryption and decryption key document security tool according to claim 4, characterized in that : The random interference data is composed of an MD5 string and a random length string.
6. A method for implementing a one-to-one compression and decryption key document security tool according to claim 3, characterized in that : A fast encryption algorithm is performed on the second file stream in step S202, and the data stream is decrypted in step S302.
7. A method for implementing a one-to-one compression, encryption, and decryption key document security tool according to claim 6, characterized in that: The second encryption algorithm module adopts a salted HASH algorithm model or an XXTEA algorithm model.
8. A method for implementing a one-to-one compression, encryption, and decryption key document security tool according to claim 3, characterized in that : A one-to-one complex encryption algorithm is added to the third file stream in the step S203, and the data is decrypted using a one-to-one secret key in the step S301.
9. A method for implementing a one-to-one compression, encryption, and decryption key document security tool according to claim 8, characterized in that: The first encryption algorithm module adopts an algorithm model matching the KV storage.
10. A method for implementing a one-to-one compression, encryption, and decryption key document security tool according to claim 8, characterized in that: The third encryption algorithm module adopts an RSA algorithm model.
Citation Information
Patent Citations
Encryption and decryption method for safety transmission of non-compressed files
CN105162595A
File encryption transmission method and device
CN112311865A