A method for generating encrypted-compressed document images with tamper-proof properties

By converting the document into a PNG image and performing a series of processing, a compressed and encrypted image with tamper-proof characteristics is solved, and the problem that existing encrypted PDF files are easily tampered is achieved, achieving efficient compression and powerful security of the files.

CN113515652BActive Publication Date: 2025-02-11DONGGUAN LISHENG MACHINERY EQUIP +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110758964.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-05
Publication Date
2025-02-11
Estimated Expiration
2041-07-05

AI Technical Summary

Technical Problem

In the prior art, although encrypted PDF is used to ensure the security of the file, there is still a risk of being tampered with, especially due to vulnerabilities in digital signatures and encryption in PDF files.

Method used

An encrypted-compressed document image generation method is proposed, and compressed encrypted images with tamper-proof by converting the target document into a PNG image and performing preprocessing, hash value embedding, non-negative prediction coding, compression coding and encryption, to generate compressed encrypted images with tamper-proof.

Benefits of technology

This method can not only effectively compress the file size and reduce storage space requirements, but also ensure the integrity and privacy of the file by embedding hash values ​​and encryption. Even if the file is tampered with, it can be detected and located.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113515652B_ABST
    Figure CN113515652B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for generating an encrypted compressed document image with anti-tampering, which comprises the following steps: S1, obtaining a key KEY corresponding to a PNG image; S2, removing blank rows and blank columns from the PNG image; S3, embedding a hash value based on the key KEY to obtain an embedded image; S4, obtaining a prediction error pixel image; S5, compressing and encoding the prediction error pixel image to obtain a compressed encoding stream; S6, converting the information necessary for restoring the PNG image into a binary stream, connecting it to the encoding stream, and encrypting it, and saving the encrypted binary stream together with the image parameters as an image to obtain a compressed encrypted image. The present invention can effectively compress and encrypt the document image, and when someone tampers with the compressed encrypted content, the tampered position can be identified and located, and it can be identified whether the current document has been tampered with, thereby improving the security of the document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of data encryption, and in particular to a method for generating an encrypted-compressed document image with tamper-proof function. Background Art

[0002] With the rapid development of information technology, the storage method of documents is no longer just paper documents. Due to the shortcomings of paper documents, such as large space occupation, difficulty in preservation, easy damage, difficulty in management, inconvenient search, and human resource consumption, electronic storage has become the main way for people to store important documents. However, the emerging storage method of electronic documents brings with it the consideration of issues such as document authenticity, integrity, and privacy.

[0003] First, if the file is stored in word format, although this method is convenient for storage and management, its content can be easily modified by criminals without leaving any trace, which makes it difficult to ensure the authenticity of the document. For example, college students defend their thesis online. At this time, some files generated by the online defense, such as the student's defense score sheet, the judges need to fill in the defense score and pass status in a word document. However, if the final storage method of the document is also in word format, then the student or other people can also modify the score in the file, destroying the authenticity of the document, which will cause serious consequences.

[0004] The other mainstream file storage method is to use PDF format, and use PDF digital signatures to ensure the authenticity, integrity and privacy of the file. Including Amazon and other e-commerce companies, they actually use PDF electronic invoices. And behind these invoices, there are digital signatures to protect them. Obviously, PDF files with digital signatures are legally binding in many countries and regions. On the other hand, some banks and other companies are slowly starting to use encrypted PDF as a substitute for encrypted emails. Some government agencies also allow the use of encrypted and signed PDFs for identity authentication. It can be seen that signed and encrypted PDFs are widely used around us. From a technical and formal point of view, it seems that storing files in PDF format with digital signatures can ensure the security of the file content and prevent it from being tampered with by others.

[0005] However, in early March 2019, German researchers from the University of Münster and Ruhr-Universität Bochum said they had managed to exploit a newly discovered vulnerability and successfully cracked the digital signature in PDF files.

[0006] Subsequently, in October 2019, it was disclosed again that encrypted PDFs had a PDFex vulnerability.

