Downloading method of traceability tamper-proof file, storage medium and equipment
By combining light and dark, electronic watermarks and dark QR code pictures are generated and hidden, which solves the problem of tampering and traceability during file transfer, and realizes efficient traceability and tampering of files.
Patent Information
- Application Number
- CN202411845891.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-16
AI Technical Summary
The prior art is difficult to effectively prevent files from being tampered with during transmission, and it is impossible to trace the information such as leakage time and leakage personnel.
Using a combination of light and dark, we use user authentication, record and download logs, generate electronic watermarks and anti-counterfeiting QR codes, encrypt dark pattern QR code pictures, and hide dark pattern QR code pictures through the lowest effective bit comparison between the original carrier and the supplementary carrier to ensure the traceability and tampering of the file.
It realizes effective traceability of files and anti-tampering, increases the concealment of watermark pictures, improves the difficulty and complexity of tampering, and avoids attackers stealing confidential data through taking photos.
Smart Images

Figure CN119814762A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data security technology, and in particular to a downloading method, storage medium and device for tracing and tamper-proofing files. Background Art
[0002] With the rise of network platforms in the electronic information age, information systems have gradually become an important platform for the office and management of enterprises and government agencies, helping enterprises improve service quality and reduce operating costs. Networked office has become an important environment and means for the daily work of corporate administrative agencies, and almost all of them involve internal information of the enterprise, which is often important content related to the security of corporate interests and internal stability. Therefore, from the perspective of confidentiality work, while focusing on the construction of office automation, effective confidentiality measures should also be used to effectively strengthen information security.
[0003] Under normal circumstances, the path of file transmission is exposed, and attackers can take measures to intercept and destroy the normal information transmission path. In order to protect private data from being stolen or tampered with, information hiding technology came into being. This technology protects the secret information embedded in the carrier file from being detected by attackers, thereby protecting the security of file data transmission.
[0004] File protection currently relies on complex algorithms to encrypt files. Once a file is successfully decrypted, it is difficult to keep it confidential and trace its source. When the same file is downloaded by multiple people, it is impossible to determine the time of the file's leak, the person who leaked it, whether the file has been tampered with, and other information.
[0005] There are two commonly used file tamper prevention and traceability methods: one is file watermarking, which cannot guarantee that the file will not be edited again, and the generated watermark can be easily modified or removed through AI technology; the other is asymmetric encryption of the file stream, which determines whether the file has been modified by comparing the encryption values. After the file is transmitted on the network or the user takes a screenshot, it is impossible to verify whether the file has been tampered with, and it is impossible to trace the source. Summary of the invention
[0006] In view of the problems existing in the prior art, the present invention provides a downloading method, storage medium and device for traceability and tamper-proof files, which adopts a combination of open and covert methods to ensure the traceability and tamper-proof of downloaded files.
[0007] To achieve the above technical objectives, the present invention adopts the following technical solution: a method for downloading a traceable and tamper-proof file, specifically comprising the following steps:
[0008] Step S1: When a user downloads a file on a sharing platform, he or she performs identity authentication. If the identity authentication is passed, the file is downloaded;
[0009] Step S2, recording the log information when the file is downloaded, saving it in a structured database table, and generating a folder for storing the remaining carrier files on the server side;
[0010] Step S3: Generate a temporary file according to the content of the downloaded file, convert the temporary file into a PDF file, and convert the data of each page in the PDF file into a data image in sequence;
[0011] Step S4: Generate an electronic watermark and an anti-counterfeiting QR code at different positions of each data image, and display the anti-counterfeiting QR code on the corresponding data image;
[0012] Step S5, identifying the text content in each data image through OCR, randomly extracting a number of words for position and angle shift, and recording the shift information;
[0013] Step S6: Encrypt each data image in combination with user information to generate a dark pattern QR code image;
[0014] Step S7, divide each dark pattern two-dimensional code image into fragments, rotate them in a specified order, convert them into binary images, write them into the data image, divide the data image, and fill the data image with the rotated fragments according to a clockwise natural number sequence spiral to obtain a watermark image as the original carrier, and generate a complementary carrier with the same size as the original carrier and all black;
[0015] Step S8, if the least significant bits of the original carrier and the supplementary carrier are different, change the embedding mode, if the embedding mode is changed to generate a random number of 1, change the original carrier, otherwise, change the supplementary carrier;
[0016] Step S9, synthesizing the modified original carrier and the supplementary carrier into a new data image, hiding the modified original carrier and storing it in the image layer, and sequentially splicing the modified supplementary carrier into an image file and storing it in the supplementary carrier folder;
[0017] Step S10: All the newly synthesized data images are stitched into a PDF file and provided to the user for download.
[0018] Furthermore, the log information in step S2 includes: file name, file content, download time, user ID, user name, user IP and a randomly generated UUID 32-bit download log ID.
[0019] Furthermore, the specific process of randomly extracting a number of characters for position and angle shift in step S5 is: randomly shifting the position of the extracted characters horizontally or vertically by 5 pixels, and randomly shifting the angle of the extracted characters to any value within the range of [-10°, 10°].
[0020] Furthermore, the offset information recorded in step S5 includes: file name, file page number, offset text, and corresponding offset angle and offset position.
[0021] Furthermore, step S6 includes the following sub-steps:
[0022] Step S6.1, concatenate the user ID, download time and download file name in order with underscores to obtain a string, perform MD5 encryption, and use the encrypted string as the key of the XXTEA encryption algorithm;
[0023] Step S6.2: Concatenate the user name, download time and download file name with the @ symbol as plain text, use the XXTEA encryption algorithm, and use the key in step S6.1 to encrypt the plain text to obtain an encrypted string, and generate a dark pattern QR code image with the encrypted string.
[0024] Furthermore, step S7 includes the following sub-steps:
[0025] Step S7.1, breaking each dark pattern QR code image into 4096 ordered fragments in a 64×64 grid format;
[0026] Step S7.2, setting a modulus rule for the serial numbers of the broken pictures, using this as the reverse offset rotation angle of each broken picture, and updating the position of each broken picture;
[0027] Step S7.3, converting the updated fragmented image into a binary image, and writing the binary image into the data image;
[0028] Step S7.4, divide the data image into 64×64 equal parts, take the upper left corner as the first loading position point, and fill the data image with the rotated fragments according to the clockwise natural number series spiral to obtain the watermark image as the original carrier, and generate a complementary carrier with the same size as the original carrier and completely black.
[0029] Furthermore, in step S7.2, the modulus rule of the serial number of the fragment image is specifically: the remainder of dividing the serial number of the fragment image by 360.
[0030] Furthermore, the specific process of tracing and anti-tampering verification of the PDF file downloaded by the user is as follows:
[0031] A. Find the original carrier and the complementary carrier of the corresponding file through the downloaded PDF file record, extract the least significant bit of the encrypted watermark image, merge the complementary carriers, and generate the original watermark image;
[0032] B. Divide the watermark image into 64×64 equal parts, and extract the center point fragments in reverse according to the spiral algorithm rule;
[0033] C. According to the modulus rule of the serial number of the broken image, rotate the corresponding angle in the positive direction to reset the broken image;
[0034] D. Combine the 4096 fragments into a dark pattern QR code image in a 64×64 grid format;
[0035] F. Scan the dark pattern QR code image and extract the encrypted QR code content;
[0036] G. Generate a secret key based on the file download log table, use the XXTEA algorithm to decrypt the QR code content, and perform tampering comparison;
[0037] H. Extract the offset text and offset information in the data image, compare them with the recorded offset information, and trace the source.
[0038] Furthermore, the present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the method for downloading the traceability and tamper-proof file.
[0039] Furthermore, the present invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for downloading the traceability and tamper-proof file is implemented.
[0040] Compared with the prior art, the present invention has the following beneficial effects:
[0041] (1) The method for downloading a traceable and tamper-proof file of the present invention generates an electronic watermark and an anti-counterfeiting two-dimensional code on each data image of the downloaded file, which plays a confusing role, thereby better hiding the dark pattern two-dimensional code image that is actually in use;
[0042] (2) The method for downloading the traceability anti-tampering file of the present invention rotates the dark pattern QR code image, and hides the dark pattern QR code image in different positions of the data image by comparing the least significant bits of the original carrier and the supplementary carrier, making it difficult for attackers to predict the location of the watermark image, thereby increasing the concealment of the watermark image and greatly improving the difficulty and complexity of tampering; and the dark pattern QR code image is encrypted to further improve the concealment;
[0043] (3) The method for downloading files with traceability and tamper-proofing of the present invention performs position and angle shifting by randomly extracting a number of characters and records the shift information, thereby tracing the file source and preventing attackers from stealing confidential data by taking photos. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 This is a flow chart of the method for downloading a traceability and tamper-proof file of the present invention;
[0045] Figure 2This is a schematic diagram of the rules for filling the data image with the rotating fragments according to the clockwise natural number series spiral. DETAILED DESCRIPTION
[0046] The technical solution of the present invention is further explained below in conjunction with the accompanying drawings.
[0047] like Figure 1 The flowchart of the method for downloading a traceability-proof tamper-proof file of the present invention is as follows:
[0048] Step S1, when a user downloads a file on a sharing platform, identity authentication is performed, such as verifying whether the user is logged in, whether the IP information and permission information meet the file download permission, and if the identity authentication passes, the file is downloaded.
[0049] Step S2, record the log information when the file is downloaded, save it in the structured database table, and generate a folder for storing the remaining carrier files on the server side; the log information in the present invention includes: file name, file content, download time, user ID, user name, user IP and randomly generated UUID32-bit download log ID.
[0050] Step S3: Generate a temporary file according to the content of the downloaded file, convert the temporary file into a PDF file, and convert the data of each page in the PDF file into a data image in sequence;
[0051] Step S4, generating electronic watermarks and anti-counterfeiting QR codes at different positions of each data image, and displaying the anti-counterfeiting QR codes on the corresponding data images. The present invention displays the electronic watermarks and anti-counterfeiting QR codes in plain text, on the one hand, informing users that they need to properly keep the downloaded files to prevent leakage, because the downloaded file information has been recorded and archived; on the other hand, it plays a confusing role, because the plain text electronic watermarks and anti-counterfeiting QR codes can be removed by existing AI technical means. After the attacker changes the plain text, he thinks that the electronic watermarks and anti-counterfeiting QR codes are removed, thereby better hiding the dark pattern QR code images that actually work, and the dark pattern QR code images can be traced; wherein, the electronic watermark includes: file name, user name and download time, and the anti-counterfeiting QR code includes: user name, download time, file name, IP address. The purpose of the plain text is mainly to inform the downloader to properly keep the downloaded files to prevent leakage, and the information of browsing files has been recorded and archived. The purpose of the dark text is to prevent the watermark and QR code information on the surface of the picture from being removed by AI software, and the source can still be traced through the watermark carrier hidden in the layer.
[0052] Step S5, identify the text content in each data image through OCR, randomly extract a number of characters for position and angle shift, specifically, randomly shift the position of the extracted characters horizontally or vertically by 5 pixels, and randomly shift the angle of the extracted characters to any value in the range of [-10°, 10°]; and record the shift information, including: file name, file page number, shifted text, and corresponding shift angle and shift position. The recorded shift information facilitates subsequent comparison and tracing, preventing attackers from stealing confidential data by taking photos.
[0053] Step S6: Encrypt each data image in combination with user information to generate a dark pattern QR code image; specifically, the following sub-steps are included:
[0054] Step S6.1, concatenate the user ID encoded by a 32-bit UUID string, the download time encoded by 8 digits YYYYMMDD, and the download file name in sequence by underscores to obtain a string, perform MD5 encryption, and use the encrypted string as the key of the XXTEA encryption algorithm;
[0055] Step S6.2, concatenate the user name, download time and download file name with the @ symbol as plain text, use the XXTEA encryption algorithm, and use the key in step S6.1 to encrypt the plain text to obtain an encrypted string, and use the encrypted string to generate a 4cm×4cm dark pattern QR code image. Since the dark pattern QR code image is encrypted, only a string of garbled codes is obtained when the code is scanned alone, and the specific content cannot be obtained through the garbled codes, which can improve the concealment of the dark pattern QR code image.
[0056] Step S7, divide each dark pattern QR code image into fragments, rotate them in a specified order, convert them into binary images, write them into the data image, divide the data image, and fill the data image with the rotated fragments in a clockwise natural number spiral to obtain a watermark image as the original carrier, and generate a complementary carrier with the same size as the original carrier and all black; the watermark image formed by the clockwise spiral filling method can well hide the information in the dark pattern QR code image, making it difficult for attackers to detect and remove the watermark, thereby greatly increasing the concealment of the watermark image. Specifically including the following sub-steps:
[0057] Step S7.1, breaking each dark pattern QR code image into 4096 ordered fragments in a 64×64 grid format;
[0058] Step S7.2, setting a modulus rule for the serial numbers of the broken pictures, that is, dividing the serial number of the broken pictures by 360 as the remainder as the reverse offset rotation angle of each broken picture, and updating the position of each broken picture;
[0059] Step S7.3, converting the updated fragmented image into a binary image, and writing the binary image into the data image;
[0060] Step S7.4, divide the data image into 64×64 equal parts, take the upper left corner as the first loading position point, and fill the data image with the rotated fragments according to the clockwise natural number sequence spiral, such as Figure 2 As shown, a watermark image is obtained as the original carrier, and a complementary carrier with the same size as the original carrier and completely black is generated.
[0061] Step S8, the traditional LSB algorithm is very easy to be detected by steganalysis because of its obvious transformation rule. Therefore, this scheme changes the LSB by using the supplementary carrier to achieve the characteristics of anti-cracking and traceability. Specifically, if the least significant bits of the original carrier and the supplementary carrier are different, the embedding method is changed. If the embedding method is changed to generate a random number of 1, the original carrier is changed, otherwise, the supplementary carrier is changed. The present invention hides the dark pattern QR code image at different positions of the data image by comparing the least significant bits of the original carrier and the supplementary carrier, making it difficult for attackers to predict the location of the watermark image, increasing the concealment of the watermark image, and greatly improving the difficulty and complexity of tampering.
[0062] Step S9, synthesize the changed original carrier and the supplementary carrier into a new data image, hide the changed original carrier in the image layer, and sequentially splice the changed supplementary carrier into an image file and store it in the supplementary carrier folder. For the dark pattern QR code image, the dark pattern QR code image is hidden in the image layer after separation, rotation, splitting and other operations, which is incomplete. No information can be obtained by directly scanning the code, which greatly increases the difficulty of tampering and can play a role in confidentiality and source tracing.
[0063] Step S10: All the newly synthesized data images are stitched into a PDF file and provided to the user for download.
[0064] The specific process of tracing and anti-tampering verification of the PDF file downloaded by the user in the present invention is as follows:
[0065] A. Find the original carrier and the complementary carrier of the corresponding file through the downloaded PDF file record, extract the least significant bit of the encrypted watermark image, merge the complementary carriers, and generate the original watermark image;
[0066] B. Divide the watermark image into 64×64 equal parts, and extract the center point fragments in reverse according to the spiral algorithm rule;
[0067] C. According to the modulus rule of the serial number of the broken image, rotate the corresponding angle in the positive direction to reset the broken image;
[0068] D. Combine the 4096 fragments into a dark pattern QR code image in a 64×64 grid format;
[0069] F. Scan the dark pattern QR code image and extract the encrypted QR code content;
[0070] G. Generate a secret key based on the file download log table, use the XXTEA algorithm to decrypt the QR code content, and perform tampering comparison;
[0071] H. Extract the offset text and offset information in the data image, compare them with the recorded offset information, and trace the source.
[0072] The method for downloading files with traceability and tamper-proofing of the present invention solves the security problem of files in the process of shared circulation and transmission, prevents confidential files from being tampered with and leaked, and if a file is leaked, its source can be traced.
[0073] In a technical solution of the present invention, a computer-readable storage medium is also provided, storing a computer program, wherein the computer program enables a computer to execute the method for downloading the traceability and tamper-proof file.
[0074] In a technical solution of the present invention, an electronic device is also provided, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for downloading the traceability and tamper-proof file is implemented.
[0075] In the embodiments disclosed in the present application, the computer storage medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. The computer storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the above. More specific examples of computer storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0076] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0077] The above are only preferred embodiments of the present invention. The protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.
Claims
1. A method for downloading a tamper-proof file, characterized in that: The specific steps include: Step S1: When a user downloads a file on a sharing platform, he or she performs identity authentication. If the identity authentication is passed, the file is downloaded; Step S2, recording the log information when the file is downloaded, saving it in a structured database table, and generating a folder for storing the remaining carrier files on the server side; Step S3: Generate a temporary file according to the content of the downloaded file, convert the temporary file into a PDF file, and convert the data of each page in the PDF file into a data image in sequence; Step S4: Generate an electronic watermark and an anti-counterfeiting QR code at different positions of each data image, and display the anti-counterfeiting QR code on the corresponding data image; Step S5, identifying the text content in each data image through OCR, randomly extracting a number of words for position and angle shift, and recording the shift information; Step S6: Encrypt each data image in combination with user information to generate a dark pattern QR code image; Step S7, divide each dark pattern two-dimensional code image into fragments, rotate them in a specified order, convert them into binary images, write them into the data image, divide the data image, and fill the data image with the rotated fragments according to a clockwise natural number sequence spiral to obtain a watermark image as the original carrier, and generate a complementary carrier with the same size as the original carrier and all black; Step S8, if the least significant bits of the original carrier and the supplementary carrier are different, change the embedding mode, if the embedding mode is changed to generate a random number of 1, change the original carrier, otherwise, change the supplementary carrier; Step S9, synthesizing the modified original carrier and the supplementary carrier into a new data image, hiding the modified original carrier and storing it in the image layer, and sequentially splicing the modified supplementary carrier into an image file and storing it in the supplementary carrier folder; Step S10: All the newly synthesized data images are stitched into a PDF file and provided to the user for download.
2. A method for downloading a traceability and tamper-proof file according to claim 1, characterized in that: The log information in step S2 includes: file name, file content, download time, user ID, user name, user IP and randomly generated UUID 32-bit download log ID.
3. A method for downloading a traceability and tamper-proof file according to claim 1, characterized in that: The specific process of randomly extracting a number of characters for position and angle shift in step S5 is: randomly shifting the position of the extracted characters horizontally or vertically by 5 pixels, and randomly shifting the angle of the extracted characters to any value within the range of [-10°, 10°].
4. A method for downloading a traceability and tamper-proof file according to claim 3, characterized in that: The offset information recorded in step S5 includes: file name, file page number, offset text, and corresponding offset angle and offset position.
5. A method for downloading a traceability and tamper-proof file according to claim 1, characterized in that: Step S6 includes the following sub-steps: Step S6.1, concatenate the user ID, download time and download file name in order with underscores to obtain a string, perform MD5 encryption, and use the encrypted string as the key of the XXTEA encryption algorithm; Step S6.2: Concatenate the user name, download time and download file name with the @ symbol as plain text, use the XXTEA encryption algorithm, and use the key in step S6.1 to encrypt the plain text to obtain an encrypted string, and generate a dark pattern QR code image with the encrypted string.
6. A method for downloading a traceability and tamper-proof file according to claim 5, characterized in that: Step S7 includes the following sub-steps: Step S7.1, breaking each dark pattern QR code image into 4096 ordered fragments in a 64×64 grid format; Step S7.2, setting a modulus rule for the serial numbers of the broken pictures, using this as the reverse offset rotation angle of each broken picture, and updating the position of each broken picture; Step S7.3, converting the updated fragmented image into a binary image, and writing the binary image into the data image; Step S7.4, divide the data image into 64×64 equal parts, take the upper left corner as the first loading position point, and fill the data image with the rotated fragments according to the clockwise natural number series spiral to obtain the watermark image as the original carrier, and generate a complementary carrier with the same size as the original carrier and completely black.
7. A method for downloading a traceability and tamper-proof file according to claim 6, characterized in that: The specific modulus rule of the serial number of the fragment image in step S7.2 is: the remainder of dividing the serial number of the fragment image by 360.
8. A method for downloading a traceability and tamper-proof file according to claim 7, characterized in that: The specific process of traceability and anti-tampering verification of PDF files downloaded by users is as follows: A. Find the original carrier and the complementary carrier of the corresponding file through the downloaded PDF file record, extract the least significant bit of the encrypted watermark image, merge the complementary carriers, and generate the original watermark image; B. Divide the watermark image into 64×64 equal parts, and extract the center point fragments in reverse according to the spiral algorithm rule; C. According to the modulus rule of the serial number of the fragment, rotate the corresponding angle in the positive direction to reset the fragment; D. Combine the 4096 fragments into a dark pattern QR code image in a 64×64 grid format; F. Scan the dark pattern QR code image and extract the encrypted QR code content; G. Generate a secret key based on the file download log table, use the XXTEA algorithm to decrypt the QR code content, and perform tampering comparison; H. Extract the offset text and offset information in the data image, compare them with the recorded offset information, and trace the source.
9. A computer-readable storage medium storing a computer program, characterized in that: The computer program enables a computer to execute the method for downloading a traceability and tamper-proof file as described in any one of claims 1 to 8.
10. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for downloading a traceability and tamper-proof file as described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Novel bar code screenshot steganography traceability combination algorithm
CN113095992A
Synthetic aperture radar (SAR) scene deception jamming method based on image inversion
CN114609598A
Webpage bright and dark watermark processing and leakage tracing method based on asymmetric encryption
CN117879823A
Network security defense method and system based on data analysis
CN118101269A
Ultra-large two-dimensional code positioning identification system and method in wind power scene
CN118968208A