A file verification method and system
By comparing the feature identification information between the printing device and the verification device, the problem of consistency verification between the file received by the printing device and the file sent by the sending end is solved, ensuring that the file is not tampered with during transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2026-04-07
AI Technical Summary
Existing technology cannot effectively verify the consistency between the file received by the printing device and the original file sent by the sending end, making it difficult to prevent tampering after the file is converted into paper form.
By calculating the unique feature information of the file after the printing device parses it, and then having the verification device parse and calculate the sending file in the same way, the consistency verification between the file received by the printing device and the file sent by the printing device is achieved.
Effectively identify whether files have been tampered with during transmission and promptly prevent the spread of tampered information.
Smart Images

Figure CN119720241B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of network printing security technology, and in particular relates to a document verification method and system. Background Technology
[0002] In the field of information security, ensuring the integrity and consistency of documents and preventing their tampering is crucial. For document protection, a widely adopted strategy is digital signature technology, which provides strong assurance that documents maintain their credibility even after traversing untrusted network environments. However, it is worth noting that even if a document is equipped with a digital signature, once it is presented in printed form, the original anti-counterfeiting mechanisms are difficult to directly apply to the paper document, making it difficult to directly verify its authenticity.
[0003] When using computers and networks for daily work, we face potential security threats, especially from intruders with specific purposes. These intruders are often not content with simply causing large-scale damage to computer systems; they are more inclined to steal or tamper with sensitive data. Therefore, even with various security measures in place to protect data in electronic form, the risk of data alteration when converted to paper form (such as printing documents via the network) cannot be ignored.
[0004] As a crucial medium for information transmission and expression, the accuracy of written text is paramount. In formal documents such as contracts and orders, even minor alterations, such as changes in punctuation or their placement, can lead to significant distortions of meaning and immeasurable consequences. Therefore, in printing scenarios involving important information, verifying the consistency between the document received by the printing device and the original document (the document sent) is essential to prevent any form of tampering or replacement. However, currently, there is a lack of methods to verify the consistency between the content (including format) of the document received by the printing device and the original document, making it impossible to detect document tampering in a timely manner and allowing the spread of altered information. Summary of the Invention
[0005] This application provides a file verification method and system that can solve the problem of being unable to verify the consistency between the file received by the printing device and the original file sent by the sending end.
[0006] In a first aspect, embodiments of this application provide a document verification method applied to a printing device, comprising:
[0007] The printing device parses the file received from the sender to obtain the first parsed file;
[0008] The printing device calculates the first feature identification information of the first parsed file, and the first feature identification information uniquely corresponds to the content of the first parsed file;
[0009] The printing device outputs the first feature identification information so that the verification device can parse the file sent by the sending end to obtain the second parsed file, calculate the second feature identification information of the second parsed file, and then perform consistency verification on the file received by the printing device and the file sent by the sending end based on the first feature identification information and the second feature identification information.
[0010] In some embodiments, the printing device calculates first feature identification information of the first parsed file, including:
[0011] The printing device generates a random number n;
[0012] The first feature identification information is calculated based on the random number n and the data in the first parsed file.
[0013] In some embodiments, the first feature identification information is a hash value of the first parsed file. Calculating the first feature identification information based on a random number n and the data in the first parsed file includes:
[0014] The printing device determines the number of bits k required to print one line of data;
[0015] The data in the first parsed file is divided into m sub-data units, with each n-line containing a certain number of data bits. P represents the total number of bits in the first parsed file;
[0016] The hash value of the first parsed file is calculated using the formula: θ m =f(θ) m-1 +p(n m ));
[0017] Where, θ m p(n) is the hash value of the first parsed file, f() is the hash function, and p(n) is the hash value of the first parsed file. m ) represents the m-th sub-data, and "+" indicates data concatenation.
[0018] In some embodiments, the method further includes: the printing device encrypting the first feature identification information, including:
[0019] The encryption formula is: D B =g(n+θ) m ), where D B The first characteristic identifier is used for encryption, g() is the encryption function, and θ is the encryption function. m This is the first feature identifier information of the first parsed file; "+" indicates data concatenation.
[0020] Secondly, this application also provides a document verification method applied to a verification device, the method comprising:
[0021] The verification device obtains the first feature identification information; the first feature identification information uniquely corresponds to the content of the first parsed file, which is obtained by the printing device parsing the file received from the sending end;
[0022] The verification device parses the file sent by the sender to obtain the second parsed file;
[0023] The verification device calculates the second feature identification information of the second parsed file;
[0024] The verification device performs consistency verification on the files received by the printing device and the files sent by the sending end based on the first feature identification information and the second feature identification information.
[0025] In some embodiments, the verification device calculates the second feature identification information of the second parsed file, including:
[0026] The verification device obtains a random number n from the printing device that calculates the first feature identification information;
[0027] The second feature identification information is calculated based on the random number n and the data from the second parsing file.
[0028] In some embodiments, the verification device performs consistency verification on the file received by the printing device and the file sent by the sending end based on the first feature identification information and the second feature identification information, including:
[0029] The verification device compares the character at a preset position in the first feature identification information with the character at the same preset position in the second feature identification information;
[0030] If they are the same, it is determined that the file received by the printing device and the file sent by the sending end are consistent; otherwise, it is determined that the file received by the printing device and the file sent by the sending end are inconsistent.
[0031] In some embodiments, when the first feature identification information is encrypted information, the verification device obtains the random number n calculated by the printing device for the first feature identification information, including:
[0032] The first feature identifier information is decrypted using the decryption method corresponding to the encryption of the first feature identifier information by the printing device, and a random number n is obtained.
[0033] In some embodiments, the method further includes:
[0034] The second feature identifier information is encrypted using the same encryption algorithm used by the printing device to encrypt the first feature identifier information, resulting in encrypted second feature identifier information.
[0035] In some embodiments, the consistency verification of the electronic document received by the printing device and the electronic document sent by the sending end is performed based on the first feature identification information and the second feature identification information, including:
[0036] The verification device compares the character at a preset position in the encrypted first feature identification information with the character at the same preset position in the encrypted second feature identification information;
[0037] If they are the same, it is determined that the file received by the printing device and the file sent by the sending end are consistent; otherwise, it is determined that the file received by the printing device and the file sent by the sending end are inconsistent.
[0038] Thirdly, this application also provides a document verification system, the system including a printing device and a verification device;
[0039] The printing device is used to perform the following steps:
[0040] Parse the file received from the sender to obtain the first parsed file;
[0041] Calculate the first feature identifier information of the first parsed file, where the first feature identifier information uniquely corresponds to the content of the first parsed file;
[0042] Output the first feature identification information;
[0043] The calibration device is used to perform the following steps:
[0044] The file sent by the sender is parsed to obtain a second parsed file;
[0045] Calculate the second feature identifier information of the second parsed file;
[0046] The consistency of the files received by the printing device and the files sent by the sending end is verified based on the first and second feature identification information.
[0047] The above-mentioned solution in this application has the following beneficial effects:
[0048] In the embodiments of this application, after the printing device parses the file to be printed into printable file data, the printing device calculates the feature identification information of the file data based on the unique pixel information of the file data. At the same time, the verification device parses and calculates the file sent by the sending end in the same way to obtain the feature identification information of the file sent by the sending end. By comparing the feature identification information obtained by the verification device and the feature identification information obtained by the printing device, the consistency verification of the file received by the printing device and the file sent by the sending end is realized. This effectively identifies whether the original file sent by the sending end has been tampered with during the transmission process, and timely detects the tampered file, effectively preventing the spread of tampered information.
[0049] Other beneficial effects of this application will be described in detail in the following detailed description section. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 A flowchart illustrating a document verification method provided in an embodiment of this application;
[0052] Figure 2 A flowchart of a document consistency verification process provided in one embodiment of this application;
[0053] Figure 3 This is a schematic diagram of the structure of a document verification system provided in an embodiment of this application. Detailed Implementation
[0054] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0055] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0056] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0057] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0058] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0059] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0060] As an indispensable device in modern office environments, printers have an internal structure similar to computers, equipped with processors, memory, and running specific operating systems. However, compared to computers, printers often lack sufficient security software, making them particularly vulnerable to security threats. The communication characteristics of printers dictate that they need to frequently transmit file data, making them easy targets for attackers. Therefore, we must acknowledge the security risks of printers and strengthen their protective measures to ensure the secure execution of printing tasks. In view of this, this application is based on the following technical concept: based on the printer's file parsing and processing, unique pixel information of the processed file is used to construct feature identification information that uniquely corresponds to the file data content. If the source file sent to the printer by the user terminal via a PC or other terminal device has not been tampered with during transmission, the feature identification information before and after file processing should be consistent; otherwise, the file can be considered to have been tampered with during transmission. Based on this, it is possible to accurately determine whether the printed document output by the printer maintains the same content and format as the source file sent by the sending terminal, thereby effectively preventing the risk of tampering and replacement.
[0061] Specifically, addressing the current inability to verify the consistency between files received by a printing device and the original files sent by the sending end, this application provides a file verification method. This method involves the printing device parsing the file to be printed into printable file data, then calculating the feature identification information of the file data based on its unique pixel information. Simultaneously, a verification device parses and calculates the original file sent by the sending end in the same manner to obtain feature identification information. By comparing the feature identification information obtained by the verification device with that obtained by the printing device, the consistency verification between the file received by the printing device and the file sent by the sending end is achieved. This effectively identifies whether the file has been tampered with during transmission, promptly detects tampered files, and effectively prevents the spread of tampered information.
[0062] The document verification method provided in this application will be illustrated below with reference to specific embodiments.
[0063] like Figure 1 As shown, the document verification method applied to the printing device side includes the following steps:
[0064] Step 11: The printing device parses the file received from the sending end to obtain the first parsed file.
[0065] In this step, parsing the received file refers to the printing device using its own encoding conversion module (such as converting image data into a bitmap through rasterization) to convert the received file into printable data that the printing device can directly print (i.e., the first parsed file). This first parsed file is data that the printing device can directly print and has unique pixel information.
[0066] In some embodiments of this application, the above-mentioned printing device can be any type of printer, such as a laser printer, an inkjet printer, etc.
[0067] Step 12: The printing device calculates the first feature identification information of the first parsed file, and the first feature identification information uniquely corresponds to the content of the first parsed file.
[0068] The printing device can obtain the feature identification information of the first parsed file, i.e., the first feature identification information, based on the unique pixel information of the first parsed file.
[0069] Step 13: The printing device outputs the first feature identification information.
[0070] This step does not limit the method by which the printing device outputs the first feature identification information. For example, the printing device can output and display it on its screen. The verification device mainly parses the file sent by the sending end to obtain a second parsed file, calculates the second feature identification information of the second parsed file, and then verifies the consistency between the parsed file of the printing device and the file sent by the sending end based on the first and second feature identification information.
[0071] The aforementioned verification device uses the same algorithm as the printing device to parse the file sent by the sending end and calculate the feature identification information in order to perform consistency verification.
[0072] Specifically, the verification device can also parse the file sent by the sender using a built-in encoding conversion module. The verification device and the printing device use the same encoding conversion module. The verification device uses its own encoding conversion module to parse the file sent by the sender, obtaining a second parsed file and acquiring the second feature identification information of the second parsed file. It should be noted that because this application aims to verify the consistency between the file sent by the sender and the file parsed by the printing device, the printing device and the verification device use the same method for file processing. For example, the printing device uses the same parsing method for the received file, and the verification device uses the same method for the file sent by the sender. For instance, the printing device and the verification device can have the same built-in encoding conversion module. The verification device acquires the second feature identification information in the same way as the printing device acquires the first feature identification information.
[0073] It is understood that the first feature identification information mentioned above is the feature identification information corresponding to the file after transmission, while the second feature identification information is the feature identification information of the file before transmission. If the file is not tampered with during the transmission from the user device to the printing device, the first and second feature identification information should be the same; conversely, if the file is tampered with during the transmission from the user device to the printing device, the first and second feature identification information will be different. Based on this, by comparing the first and second feature identification information, the consistency verification of the file received by the printing device and the file sent by the sending end can be achieved, thereby effectively identifying whether the original file sent by the sending end has been tampered with during transmission, promptly detecting tampered files, and effectively preventing the spread of tampered information.
[0074] The following example illustrates the specific implementation process of the printing device calculating and parsing the first feature identification information of the file.
[0075] In some embodiments of this application, the printing device calculates the first feature identification information in the following specific ways:
[0076] The printing device generates a random number n; the first feature identification information is calculated based on the random number n and the data in the first parsed file.
[0077] In some embodiments of this application, the first feature identification information mentioned above may be a file hash value.
[0078] Specifically, taking file hash values as an example, the process by which the printing device calculates the first feature identifier information is as follows:
[0079] The printing device determines the number of bits k required to print one line; the data in the first parsed file is divided into m sub-data units, with each n lines containing a specific number of bits. P is the total number of bits of data in the first parsed file. For the floor operation, if P is not divisible by kn, the remaining data is the m-th sub-data.
[0080] The hash value of the first parsed file is calculated using the formula: θ m =f(θ) m-1 +p(n m ));
[0081] Where, θ m p(n) is the hash value of the first parsed file, f() is the hash function, and p(n) is the hash value of the first parsed file. m ) represents the m-th sub-data, and "+" indicates data concatenation. The hash value calculation formula for the first parsed file is an iterative formula, θ m-1 It can be understood as the hash value obtained by performing a hash function on the (m-1)th sub-data.
[0082] In some embodiments, the printing device may have a built-in hash calculator (i.e., a document hash calculator). The function of the hash calculator is to monitor the pixel information to be printed by the printing device. After parsing the print file, the printing device performs hash calculations to generate a hash value. Specifically, a separate chip can be set on the main control board of the printing device as a hash calculator to run document hash calculations. This chip can be a dedicated microcontroller unit (MCU) or a small core of a central processing unit (CPU). The parsed document can be sent by the printing device to the hash calculator and the laser control chip separately through the main control board, or the main control board can send the parsed document data to the hash calculator, which then transmits it to the laser control chip, ensuring that the data to be printed obtained by the hash calculator and the laser control chip is consistent, that is, the printed paper document is consistent with the document data used to calculate the hash value.
[0083] The first parsed file is input into a hash calculator for hash calculation, and the output of the hash calculator is used as the first feature identifier information of the first parsed file.
[0084] To better understand the process of hash calculation, an example is given below.
[0085] The first step is the file received by the printing device (denoted as A);
[0086] The second step involves the printing device parsing file A to generate data B (the first parsed file). For clarity, we'll assume B has the following format: This is just a simple assumption about rows and columns. The actual situation depends on the size and resolution of the print file. It is also assumed that each number in the expression of B is a hexadecimal number, which represents the value of 0 or 1 for 8 consecutive (pixel) dots. 0 means no ink dots are printed, and 1 means ink dots are printed.
[0087] It's important to note that when a printing device actually processes a document, it reads the document as an image, then rasterizes it into a bitmap, creating a data stream of 0s and 1s, not a matrix. However, when printing, the user selects the paper type, such as A3 or A4. Once the paper type is selected, the paper size is determined. The printing device then determines the number of pixels (or data bits) to print per line based on the selected paper size and the printing resolution, effectively determining the number of rows and columns of pixels to be printed on each sheet of media. Therefore, the format B in this example can be understood as a mathematical expression of the data stream during printing.
[0088] Based on the row and column mathematical expression of B in this example, in data processing, the hash calculation process can be performed on a row (which can be multiple rows) basis, or on a column (which can be multiple columns) basis or on a fixed matrix block basis.
[0089] Considering that file transfer to the printing device is a data streaming process, performing hash calculations row-by-row allows for real-time processing. Calculating hashes column-by-column requires the printing device to cache the file data before processing it column-by-column, placing high demands on the printing device's storage capacity. Performing hash calculations on a matrix block basis still presents storage capacity limitations for the printing device and also increases data processing complexity. Therefore, row-by-row hash calculations are the preferred approach.
[0090] The third step is to use the hash calculator to obtain the data B to be printed and then calculate the hash value.
[0091] Of course, the hash calculator can also calculate the hash value from mirrored data and then discard the original data. Here, the content of the mirrored file is consistent with the data content of the parsed file. The hash calculation process is as follows: The hash calculator first generates a random code n (i.e., the random number n mentioned above), where n ranges from 1 to 1024. Then, it performs a hash calculation on the n rows of data: f(p(n1)), where p(n1) represents taking n rows of data starting from position n(1-1)+1, that is, taking n rows of data from the data to be printed B. f() represents calculating the hash value of the data. f() can be implemented using the SM3 national cryptographic algorithm, or other algorithms such as Message Digest Algorithm Version 5 (MD5), Secure Hash Algorithm (SHA), Key-Associated Hash Message Authentication Code (HMAC), etc. Specifically, the hash value can be obtained through the formula for calculating the hash value:
[0092] θ1=f(p(n1))
[0093] θ2=f(θ1+p(n2))
[0094] θ m =f(θ) m-1 +p(n m ))
[0095] Where θ1 is a fixed-length string, n2 represents taking n rows of data starting from row n(2-1)+1, and (θ1+p(n2)) represents merging and concatenating the two data segments. m The hash value of file B, output by the hash calculator. α+4 represents the total number of bits in the data B to be printed in the second step, and m is the number of data blocks after the file is split according to the random code n.
[0096] To accurately understand the data merging and splicing described in this embodiment, an example is given below. Suppose the data to be merged and spliced is θ. i =yuio, data block is The concatenated data is then abcdefghyuio.
[0097] In some embodiments of this application, after calculating the first feature identifier information (i.e., hash value), to improve the accuracy of consistency verification, the first feature identifier information can be encrypted using a printing device to obtain encrypted first feature identifier information. That is, the printing device outputs the encrypted first feature identifier information. The encryption algorithm can be an elliptic curve public key cryptography algorithm (SM2), a block cipher algorithm (SM4), a block symmetric cipher algorithm (DES), a triple data encryption algorithm (3DES), etc.
[0098] Specifically, the encryption formula can be: D B =g(n+θ)m ), where D B The first characteristic identifier for encryption is g(), which is the encryption function (i.e., the encryption algorithm), and θ is the encryption function. m This represents the first feature identifier of the first parsed file; "+" indicates data concatenation; and n is a random number. The encryption algorithm can be integrated into the MCU or CPU core, or it can be encrypted using an encryption chip on the printer's motherboard for greater security.
[0099] The following describes a file verification method applied to the verification device side using specific embodiments.
[0100] like Figure 2 As shown, the file verification method applied to the verification device side includes the following steps:
[0101] Step 21: Verify the device to obtain the first feature identification information.
[0102] The first feature identification information uniquely corresponds to the content of the first parsed file.
[0103] The first parsed file is calculated by the printing device from the file received from the sending end.
[0104] Step 22: Verify the file sent by the sending end using the device to obtain the second parsed file;
[0105] Step 23: The verification device calculates the second feature identification information of the second parsed file;
[0106] The method used by the verification device to parse the file sent by the sender is the same as the method used by the printing device to parse the received file. In this step, parsing refers to the verification device converting the file encoding sent by the sender into data that the printing device can directly print, i.e., the second parsed file. For example, the verification device can have a built-in encoding conversion module to convert (parse) the file encoding sent by the sender, obtaining the second parsed file. The verification device then calculates the second feature identification information from the second parsed file. The verification device uses the same file parsing method and file feature identification information calculation method as the printing device. The calculation process for the second feature identification information can refer to the aforementioned calculation process for the first feature identification information, and will not be repeated here.
[0107] It should be noted that the verification device uses the same file parsing and file feature identification calculation methods as the printing device. It can be seen as the verification device repeating the file processing process of the printing device. The difference is that the verification device processes the sent file, while the printing device processes the received file. If the sent and received files are the same, and the same processing process is used, the file processing results should be consistent.
[0108] Step 24: The verification device performs consistency verification on the file received by the printing device and the file sent by the sending end based on the first feature identification information and the second feature identification information.
[0109] Specifically, if the file is not tampered with during transmission from the user's device to the printer, the first and second feature identifiers should be identical; otherwise, they should be different. Based on this, the verification device can verify the consistency between the sending file and the printing device by comparing the first and second feature identifiers, thereby effectively identifying whether the file has been tampered with during transmission, promptly detecting tampered files, and effectively preventing the spread of tampered information.
[0110] In some embodiments of this application, the verification device obtains the second feature identification information in the same way as the printing device obtains the first feature identification information. That is, the second feature identification information can also be a file hash value. Since the random number n for calculating the first feature identification information is randomly generated by the printing device, the verification device needs to obtain the random number n for calculating the first feature identification information by the printing device when calculating the second feature identification information; and calculate the second feature identification information based on the random number n and the data of the second parsed file.
[0111] In some embodiments of this application, the printing device can output a random number n simultaneously with the first feature identification information. Based on this, the verification device can directly obtain the random number n used to calculate the first feature identification information from the printing device, and calculate the second feature identification information based on the obtained random number n.
[0112] For example, the printing device can output a random number n and the first feature identification information via a hash calculator. Specifically, the output can be via the printing device screen, a communication protocol with output functionality connected to the printing device's main control interface for the printing device's web server to read and access by the user, or a USB flash drive connected to the device's USB interface. When the printing device outputs the first feature identification information and the random number n, the verification device performs consistency verification between the parsed file from the printing device and the file sent by the sending end based on the first and second feature identification information as follows: The verification device compares a character at a preset position in the first feature identification information with a character at the same preset position in the second feature identification information. If the character at the preset position in the first feature identification information is the same as the character at the same preset position in the second feature identification information, then the parsed file from the printing device and the electronic file sent by the sending end are consistent; otherwise, the parsed file from the printing device and the electronic file sent by the sending end are inconsistent. The character at the preset position can be the last 6 characters of the feature identification information, or characters at other specified positions, or characters at all positions.
[0113] In some other embodiments of this application, when the printing device outputs encrypted first feature identification information, and the verification device obtains that the first feature identification information output by the printing device is encrypted, the verification device calculates the second feature identification information in the following way: first, it decrypts the encrypted first feature identification information using the decryption method corresponding to the encrypted first feature identification information of the printing device, and obtains a random number n used by the printing device to calculate the first feature identification information; then, it calculates the second feature identification information based on the random number n.
[0114] In some embodiments of this application, after calculating the second feature identification information, to improve the accuracy of consistency verification, the document verification method further includes the following step of encrypting the second feature identification information: encrypting the second feature identification information using the same encryption algorithm used by the printing device to encrypt the first feature identification information, thereby obtaining the encrypted second feature identification information. The specific encryption algorithm is the same as the encryption process for the first feature identification information, and will not be described in detail here.
[0115] When the printing device outputs encrypted first feature identification information, and the verification device also encrypts second feature identification information, the specific implementation method for verifying the consistency between the file parsed by the printing device and the file sent by the sending end based on the first and second feature identification information is as follows: The verification device compares the character at a preset position in the encrypted first feature identification information with the character at the same preset position in the encrypted second feature identification information. If the character at the preset position in the encrypted first feature identification information is the same as the character at the same preset position in the encrypted second feature identification information, then it is determined that the file parsed by the printing device and the file sent by the sending end are consistent; otherwise, it is determined that the file parsed by the printing device and the file sent by the sending end are inconsistent. For example, the character at the preset position can be the last 6 characters of the encrypted feature identification information, or it can be a character at other specified positions, or it can be a character at all positions.
[0116] In some embodiments of this application, the aforementioned verification device can be a terminal device with computing capabilities, such as a personal computer.
[0117] The verification device can also consist of a terminal device and an external device. For example, in some embodiments, to facilitate the verification device in parsing the file sent by the sender and obtaining the corresponding feature identification information, an external device can be used to embed an encoding conversion module and a hash calculator for file parsing. Specifically, the external device can be a USB device that, apart from a verification tool, does not have read or write capabilities. Of course, in some optional examples, the external device can also embed an encryption algorithm and an encryption chip to encrypt the second feature identification information.
[0118] In summary, the verification device in this application uses the same method as the printing device to parse and calculate the file sent by the sending end to obtain feature identification information. By comparing the feature identification information obtained by the verification device with the feature identification information obtained by the printing device, the consistency verification of the file received by the printing device and the file sent by the sending end is realized. This effectively identifies whether the file sent by the sending end has been tampered with during transmission, and timely detects tampered files, effectively preventing the spread of tampered information.
[0119] Following a detailed description of the printing device and verification device sides in the above embodiments, this application provides an example of the interaction process between the printing device and the verification device. Specifically, it includes:
[0120] Step A: The printing device parses the file received from the sender to obtain the first parsed file;
[0121] Step B: The printing device calculates the first feature identification information of the first parsed file, and the first feature identification information uniquely corresponds to the content of the first parsed file;
[0122] Step C: The printing device outputs the first feature identification information;
[0123] Step D: The verification device receives the first feature identification information;
[0124] Step E: Parse the file sent by the sender to obtain the second parsed file;
[0125] Step F: Calculate the second feature identifier information of the second parsed file;
[0126] Step G: Verify the consistency between the file received by the printing device and the file sent by the sending end based on the first feature identification information and the second feature identification information.
[0127] The specific implementation of each step in this example can be found in the description of the above embodiments, and will not be repeated here.
[0128] This application also provides a document verification system, and the document verification system provided in the embodiments of this application will be described exemplarily below.
[0129] like Figure 3 As shown, the document verification system 300 provided in this application embodiment includes a printing device 301 and a verification device 302.
[0130] The printing device 301 is mainly used to perform the following steps:
[0131] Parse the file received from the sender to obtain the first parsed file;
[0132] Calculate the first feature identifier information of the first parsed file, where the first feature identifier information uniquely corresponds to the content of the first parsed file;
[0133] Output the first feature identification information;
[0134] The calibration device 302 is mainly used to perform the following steps:
[0135] The file sent by the sender is parsed to obtain a second parsed file;
[0136] Calculate the second feature identifier information of the second parsed file;
[0137] The consistency of the files received by the printing device and the files sent by the sending end is verified based on the first and second feature identification information.
[0138] It should be noted that the process of the printing device and the verification device in the document verification system acquiring feature identification information and comparing the first feature identification information and the second feature identification information to achieve consistency verification has been described in detail above, so these processes will not be repeated here.
[0139] It is worth mentioning that the verification device uses the same method as the printing device to parse the file and calculate the first feature identification information. It parses the file sent by the sending end and calculates the second feature identification information. By comparing the feature identification information of the file sent by the sending end with the feature identification information of the file parsed by the printing device, it realizes the consistency verification of the files at both ends. This effectively identifies whether the original document has been tampered with during transmission, detects tampered files in time, and effectively prevents the spread of tampered information.
[0140] The above description is the preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principles described in this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A file verification method, characterized in that, The method includes: The printing device parses the file received from the sender to obtain the first parsed file; The printing device calculates the first feature identification information of the first parsed file, and the first feature identification information uniquely corresponds to the content of the first parsed file; The printing device outputs the first feature identification information so that the verification device can parse the file sent by the sending end to obtain the second parsed file, calculate the second feature identification information of the second parsed file, and then perform consistency verification between the file received by the printing device and the file sent by the sending end based on the first feature identification information and the second feature identification information. The printing device calculates the first feature identification information of the first parsed file, including: The printing device generates a random number n; The first feature identification information is calculated based on the random number n and the data in the first parsed file; The first feature identifier is the hash value of the first parsed file. The first feature identifier is calculated based on the random number n and the data in the first parsed file, including: The printing device determines the number of bits k required to print one line of data; The data in the first parsed file is divided into m sub-data units, with each n-line containing a certain number of data bits. P represents the total number of bits in the first parsed file; The hash value calculation formula for the first parsed file is: ; in, The hash value of the first parsed file. It is a hash function. For the first Individual data points, with "+" indicating data concatenation.
2. The document verification method according to claim 1, characterized in that, Also includes: The printing device encrypts the first feature identification information, including: The encryption formula is: ,in The first feature identifier information for encryption, For encryption functions, This is the first feature identifier information of the first parsed file, and "+" indicates data concatenation.
3. A document verification method, characterized in that, The method includes: The verification device acquires the first feature identification information; the first feature identification information uniquely corresponds to the content of the first parsed file, the first parsed file is obtained by the printing device parsing a file received from the sending end, and the first feature identification information is calculated by the printing device on the first parsed file. The calculation process of the printing device on the first parsed file is as follows: the printing device generates a random number n; the first feature identification information is calculated based on the random number n and the data of the first parsed file; the first feature identification information is the hash value of the first parsed file, and the calculation of the first feature identification information based on the random number n and the data of the first parsed file includes: the printing device determining the number of data bits k required to print one line; dividing the data of the first parsed file into m sub-data units based on the number of data bits contained in n lines. P represents the total number of bits in the first parsed file; The hash value calculation formula for the first parsed file is: Where, is the hash value of the first parsed file, is the hash function, is the th sub-data, and "+" indicates data concatenation; The verification device parses the file sent by the sender to obtain the second parsed file; The verification device calculates the second feature identification information of the second parsed file; The verification device performs consistency verification on the files received by the printing device and the files sent by the sending end based on the first feature identification information and the second feature identification information.
4. The document verification method according to claim 3, characterized in that, The verification device calculates the second feature identification information of the second parsed file, including: The verification device obtains a random number n from the printing device that calculates the first feature identification information; The second feature identification information is calculated using the same algorithm as that used by the printing device to calculate the first feature identification information, based on the random number n and the data from the second parsed file.
5. The document verification method according to any one of claims 3 or 4, characterized in that, The verification device performs consistency verification on the files received by the printing device and the files sent by the sending end based on the first and second feature identification information, including: The verification device compares the character at a preset position in the first feature identification information with the character at the same preset position in the second feature identification information; If they are the same, it is determined that the file received by the printing device and the file sent by the sending end are consistent; otherwise, it is determined that the file received by the printing device and the file sent by the sending end are inconsistent.
6. The document verification method according to claim 4, characterized in that, When the first feature identification information is encrypted, the verification device obtains the random number n calculated by the printing device for the first feature identification information, including: The first feature identifier information is decrypted using the decryption method corresponding to the encryption of the first feature identifier information by the printing device, and a random number n is obtained.
7. The document verification method according to claim 6, characterized in that, Also includes: The second feature identifier information is encrypted using the same encryption algorithm used by the printing device to encrypt the first feature identifier information, resulting in encrypted second feature identifier information.
8. The document verification method according to claim 7, characterized in that, The consistency verification of electronic documents received by the printing device and electronic documents sent by the sending end is performed based on the first and second feature identification information, including: The verification device compares the character at a preset position in the encrypted first feature identification information with the character at the same preset position in the encrypted second feature identification information; If they are the same, it is determined that the file received by the printing device and the file sent by the sending end are consistent; otherwise, it is determined that the file received by the printing device and the file sent by the sending end are inconsistent.
9. A document verification system, characterized in that, The system includes printing equipment and verification equipment; The printing device is used to perform the following steps: Parse the file received from the sender to obtain the first parsed file; Calculate the first feature identifier information of the first parsed file, where the first feature identifier information uniquely corresponds to the content of the first parsed file; The printing device calculates the first feature identification information of the first parsed file, including: The printing device generates a random number n; the first feature identification information is calculated based on the random number n and the data in the first parsed file; the first feature identification information is a hash value of the first parsed file, and the calculation of the first feature identification information based on the random number n and the data in the first parsed file includes: the printing device determining the number of data bits k required to print one line; dividing the data in the first parsed file into m sub-data units based on the number of data bits contained in n lines. P is the total number of bits in the first parsed file; the hash value of the first parsed file is calculated using the following formula: ;in, The hash value of the first parsed file. It is a hash function. For the first Individual data items, "+" indicates data concatenation; Output the first feature identification information; The calibration device is used to perform the following steps: The file sent by the sender is parsed to obtain a second parsed file; Calculate the second feature identifier information of the second parsed file; The consistency of the files received by the printing device and the files sent by the sending end is verified based on the first and second feature identification information.
Citation Information
Patent Citations
File printing method and device
CN112445442A