[0007] Finally, on December 27, 2019, two topics were shared at the 36th C3 Chaos Hacker Conference: Breaking PDF Signatures and Breaking PDF Encryption.

[0008] The above situation proves that even if encrypted PDF is used to save files, the security of the document content cannot be guaranteed. Summary of the invention

[0009] In view of the above-mentioned deficiencies in the prior art, the present invention provides a method for generating an encrypted-compressed document image with anti-tampering function, which solves the problem that encrypted PDF cannot guarantee the security of the document.

[0010] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is:

[0011] A method for generating an encrypted and compressed document image with tamper-proof function is provided, comprising the following steps:

[0012] S1. Convert the target document into a PNG image and obtain the key KEY corresponding to the PNG image;

[0013] S2, removing blank rows and columns from the PNG image to obtain a preprocessed image;

[0014] S3, generating an index image based on the preprocessed image, obtaining a hash value corresponding to the index image, and embedding the hash value into the corresponding index image based on the key KEY to obtain an embedded image;

[0015] S4, performing a zero-filling operation on the border of the embedded image and then performing non-negative prediction coding to obtain a prediction error pixel matrix, and then obtain a prediction error pixel image;

[0016] S5, compressing and encoding the prediction error pixel image to obtain a compressed encoding stream;

[0017] S6. Convert the information necessary for restoring the PNG image into a binary stream, connect it to the encoding stream, and encrypt it. Save the encrypted binary stream together with the image parameters as an image to obtain a compressed encrypted image.

[0018] Furthermore, the specific method of obtaining the key KEY corresponding to the PNG image in step S1 is:

[0019] Get the serial number of the current operating device and the generation time of the PNG image, and use the digital signature method to generate the key KEY together with the user's custom key UKey.

[0020] Furthermore, the specific method of step S2 is:

[0021] The first channel of the PNG image X is used as the judgment basis, and the pixel values ​​of each row and column of the channel are traversed. If the value of each pixel point in the current row or column is less than 200, it is regarded that the pixel points in the row or column contain non-white pixels, and the row or column of each channel of the PNG image X is retained. Otherwise, all the pixels of the row or column of each channel of the PNG image X are removed to obtain the preprocessed image X'.

[0022] Furthermore, the specific method of step S3 includes the following sub-steps:

[0023] S3-1, using rgb2ind function to obtain the index image XI and palette map of the preprocessed image X';

[0024] S3-2, according to the three channel values ​​of the palette map, eight colors of white, black, red, orange, blue, purple, cyan and yellow are distinguished by setting the critical value;

[0025] S3-3, for any color system among the eight colors in the palette map of the image X', mark and count its peak value, use its peak value as the color value of the color system in the palette map, obtain a new palette nmap, and modify the index image XI accordingly to obtain the index image Y;

[0026] S3-4, dividing the index image Y into blocks and using them as input values ​​of the hash function, using the MD5 information digest algorithm to generate a 128-bit hash value, and obtaining a hash matrix corresponding to the index image Y;

[0027] S3-5, convert the index image Y into a binary image, scramble the binary image blocks according to the key KEY and count the embeddable pixels to obtain the embedding position of the hash matrix;

[0028] S3-6, based on the embedding position of the hash matrix, according to the formula:

[0029]

[0030] Get the index value NY of the i-th row and j-th column of the embedded image i,j , and then get the embedded image; where Y i,j is the index value of the i-th row and j-th column in the index image Y; hash k is a hash matrix, the value of k is equal to the number of blocks multiplied by 128; num is the number of rows of the new palette nmap; P i,j =1 means that the current pixel can be flipped, that is, the hash value can be embedded.

[0031] Furthermore, the critical value in step S3-2 is 0.7843.

[0032] Furthermore, the specific method of converting the index image Y into a binary image in step S3-5 is:

[0033] The index image Y is converted into a binary image by using a binary image watermark embedding method.

[0034] Furthermore, the specific method of step S4 includes the following sub-steps:

[0035] S4-1, performing a zero-padding operation on the border of the embedded image until the embedded image is divisible by 4, thereby obtaining an image I;

