A file signature method, verification method and device based on anti-counterfeiting image
Through the dual encryption technology of symmetric encryption and asymmetric encryption, anti-counterfeiting images are generated and embedded, which solves the problem that traditional digital signatures cannot prevent file tampering and achieves efficient anti-counterfeiting and anti-tampering of documents.
Patent Information
- Application Number
- CN202411997588.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-12-31
AI Technical Summary
Traditional digital signature technology cannot prevent document tampering and has poor anti-counterfeiting performance.
The double encryption technology based on symmetric encryption and asymmetric encryption is used to encrypt the hash value of the signature file and the symmetric encryption key of the encrypted hash value, and the anti-counterfeiting image is embedded in the file to generate an anti-counterfeiting image.
It improves the anti-counterfeiting and anti-tampering capabilities of documents, keeps verification information hidden, does not affect the normal display and transmission of documents, and reduces the risk of key leakage.
Smart Images

Figure CN119397610B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a file signing method, verification method, and device based on anti-counterfeiting images. Background Art
[0002] With the rapid development of information technology, the digital processing and transmission of documents has become increasingly frequent, and the resulting problems of document tampering and forgery have become increasingly prominent. Traditional digital signature technology can verify the authenticity of documents, but it cannot prevent document tampering, resulting in poor anti-counterfeiting performance. Summary of the Invention
[0003] The present disclosure provides a document signing method, a verification method, and a device based on an anti-counterfeiting image to at least solve the above technical problems existing in the prior art.
[0004] According to a first aspect of the present disclosure, a file signing method based on an anti-counterfeiting image is provided, comprising: performing hash processing on a file to be signed to obtain a hash value of the file to be signed; encrypting the hash value based on a symmetric encryption key to obtain an encrypted hash value; encrypting the symmetric encryption key based on a first asymmetric encryption public key to obtain an encryption key; generating an anti-counterfeiting image based on the encrypted hash value and the encryption key; and embedding the anti-counterfeiting image into the file to be signed.
[0005] In one possible implementation, before encrypting the hash value based on the symmetric encryption key to obtain the encrypted hash value, the method further includes: generating a random number based on a random number generator, and determining the random number as the symmetric encryption key.
[0006] In one possible implementation, a file signing method based on an anti-counterfeiting image further includes: obtaining timestamp information corresponding to the anti-counterfeiting image; encrypting the timestamp information based on a second asymmetric encryption public key to obtain an encrypted timestamp; and embedding the encrypted timestamp into the anti-counterfeiting image.
[0007] In one possible implementation, embedding the anti-counterfeiting image into the document to be signed includes: determining an embedding strategy for the anti-counterfeiting image based on the file type and confidentiality level of the document to be signed, the embedding strategy including at least one of embedding transparency, embedding size, embedding position, embedding frequency, and embedding algorithm of the anti-counterfeiting image; and embedding the anti-counterfeiting image into the document to be signed based on the embedding strategy.
[0008] According to a second aspect of the present disclosure, a document verification method based on an anti-counterfeiting image is provided, comprising: obtaining a document to be verified; determining an encrypted hash value and an encryption key based on the anti-counterfeiting image in the document to be verified; decrypting the encryption key based on a first asymmetric encryption private key to obtain a symmetric encryption key; decrypting the encrypted hash value based on the symmetric encryption key to obtain a first hash value; performing hash processing on the document to be verified with the anti-counterfeiting image removed to obtain a second hash value; and comparing the first hash value and the second hash value to obtain a first verification result.
[0009] In one possible implementation manner, determining the encrypted hash value and encryption key based on the anti-counterfeiting image in the document to be verified includes: determining a decoding strategy corresponding to the anti-counterfeiting image based on the type of the anti-counterfeiting image; and decoding the anti-counterfeiting image based on the decoding strategy to obtain the encrypted hash value and encryption key.
[0010] In one possible implementation, a file verification method based on an anti-counterfeiting image further includes: determining an encrypted timestamp corresponding to the anti-counterfeiting image based on the anti-counterfeiting image in the file to be verified; decrypting the encrypted timestamp based on a second asymmetric encryption private key to obtain timestamp information corresponding to the anti-counterfeiting image; and verifying the timestamp information to obtain a second verification result.
[0011] In one possible implementation, the comparing the first hash value and the second hash value to obtain a first verification result includes: in response to the first hash value and the second hash value being the same, determining that the first verification result is that the file to be verified has not been tampered with; in response to the first hash value and the second hash value being different, determining that the first verification result is that the file to be verified has been tampered with.
[0012] According to a third aspect of the present disclosure, a file signing device based on an anti-counterfeiting image is provided, comprising: a first hash module, configured to perform hash processing on a file to be signed to obtain a hash value of the file to be signed; an encryption module, configured to encrypt the hash value based on a symmetric encryption key to obtain an encrypted hash value; the encryption module is further configured to encrypt the symmetric encryption key based on a first asymmetric encryption public key to obtain an encryption key; a generation module, configured to generate an anti-counterfeiting image based on the encrypted hash value and the encryption key; and an embedding module, configured to embed the anti-counterfeiting image into the file to be signed.
[0013] According to a fourth aspect of the present disclosure, a document verification device based on an anti-counterfeiting image is provided, comprising: an acquisition module for acquiring a document to be verified; a determination module for determining an encrypted hash value and an encryption key based on the anti-counterfeiting image in the document to be verified; a decryption module for decrypting the encryption key based on a first asymmetric encryption private key to obtain a symmetric encryption key; the decryption module is further used to decrypt the encrypted hash value based on the symmetric encryption key to obtain a first hash value; a second hash module for performing hash processing on the document to be verified with the anti-counterfeiting image removed to obtain a second hash value; and a verification module for comparing the first hash value and the second hash value to obtain a first verification result.
[0014] According to a fifth aspect of the present disclosure, there is provided an electronic device, including:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.
[0018] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the present disclosure.
[0019] The disclosed file signing method, verification method and device based on anti-counterfeiting images adopt a dual encryption technology based on symmetric encryption and asymmetric encryption compared to traditional digital signature technology. The hash value of the signed file and the symmetric encryption key of the encrypted hash value are encrypted respectively, thereby improving the anti-counterfeiting and anti-tampering capabilities of the file. In addition, the encrypted hash value and encryption key are embedded in the file in the form of an anti-counterfeiting image, which can further improve the anti-counterfeiting performance of the file without affecting the normal display and transmission of the file.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings, in which several embodiments of the present disclosure are shown by way of example and not limitation, wherein:
[0022] In the drawings, the same or corresponding reference numerals denote the same or corresponding parts.
[0023] Figure 1 A schematic diagram showing a process of a file signing method based on an anti-counterfeiting image according to an embodiment of the present disclosure is shown;
[0024] Figure 2 A schematic diagram showing a flow chart of a method for document verification based on anti-counterfeiting images according to an embodiment of the present disclosure is shown;
[0025] Figure 3 A schematic structural diagram of a document signature device based on an anti-counterfeiting image according to an embodiment of the present disclosure is shown;
[0026] Figure 4 A schematic structural diagram of a document verification device based on anti-counterfeiting images according to an embodiment of the present disclosure is shown;
[0027] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0028] To make the purposes, features, and advantages of the present disclosure more apparent and understandable, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without creative work shall fall within the scope of protection of the present disclosure.
[0029] Figure 1 A schematic diagram of a process of a file signature method based on an anti-counterfeiting image according to an embodiment of the present disclosure is shown. Figure 1 As shown, a file signing method based on an anti-counterfeiting image includes:
[0030] Step S101: Perform hash processing on the file to be signed to obtain a hash value of the file to be signed.
[0031] In this embodiment, the file to be signed can be any file that needs to be signed. The file to be signed can be a text file, an image file, an audio file, a video file, etc. It is necessary to hash the file to be signed using a hash algorithm such as SHA-256, SHA-3 or SM3 to obtain a hash value of the file to be signed.
[0032] Step S102: Encrypt the hash value based on the symmetric encryption key to obtain an encrypted hash value.
[0033] In this embodiment, a random number can be generated based on a random number generator and determined as a symmetric encryption key. The symmetric encryption key of each file is different. In this way, even if the symmetric encryption key of a certain file is leaked, it will not affect the security of other files. Based on the symmetric encryption key, the hash value of the file to be signed can be encrypted by a symmetric encryption algorithm such as the Advanced Encryption Standard (AES) and the national secret algorithm SM4 to obtain an encrypted hash value.
[0034] Step S103: Encrypt the symmetric encryption key based on the first asymmetric encryption public key to obtain an encryption key.
[0035] In this embodiment, a first asymmetric encryption key pair must be pre-generated, comprising a first asymmetric encryption private key and a first asymmetric encryption public key. Based on the first asymmetric encryption public key, the symmetric encryption key can be encrypted using an asymmetric encryption algorithm to obtain an encryption key, thereby ensuring the security of the symmetric encryption key. In one example, the asymmetric encryption algorithm can be an elliptic curve cryptography (ECC), RSA, SM2, or other algorithms.
[0036] Step S104: Generate an anti-counterfeiting image based on the encrypted hash value and the encryption key.
[0037] In this embodiment, the anti-counterfeiting image can be an image encoding format with high fault tolerance, such as a QR code, barcode, and anti-counterfeiting code. For example, if the anti-counterfeiting image is in a QR code format, the encrypted hash value and encryption key can be converted into a string, and the QR code generation library can be used to encode the string into a QR code to obtain the anti-counterfeiting image.
[0038] Step S105: embed the anti-counterfeiting image into the document to be signed.
[0039] In this embodiment, after the anti-counterfeiting image is generated, it is necessary to embed the anti-counterfeiting image into the document to be signed so that the document to be signed can be subsequently verified based on the anti-counterfeiting image.
[0040] The disclosed file signing method based on anti-counterfeiting image adopts a dual encryption technology based on symmetric encryption and asymmetric encryption compared to traditional digital signature technology, and encrypts the hash value of the signed file and the symmetric encryption key of the encrypted hash value respectively, thereby improving the anti-counterfeiting and anti-tampering capabilities of the file. In addition, the encrypted hash value and the encryption key are embedded in the file in the form of an anti-counterfeiting image, making the verification information more concealed and not easily observed or removed, thereby increasing the difficulty of tampering. It can further improve the anti-counterfeiting performance of the file without affecting the normal display and transmission of the file, and avoid the key leakage risk that may exist in traditional digital signature technology.
[0041] In another embodiment, a file signing method based on an anti-counterfeiting image further includes: obtaining timestamp information corresponding to the anti-counterfeiting image; encrypting the timestamp information based on a second asymmetric encryption public key to obtain an encrypted timestamp; and embedding the encrypted timestamp into the anti-counterfeiting image.
[0042] In this embodiment, the timestamp information corresponding to the anti-counterfeiting image can be requested from the timestamp authority (TSA) server, or the timestamp information of the anti-counterfeiting image can be determined in the local system. Then, based on the preset second asymmetric encryption public key, the timestamp information is encrypted using an asymmetric encryption algorithm such as ECC and RSA to obtain an encrypted timestamp, which is then embedded in the anti-counterfeiting image. That is, the anti-counterfeiting image can be generated based on the encrypted hash value, encryption key and encrypted timestamp. The encrypted timestamp can not only be used to determine the generation time of the anti-counterfeiting image, but also prevent the anti-counterfeiting image from being tampered with after generation.
[0043] In another embodiment, step S105 "embedding the anti-counterfeiting image into the document to be signed" includes: determining an embedding strategy for the anti-counterfeiting image based on the file type and confidentiality level of the document to be signed, the embedding strategy including at least one of the embedding transparency, embedding size, embedding position, embedding frequency and embedding algorithm of the anti-counterfeiting image; and embedding the anti-counterfeiting image into the document to be signed based on the embedding strategy.
[0044] In this embodiment, the embedding strategy for the anti-counterfeiting image can be different for documents of different types and confidentiality levels to be signed. For example, for text files, the anti-counterfeiting image can be embedded in the document's footer; for video files, the anti-counterfeiting image can be embedded in the document in a scrolling manner; and for files with high confidentiality levels, the embedding transparency can be set to the highest level to ensure that the anti-counterfeiting image is difficult to detect by ordinary means. Therefore, it is necessary to determine the embedding strategy for the anti-counterfeiting image based on the file type and confidentiality level of the document to be signed. The embedding strategy includes at least one of the embedding transparency, embedding size, embedding position, embedding frequency, and embedding algorithm of the anti-counterfeiting image. The embedding frequency represents the number of times or embedding density of the anti-counterfeiting image in the document to be signed, for example, whether one or multiple anti-counterfeiting images are embedded per page in the document to be signed. The embedding algorithm can be a discrete cosine transform (DCT) domain embedding algorithm or a discrete wavelet transform (DWT) domain embedding algorithm. Based on the embedding strategy, the anti-counterfeiting image is embedded in the document to be signed, thereby enhancing security while improving embedding efficiency.
[0045] Figure 2FIG. 1 shows a flow chart of a method for document verification based on anti-counterfeiting images according to an embodiment of the present disclosure. Figure 2 As shown, a document verification method based on anti-counterfeiting images includes:
[0046] Step S201: Obtain the file to be verified.
[0047] In this embodiment, the file to be verified can be any file that needs to be verified, the file to be signed can be a text file, image file, audio file or video file, etc. The file to be verified is a signed file and includes an anti-counterfeiting image.
[0048] Step S202: Determine an encrypted hash value and an encryption key based on the anti-counterfeiting image in the document to be verified.
[0049] In this embodiment, the anti-counterfeiting image can be a QR code, barcode, or security code. Scanning the anti-counterfeiting image in the document to be verified can generate an encrypted hash value and encryption key. Specifically, when signing the document to be verified, the hash value of the document to be verified is symmetrically encrypted using the symmetric encryption key to obtain an encrypted hash value, and the symmetric encryption key is asymmetrically encrypted to obtain an encryption key. The encrypted hash value and encryption key are used to generate the anti-counterfeiting image and embed it in the document to be verified.
[0050] Step S203: decrypt the encryption key based on the first asymmetric encryption private key to obtain a symmetric encryption key.
[0051] In this embodiment, since the encryption key is generated based on the first asymmetric encryption public key, after obtaining the encrypted hash value and the encryption key, it is necessary to decrypt the encryption key based on the first asymmetric encryption private key corresponding to the first asymmetric encryption public key to obtain the symmetric encryption key.
[0052] Step S204: decrypt the encrypted hash value based on the symmetric encryption key to obtain a first hash value.
[0053] In this embodiment, after decrypting to obtain the symmetric encryption key, the encrypted hash value needs to be decrypted based on the symmetric encryption key to obtain a first hash value. The first hash value can represent the content of the file to be verified when it is signed.
[0054] Step S205 , performing hash processing on the document to be verified with the anti-counterfeiting image removed to obtain a second hash value.
[0055] In this embodiment, in order to ensure that the file to be verified has not been tampered with, it is necessary to compare the current hash value of the file to be verified with the first hash value generated when the file to be verified is signed. Since the first hash value is only generated by the content of the file to be verified when signing, and the current file to be verified includes the content of the file to be verified and the anti-counterfeiting image, it is necessary to first remove the anti-counterfeiting image in the current file to be verified, and then perform hash processing on the current file to be verified to obtain the second hash value.
[0056] Step S206: Compare the first Hash value and the second Hash value to obtain a first verification result.
[0057] In this embodiment, the first hash value represents the content of the file to be verified at the time of signing, and the second hash value represents the current content of the file to be verified. If the first hash value and the second hash value are the same, it proves that the file to be verified has not been tampered with or forged since signing. If the first hash value and the second hash value are different, it proves that the file to be verified may have been tampered with or forged since signing. That is, in response to the first hash value and the second hash value being the same, it is determined that the first verification result is that the file to be verified has not been tampered with; in response to the first hash value and the second hash value being different, it is determined that the first verification result is that the file to be verified has been tampered with.
[0058] The disclosed method for document verification based on anti-counterfeiting images requires only extracting the anti-counterfeiting image from the document to be verified, obtaining a symmetric encryption key using a first asymmetric encryption private key, and then decrypting the encrypted hash value and comparing it with the current hash value of the document to be verified to complete the verification. This process is relatively simple and efficient, and the introduction of the anti-counterfeiting image makes the verification information more concealed, making it difficult to directly observe or easily remove, increasing the difficulty of tampering and further improving the anti-counterfeiting performance of the document.
[0059] In another embodiment, step S202 "determining the encrypted hash value and encryption key based on the anti-counterfeiting image in the document to be verified" includes: determining the decoding strategy corresponding to the anti-counterfeiting image based on the type of the anti-counterfeiting image; decoding the anti-counterfeiting image based on the decoding strategy to obtain the encrypted hash value and encryption key.
[0060] In this embodiment, different types of anti-counterfeiting images may correspond to different decoding strategies. For example, if the anti-counterfeiting image is a QR code, the QR code image can be directly scanned to obtain the encrypted hash value and encryption key; if the anti-counterfeiting image is a digital watermark, the pixel information in the anti-counterfeiting image can be extracted, and the inverse transformation can be applied to restore the encrypted hash value and encryption key. Therefore, based on the type of anti-counterfeiting image, the decoding strategy corresponding to the anti-counterfeiting image can be determined, and then based on the decoding strategy, the anti-counterfeiting image can be decoded to obtain the encrypted hash value and encryption key.
[0061] In another embodiment, a file verification method based on an anti-counterfeiting image further includes: determining an encrypted timestamp corresponding to the anti-counterfeiting image based on the anti-counterfeiting image in the file to be verified; decrypting the encrypted timestamp based on a second asymmetric encryption private key to obtain timestamp information corresponding to the anti-counterfeiting image; and verifying the timestamp information to obtain a second verification result.
[0062] In this embodiment, an encrypted timestamp is also embedded in the anti-counterfeiting image. The encrypted timestamp can be obtained by scanning the anti-counterfeiting image. The encrypted timestamp is obtained by encrypting the timestamp information based on the second asymmetric encryption public key. Therefore, it is necessary to decrypt the encrypted timestamp based on the second asymmetric encryption private key corresponding to the second asymmetric encryption public key to obtain the timestamp information corresponding to the anti-counterfeiting image, and verify the timestamp information based on the timestamp authority server to obtain a second verification result indicating whether the timestamp information has been modified after signing.
[0063] Figure 3 A schematic diagram of the structure of a document signature device based on an anti-counterfeiting image according to an embodiment of the present disclosure is shown. Figure 3 As shown, a document signature device based on an anti-counterfeiting image comprises:
[0064] The first hash module 10 is used to perform hash processing on the file to be signed to obtain a hash value of the file to be signed; the encryption module 11 is used to encrypt the hash value based on the symmetric encryption key to obtain an encrypted hash value; the encryption module 11 is also used to encrypt the symmetric encryption key based on the first asymmetric encryption public key to obtain an encryption key; the generation module 12 is used to generate an anti-counterfeiting image based on the encrypted hash value and the encryption key; the embedding module 13 is used to embed the anti-counterfeiting image into the file to be signed.
[0065] In one possible implementation, a document signature device based on an anti-counterfeiting image further includes: a random number generation module, configured to generate a random number based on a random number generator, and determine the random number as a symmetric encryption key.
[0066] In one possible implementation, a file signature device based on an anti-counterfeiting image also includes: a timestamp acquisition module, used to obtain timestamp information corresponding to the anti-counterfeiting image; the encryption module 11 is also used to encrypt the timestamp information based on a second asymmetric encryption public key to obtain an encrypted timestamp; the embedding module 13 is also used to embed the encrypted timestamp into the anti-counterfeiting image.
[0067] In one embodiment, the embedding module 13 is further used to: determine the embedding strategy of the anti-counterfeiting image based on the file type and confidentiality level of the document to be signed, the embedding strategy including at least one of the embedding transparency, embedding size, embedding position, embedding frequency and embedding algorithm of the anti-counterfeiting image; and embed the anti-counterfeiting image into the document to be signed based on the embedding strategy.
[0068] Figure 4 FIG. 1 shows a schematic diagram of a document verification device based on an anti-counterfeiting image according to an embodiment of the present disclosure. Figure 4 As shown, a document verification device based on anti-counterfeiting images includes:
[0069] An acquisition module 20 is used to obtain a file to be verified; a determination module 21 is used to determine an encrypted hash value and an encryption key based on an anti-counterfeiting image in the file to be verified; a decryption module 22 is used to decrypt the encryption key based on a first asymmetric encryption private key to obtain a symmetric encryption key; the decryption module 22 is also used to decrypt the encrypted hash value based on the symmetric encryption key to obtain a first hash value; a second hash module 23 is used to perform hash processing on the file to be verified with the anti-counterfeiting image removed to obtain a second hash value; and a verification module 24 is used to compare the first hash value and the second hash value to obtain a first verification result.
[0070] In one embodiment, the determination module 21 is further configured to: determine a decoding strategy corresponding to the anti-counterfeiting image based on the type of the anti-counterfeiting image; and decode the anti-counterfeiting image based on the decoding strategy to obtain an encrypted hash value and an encryption key.
[0071] In one possible implementation mode, the determination module 21 is also used to determine the encrypted timestamp corresponding to the anti-counterfeiting image based on the anti-counterfeiting image in the file to be verified; the decryption module 22 is also used to decrypt the encrypted timestamp based on the second asymmetric encryption private key to obtain the timestamp information corresponding to the anti-counterfeiting image; the verification module 24 is also used to verify the timestamp information to obtain a second verification result.
[0072] In one embodiment, the verification module 24 is further configured to: in response to the first hash value being the same as the second hash value, determine that the first verification result is that the file to be verified has not been tampered with; in response to the first hash value being different from the second hash value, determine that the first verification result is that the file to be verified has been tampered with.
[0073] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0074] Figure 5A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0075] like Figure 5 As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. Computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to bus 804.
[0076] Various components in device 800 are connected to I / O interface 805, including an input unit 806, such as a keyboard, mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a magnetic disk, optical disk, etc.; and a communication unit 809, such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0077] The computing unit 801 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as a method for signing a document based on an anti-counterfeiting image and / or a method for verifying a document based on an anti-counterfeiting image. For example, in some embodiments, a method for signing a document based on an anti-counterfeiting image and / or a method for verifying a document based on an anti-counterfeiting image can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into RAM 803 and executed by computing unit 801, one or more steps of the aforementioned security image-based document signature method and / or security image-based document verification method may be performed. Alternatively, in other embodiments, computing unit 801 may be configured to perform the security image-based document signature method and / or security image-based document verification method via any other suitable means (e.g., via firmware).
[0078] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0079] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0080] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fibers, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0081] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0082] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0083] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.
[0084] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.
[0085] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. Throughout the present disclosure, "plurality" means two or more, unless otherwise specifically defined.
[0086] The above description is merely a specific embodiment of the present disclosure, but the scope of protection of the present disclosure is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this disclosure should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be based on the scope of protection of the claims.
Claims
1. A document signature method based on anti-counterfeiting image, characterized in that: The method comprises: Perform hash processing on the file to be signed to obtain the hash value of the file to be signed; Encrypting the hash value based on a symmetric encryption key to obtain an encrypted hash value; Encrypting the symmetric encryption key based on the first asymmetric encryption public key to obtain an encryption key; generating an anti-counterfeiting image based on the encrypted hash value and the encryption key; embedding the anti-counterfeiting image into the document to be signed; The step of embedding the anti-counterfeiting image into the document to be signed comprises: Determining an embedding strategy for the anti-counterfeiting image based on the file type and confidentiality level of the document to be signed, the embedding strategy including at least one of embedding transparency, embedding size, embedding position, embedding frequency, and embedding algorithm of the anti-counterfeiting image; Embedding the anti-counterfeiting image into the document to be signed based on the embedding strategy; The method further comprises: Obtaining timestamp information corresponding to the anti-counterfeiting image; Encrypting the timestamp information based on a second asymmetric encryption public key to obtain an encrypted timestamp; The encrypted timestamp is embedded in the anti-counterfeiting image.
2. The method according to claim 1, characterized in that Before encrypting the hash value based on the symmetric encryption key to obtain the encrypted hash value, the method further includes: A random number is generated based on a random number generator, and the random number is determined as the symmetric encryption key.
3. A document verification method based on anti-counterfeiting images, characterized in that: The method comprises: Get the file to be verified; Determining an encrypted hash value and an encryption key based on the anti-counterfeiting image in the document to be verified; embedding the anti-counterfeiting image in the document to be verified based on an embedding strategy, wherein the embedding strategy is determined based on the file type and confidentiality level of the document to be verified, and the embedding strategy includes at least one of an embedding transparency, an embedding size, an embedding position, an embedding frequency, and an embedding algorithm of the anti-counterfeiting image; Decrypting the encryption key based on the first asymmetric encryption private key to obtain a symmetric encryption key; Decrypting the encrypted hash value based on the symmetric encryption key to obtain a first hash value; Performing hash processing on the document to be verified with the anti-counterfeiting image removed to obtain a second hash value; Comparing the first Hash value and the second Hash value to obtain a first verification result; Determining an encryption timestamp corresponding to the anti-counterfeiting image based on the anti-counterfeiting image in the document to be verified; Decrypting the encrypted timestamp based on the second asymmetric encryption private key to obtain timestamp information corresponding to the anti-counterfeiting image; The timestamp information is verified to obtain a second verification result.
4. The method according to claim 3, characterized in that The step of determining an encrypted hash value and an encryption key based on the anti-counterfeiting image in the document to be verified includes: Determining a decoding strategy corresponding to the anti-counterfeiting image based on the type of the anti-counterfeiting image; Based on the decoding strategy, the anti-counterfeiting image is decoded to obtain the encrypted hash value and encryption key.
5. The method according to any one of claims 3 to 4, characterized in that: The comparing the first hash value and the second hash value to obtain a first verification result includes: In response to the first hash value being the same as the second hash value, determining that the first verification result is that the file to be verified has not been tampered with; In response to the first hash value being different from the second hash value, it is determined that the first verification result is that the file to be verified has been tampered with.
6. A document signature device based on an anti-counterfeiting image, characterized in that: The device comprises: The first hash module is used to perform hash processing on the file to be signed to obtain a hash value of the file to be signed; An encryption module, configured to encrypt the hash value based on a symmetric encryption key to obtain an encrypted hash value; The encryption module is further configured to encrypt the symmetric encryption key based on the first asymmetric encryption public key to obtain an encryption key; A generating module, configured to generate an anti-counterfeiting image based on the encrypted hash value and the encryption key; An embedding module, configured to embed the anti-counterfeiting image into the document to be signed; The embedding module is further configured to: determine an embedding strategy for the anti-counterfeiting image based on the file type and confidentiality level of the document to be signed, the embedding strategy including at least one of embedding transparency, embedding size, embedding position, embedding frequency, and embedding algorithm of the anti-counterfeiting image; and embed the anti-counterfeiting image into the document to be signed based on the embedding strategy; The device further comprises: a timestamp acquisition module, configured to acquire timestamp information corresponding to the anti-counterfeiting image; The encryption module is further configured to encrypt the timestamp information based on the second asymmetric encryption public key to obtain an encrypted timestamp; The embedding module is further configured to embed an encrypted timestamp into the anti-counterfeiting image.
7. A document verification device based on anti-counterfeiting images, characterized in that: The device comprises: The acquisition module is used to obtain the file to be verified; a determination module, configured to determine an encrypted hash value and an encryption key based on the anti-counterfeiting image in the document to be verified; wherein the anti-counterfeiting image is embedded in the document to be verified based on an embedding strategy, wherein the embedding strategy is determined based on the file type and confidentiality level of the document to be verified, and wherein the embedding strategy includes at least one of an embedding transparency, an embedding size, an embedding position, an embedding frequency, and an embedding algorithm of the anti-counterfeiting image; a decryption module, configured to decrypt the encryption key based on the first asymmetric encryption private key to obtain a symmetric encryption key; The decryption module is further configured to decrypt the encrypted hash value based on the symmetric encryption key to obtain a first hash value; a second hash module, configured to perform hash processing on the document to be verified with the anti-counterfeiting image removed to obtain a second hash value; a verification module, configured to compare the first hash value and the second hash value to obtain a first verification result; The determination module is further configured to determine an encrypted timestamp corresponding to the anti-counterfeiting image based on the anti-counterfeiting image in the document to be verified; The decryption module is further used to decrypt the encrypted timestamp based on the second asymmetric encryption private key to obtain timestamp information corresponding to the anti-counterfeiting image; The verification module is further used to verify the timestamp information to obtain a second verification result.
Citation Information
Patent Citations
Health physical examination management system and method for enterprise client
CN107301616A
Digital signature method, digital signature verification method, electronic equipment and storage medium
CN112651031A
File access control system and control method
CN118965420A