[0036] S4-2, according to the formula:

[0037]

[0038] The index value I in the i-th row and j-th column of image I is i,j Transformed into prediction error value PreI i,j ; Where m represents the total number of rows, n represents the total number of columns; ||·|| represents rounding operation;

[0039] S4-3, according to the formula:

[0040]

[0041]

[0042] Get the prediction error pixel image P; Represents the index value of the i-th row and j-th column of the prediction error pixel image P.

[0043] Furthermore, the specific method of step S5 includes the following sub-steps:

[0044] S5-1, obtaining the number of smooth blocks and complex blocks in each bit plane of the prediction error pixel image P;

[0045] S5-2, according to the formula:

[0046] T1=floor((m P ×n P / 16) / (ceil(log2(m P ×n P ))-5))

[0047] Get threshold T1; where m P and n P They represent the number of rows and columns of the prediction error pixel image P, respectively; ceil(·) represents the ceil function; floor(·) represents the floor function;

[0048] S5-3, determine whether the number c of 1s in each bit plane is equal to 0, if so, use all-0 block encoding to obtain a compressed encoding stream; otherwise, go to step S5-4;

[0049] S5-4, determine whether the number c of 1s in each bit plane is less than the threshold T1, if so, use structural coding to obtain a compressed coding stream; otherwise, go to step S5-5;

[0050] S5-5, divide the bit plane into non-overlapping 4×4 blocks according to the formula:

[0051] t=15×a-2×b

[0052] Get the value of parameter t; where a represents the number of smooth blocks in the bit plane, and b represents the number of complex blocks in the bit plane;

[0053] S5-6, determine whether the parameter t is less than or equal to 0, if so, do not compress and encode, and obtain a compressed encoding stream; otherwise, obtain the number of 1s in each 4×4 block of the bit plane;

[0054] If the number of 1s in each 4×4 block of the bit plane is greater than 0 and less than 4, structural coding is used to obtain a compressed coding stream;

[0055] If the number of 1s in each 4×4 block of the bit plane is equal to 0, then all-0 block coding is adopted to obtain a compressed coded stream;

[0056] If the number of 1s in each 4×4 block of the bit plane is greater than or equal to 4, uncompressed coding is used to obtain a compressed coding stream.

[0057] Furthermore, the specific method of step S6 is:

[0058] The information when removing blank rows and columns of the PNG image is converted into a binary stream and connected to the encoding stream. The encoding stream connected to the binary stream is used as the input of the XOR scrambling encryption function using a one-dimensional scrambling encryption algorithm. The key KEY is used for XOR scrambling encryption. The encrypted binary stream is saved as an image together with the image parameters to obtain a compressed encrypted image.

[0059] Furthermore, the image parameters in step S6 include image size, device information and original image generation time.

[0060] The beneficial effects of the present invention are as follows: the method embeds the hash matrix generated by image block into the image to ensure the integrity of the file, and it can be detected and located even after being tampered with. The compression coding ensures that the file is stored in the smallest possible way, and the encryption ensures the privacy of the file. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1It is a schematic diagram of the process of the present invention;

[0062] Figure 2 is the original document image in the embodiment;

[0063] Figure 3 The image is the image after the original document image is preprocessed in the embodiment;

[0064] Figure 4 It is the image after embedding the hash value;

[0065] Figure 5 It is a compressed and encrypted image;

[0066] Figure 6 is the restored image;

[0067] Figure 7 To tamper with the image;

[0068] Figure 8 Locating images for tampering;

[0069] Fig. 9 This is a file size comparison diagram. DETAILED DESCRIPTION

[0070] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.

[0071] like Figure 1 As shown, the method for generating an encrypted-compressed document image with tamper-proof properties comprises the following steps:

[0072] S1. Convert the target document into a PNG image and obtain the key KEY corresponding to the PNG image;

[0073] S2, removing blank rows and columns from the PNG image to obtain a preprocessed image;

[0074] S3, generating an index image based on the preprocessed image, obtaining a hash value corresponding to the index image, and embedding the hash value into the corresponding index image based on the key KEY to obtain an embedded image;

[0075] S4, performing a zero-filling operation on the border of the embedded image and then performing non-negative prediction coding to obtain a prediction error pixel matrix, and then obtain a prediction error pixel image;

[0076] S5, compressing and encoding the prediction error pixel image to obtain a compressed encoding stream;

[0077] S6. Convert the information necessary for restoring the PNG image into a binary stream, connect it to the encoding stream, and encrypt it. Save the encrypted binary stream together with the image parameters as an image to obtain a compressed encrypted image.

[0078] The specific method for obtaining the key KEY corresponding to the PNG image in step S1 is: obtaining the serial number of the current operating device and the generation time of the PNG image, and using the digital signature method to generate the key KEY together with the user's custom key UKey.

[0079] The specific method of step S2 is: taking the first channel of the PNG image X as the judgment basis, traversing the pixel values ​​of each row and each column of the channel, if the value of each pixel point of the current row or column is less than 200, it is regarded that the pixel points of the row or column contain non-white pixels, and the row or column of each channel of the PNG image X is retained, otherwise, all the pixel points of the row or column of each channel of the PNG image X are removed to obtain the preprocessed image X'.

[0080] The specific method of step S3 includes the following sub-steps:

[0081] S3-1, using rgb2ind function to obtain the index image XI and palette map of the preprocessed image X';

[0082] S3-2, according to the three channel values ​​of the palette map, eight colors of white, black, red, orange, blue, purple, cyan and yellow are distinguished by setting the critical value;

[0083] S3-3, for any color system among the eight colors in the palette map of the image X', mark and count its peak value, use its peak value as the color value of the color system in the palette map, obtain a new palette nmap, and modify the index image XI accordingly to obtain the index image Y;

[0084] S3-4, dividing the index image Y into blocks and using them as input values ​​of the hash function, using the MD5 information digest algorithm to generate a 128-bit hash value, and obtaining a hash matrix corresponding to the index image Y;

[0085] S3-5, convert the index image Y into a binary image, scramble the binary image blocks according to the key KEY and count the embeddable pixels to obtain the embedding position of the hash matrix;

[0086] S3-6, based on the embedding position of the hash matrix, according to the formula:

[0087]

[0088] Get the index value NY of the i-th row and j-th column of the embedded image i,j , and then get the embedded image; where Y i,j is the index value of the i-th row and j-th column in the index image Y; hash k is a hash matrix, the value of k is equal to the number of blocks multiplied by 128; num is the number of rows of the new palette nmap; P i,j =1 means that the current pixel can be flipped, that is, the hash value can be embedded.

[0089] The critical value in step S3-2 is 0.7843. Since a color has three channels, each channel must be determined to be larger than the critical value in the specific implementation. For example, a value greater than the critical value is 1, and a value less than the critical value is 0. For example, black is 000, and white is 111, so a total of 8 colors can be obtained.

[0090] The specific method of converting the index image Y into a binary image in step S3-5 is: converting the index image Y into a binary image by a binary image watermark embedding method.

[0091] The specific method of step S4 includes the following sub-steps:

[0092] S4-1, performing a zero-padding operation on the border of the embedded image until the embedded image is divisible by 4, thereby obtaining an image I;

[0093] S4-2, according to the formula:

[0094]

[0095] The index value I in the i-th row and j-th column of image I is i,j Transformed into prediction error value PreI i,j ; Where m represents the total number of rows, n represents the total number of columns; ||·|| represents rounding operation;

[0096] S4-3, according to the formula:

[0097]

[0098]

[0099] Get the prediction error pixel image P; Represents the index value of the i-th row and j-th column of the prediction error pixel image P.

[0100] The specific method of step S5 includes the following sub-steps:

[0101] S5-1, obtaining the number of smooth blocks and complex blocks in each bit plane of the prediction error pixel image P;

[0102] S5-2, according to the formula:

[0103] T1=floor((m P ×n P / 16) / (ceil(log2(m P ×n P ))-5))

[0104] Get threshold T1; where m P and n P They represent the number of rows and columns of the prediction error pixel image P, respectively; ceil(·) represents the ceil function; floor(·) represents the floor function;

[0105] S5-3, determine whether the number c of 1s in each bit plane is equal to 0, if so, use all-0 block encoding to obtain a compressed encoding stream; otherwise, go to step S5-4;

[0106] S5-4, determine whether the number c of 1s in each bit plane is less than the threshold T1, if so, use structural coding to obtain a compressed coding stream; otherwise, go to step S5-5;

[0107] S5-5, divide the bit plane into non-overlapping 4×4 blocks according to the formula:

[0108] t=15×a-2×b

[0109] Get the value of parameter t; where a represents the number of smooth blocks in the bit plane, and b represents the number of complex blocks in the bit plane;

[0110] S5-6, determine whether the parameter t is less than or equal to 0, if so, do not compress and encode, and obtain a compressed encoding stream; otherwise, obtain the number of 1s in each 4×4 block of the bit plane;

[0111] If the number of 1s in each 4×4 block of the bit plane is greater than 0 and less than 4, structural coding is used to obtain a compressed coding stream;

[0112] If the number of 1s in each 4×4 block of the bit plane is equal to 0, then all-0 block coding is adopted to obtain a compressed coded stream;

[0113] If the number of 1s in each 4×4 block of the bit plane is greater than or equal to 4, uncompressed coding is used to obtain a compressed coding stream.

[0114] The specific method of step S6 is: convert the information when removing blank rows and columns of the PNG image into a binary stream and connect it to the coded stream, use the one-dimensional scrambling encryption algorithm to use the coded stream connected to the binary stream as the input of the XOR scrambling encryption function, use the key KEY to perform XOR scrambling encryption, save the encrypted binary stream together with the image parameters as an image, and obtain a compressed encrypted image M. The image parameters include image size, device information, and original image generation time.

[0115] In the specific implementation process, the decryptor obtains the user key UKey and the compressed encrypted image M. First, the parameter information in the compressed encrypted image M is extracted, including the parameter information for restoring the image, the device information, and the generation time of the original image. The decryption key KEY is generated in combination with the user key UKey. Then, the key KEY is used to decrypt the compressed encrypted image M to obtain the compressed coding stream and the information for recovering the blank area of ​​the image. Different recovery coding algorithms are used to recover each bit plane according to the previously marked coding method, and the index image NY is obtained according to the extracted image parameter information. The hash matrix embedded in the index image NY is extracted according to the decryption key KEY and the authentication data extraction algorithm, and it is saved for tampering detection and positioning, and the original index image Y is restored. Then the saved palette nmap is read, combined with the index image Y, and the restored image RE is obtained using the ind2rgb function. Finally, according to the image recovery information obtained by decryption, the blank area of ​​the image RE is restored to the size of the original image X, and the final restored image R is obtained.

[0116] If the restored image is tampered with, the restored image R can be re-adaptively preprocessed, and then the same hash algorithm can be used to divide the index image into blocks, and the hash matrix H1 is obtained as the input parameter of the same hash function. In addition, the hash matrix H2 saved when the image was restored before is read. By comparing the two summary values, it can be determined whether the image has been tampered with and the tampered blocks of the image can be located.

[0117] In one embodiment of the present invention, Figure 2 As shown, the defense score form PDF file with a size of 136KB is used as a reference to verify the various performances of the method of the present invention. The PDF file is converted into a PNG image with a size of m×n×k=1684×1191×3 and an image size of 155KB using the "Format Factory" conversion tool, and this image is used as the input image of the present invention.

[0118] The input image is preprocessed to obtain Figure 3 The image shown in Figure 1 is obtained after embedding the hash value. Figure 4 The image shown in the figure, the final compressed and encrypted image is as follows Figure 5As shown in the figure. The encryption key KEY is obtained by using the existing digital signature technology based on the user key UKey, device information and the original image generation time. The final compressed-encrypted image format is BMP, and the image size is 32.6KB, accounting for 21% of the original image and 24% of the original document. Figure 6 As shown, the peak signal-to-noise ratio (PSNR) of the image restored using the algorithm and key and the original image is 25.4894, and the structural similarity (SSIM) is 0.9841.

[0119] If someone swaps (tampers with) the scores of Yi1 and Yi2, the scores of Yi1 and Yi2 in the restored image will be as follows: Figure 7 As shown in the figure, the tampering detection algorithm compares the hash matrix of the tampered image with the hash matrix saved when restoring the image before, and obtains the tampering positioning image as shown in the figure. Figure 8 As shown, it can be determined that the image has been tampered with and the tampered image block can be located.

[0120] like Fig. 9 As shown in the figure, six different table images are used to verify the performance of this method in reducing file storage space. It can be seen that while ensuring the integrity and confidentiality of the document image, the image size is also significantly reduced compared to the original PDF file size.

[0121] When the PDF document encrypted by this method is tampered with, some errors will occur. This method can find the tampering location and help to correct it in time. In addition, since the encrypted image is decrypted by illegal elements as a binary stream, they do not know how to decode it. The illegal elements cannot view the original content without the key and decryption algorithm, thus ensuring the security of the document.

[0122] In summary, the present invention can effectively compress and encrypt document images. When someone tampers with the compressed and encrypted content, the tampered location can be identified and located to identify whether the current document has been tampered with, thereby improving the security of the document.

Claims

1. A method for generating an encrypted and compressed document image with tamper-proof properties, characterized in that: The following steps are involved: S1. Convert the target document into a PNG image and obtain the key KEY corresponding to the PNG image; S2, removing blank rows and columns from the PNG image to obtain a preprocessed image; S3, generating an index image based on the preprocessed image, obtaining a hash value corresponding to the index image, and embedding the hash value into the corresponding index image based on the key KEY to obtain an embedded image; S4, performing a zero-filling operation on the border of the embedded image and then performing non-negative prediction coding to obtain a prediction error pixel matrix, and then obtain a prediction error pixel image; S5, compressing and encoding the prediction error pixel image to obtain a compressed encoding stream; S6. Convert the information necessary for restoring the PNG image into a binary stream, connect it to the encoding stream, and encrypt it. Save the encrypted binary stream together with the image parameters as an image to obtain a compressed encrypted image.

2. The method for generating an encrypted and compressed document image with tamper-proof properties according to claim 1, characterized in that: The specific method of obtaining the key KEY corresponding to the PNG image in step S1 is: Get the serial number of the current operating device and the generation time of the PNG image, and use the digital signature method to generate the key KEY together with the user's custom key UKey.

3. The method for generating an encrypted and compressed document image with tamper-proof properties according to claim 1, characterized in that: The specific method of step S2 is: The first channel of the PNG image X is used as the judgment basis, and the pixel values ​​of each row and column of the channel are traversed. If the value of each pixel point in the current row or column is less than 200, it is regarded that the pixel points in the row or column contain non-white pixels, and the row or column of each channel of the PNG image X is retained. Otherwise, all the pixels of the row or column of each channel of the PNG image X are removed to obtain the preprocessed image X'.

4. The method for generating an encrypted and compressed document image with tamper-proof properties according to claim 3, characterized in that: The specific method of step S3 includes the following sub-steps: S3-1, using rgb2ind function to obtain the index image XI and palette map of the preprocessed image X'; S3-2, according to the three channel values ​​of the palette map, eight colors of white, black, red, orange, blue, purple, cyan and yellow are distinguished by setting the critical value; S3-3, for any color system among the eight colors in the palette map of the image X', mark and count its peak value, use its peak value as the color value of the color system in the palette map, obtain a new palette nmap, and modify the index image XI accordingly to obtain the index image Y; S3-4, dividing the index image Y into blocks and using them as input values ​​of the hash function, using the MD5 information digest algorithm to generate a 128-bit hash value, and obtaining a hash matrix corresponding to the index image Y; S3-5, convert the index image Y into a binary image, scramble the binary image blocks according to the key KEY and count the embeddable pixels to obtain the embedding position of the hash matrix; S3-6, based on the embedding position of the hash matrix, according to the formula: Get the index value NY of the i-th row and j-th column of the embedded image i,j , and then get the embedded image; where Y i,j is the index value of the i-th row and j-th column in the index image Y; hash k is a hash matrix, the value of k is equal to the number of blocks multiplied by 128; num is the number of rows of the new palette nmap; P i,j =1 means that the current pixel can be flipped, that is, the hash value can be embedded.

5. The method for generating an encrypted and compressed document image with tamper-proof properties according to claim 4, characterized in that: The critical value in step S3-2 is 0.7843.

6. The method for generating an encrypted and compressed document image with tamper-proof properties according to claim 4, characterized in that: The specific method of converting the index image Y into a binary image in step S3-5 is: The index image Y is converted into a binary image by using a binary image watermark embedding method.

7. The method for generating an encrypted and compressed document image with tamper-proof properties according to claim 1, characterized in that: The specific method of step S4 includes the following sub-steps: S4-1, performing a zero-padding operation on the border of the embedded image until the embedded image is divisible by 4, thereby obtaining an image I; S4-2, according to the formula: The index value I in the i-th row and j-th column of image I is i,j Transformed into prediction error value PreI i,j ; Where m represents the total number of rows, n represents the total number of columns; ||·|| represents rounding operation; S4-3, according to the formula: Get the prediction error pixel image P; Represents the index value of the i-th row and j-th column of the prediction error pixel image P.

8. The method for generating an encrypted and compressed document image with tamper-proof properties according to claim 1, wherein: The specific method of step S5 includes the following sub-steps: S5-1, obtaining the number of smooth blocks and complex blocks in each bit plane of the prediction error pixel image P; S5-2, according to the formula: T1=floor((m P ×n P / 16) / (ceil(log2(m P ×n P ))-5)) Get threshold T1; where m P and n P They represent the number of rows and columns of the prediction error pixel image P, respectively; ceil(·) represents the ceil function; floor(·) represents the floor function; S5-3, determine whether the number c of 1s in each bit plane is equal to 0, if so, use all-0 block encoding to obtain a compressed encoding stream; Otherwise, go to step S5-4; S5-4, determine whether the number c of 1s in each bit plane is less than the threshold T1, if so, use structural coding to obtain a compressed coding stream; otherwise, go to step S5-5; S5-5, divide the bit plane into non-overlapping 4×4 blocks according to the formula: t=15×a-2×b Get the value of parameter t; where a represents the number of smooth blocks in the bit plane, and b represents the number of complex blocks in the bit plane; S5-6, determine whether the parameter t is less than or equal to 0, if so, do not compress the code and obtain a compressed code stream; Otherwise, get the number of 1s in each 4×4 block of the bit plane; If the number of 1s in each 4×4 block of the bit plane is greater than 0 and less than 4, structural coding is used to obtain a compressed coding stream; If the number of 1s in each 4×4 block of the bit plane is equal to 0, then all-0 block coding is adopted to obtain a compressed coded stream; If the number of 1s in each 4×4 block of the bit plane is greater than or equal to 4, uncompressed coding is used to obtain a compressed coding stream.

9. The method for generating an encrypted and compressed document image with tamper-proof properties according to claim 1, wherein: The specific method of step S6 is: The information when removing blank rows and columns of the PNG image is converted into a binary stream and connected to the encoding stream. The encoding stream connected to the binary stream is used as the input of the XOR scrambling encryption function using a one-dimensional scrambling encryption algorithm. The key KEY is used for XOR scrambling encryption. The encrypted binary stream is saved as an image together with the image parameters to obtain a compressed encrypted image.

10. The method for generating an encrypted and compressed document image with tamper-proof properties according to claim 1, characterized in that: The image parameters in step S6 include image size, device information and original image generation time.

Citation Information

Patent Citations

  • Semi-fragile watermarking method based on image tampering positioning and recovering

    CN107742272A

  • Pixel-level image authentication, tampering detection and restoration method

    CN108876697A