File signature method, verification method and device based on anti-counterfeiting image
By embedding anti-counterfeiting images of encrypted hash values and keys in the file, using symmetric and asymmetric encryption technologies, the problem that traditional digital signatures cannot be tampered can be solved, and higher file anti-counterfeiting performance is achieved.
Patent Information
- Application Number
- CN202411997588.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-12-31
AI Technical Summary
Although traditional digital signature technology can verify the authenticity of files, it cannot effectively prevent files from being tampered with, resulting in poor anti-counterfeiting performance of files.
The dual encryption technology based on symmetric encryption and asymmetric encryption is adopted to encrypt the hash value of the signed file, and the encrypted hash value and encryption key are embedded in the file in the form of an anti-counterfeiting image.
It significantly improves the anti-counterfeiting and tampering capabilities of files, ensuring that files are not tampered during transmission and storage, and avoids the possible risk of key leakage in traditional digital signature technology.
Smart Images

Figure CN119397610A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a file signing method, a verification method and a device based on anti-counterfeiting images. Background Art
[0002] With the rapid development of information technology, the digital processing and transmission of documents have become more frequent, and the problems of document tampering and forgery have become increasingly prominent. Although traditional digital signature technology can verify the authenticity of documents, it cannot prevent document tampering and has poor anti-counterfeiting performance. Summary of the invention
[0003] The present disclosure provides a file signing method, a verification method and a device based on an anti-counterfeiting image, so as 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 manner, 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 also 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 file verification method based on an anti-counterfeiting image is provided, comprising: obtaining a file to be verified; determining an encrypted hash value and an encryption key based on the anti-counterfeiting image in the file 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 file 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.
[0009] In one possible implementation manner, determining the encrypted hash value and the 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 the encryption key.
[0010] In one possible implementation, a file verification method based on anti-counterfeiting images also 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 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, 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, used to perform hash processing on a file to be signed to obtain a hash value of the file to be signed; an encryption module, used to encrypt the hash value based on a symmetric encryption key to obtain an encrypted hash value; the encryption module is also used to encrypt the symmetric encryption key based on a first asymmetric encryption public key to obtain an encryption key; a generation module, used to generate an anti-counterfeiting image based on the encrypted hash value and the encryption key; and an embedding module, used 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 with 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: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and 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.
[0015] 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.
[0016] The disclosed anti-counterfeiting image-based file signing method, verification method and device adopt a dual encryption technology based on symmetric encryption and asymmetric encryption compared to traditional digital signature technology, and encrypt 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, and embedding the encrypted hash value and the encryption key into 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.
[0017] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] 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 the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which: In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0019] Figure 1 A schematic diagram of a process of a file signing method based on an anti-counterfeiting image according to an embodiment of the present disclosure is shown; Figure 2 A schematic diagram of a process of a document verification method based on an anti-counterfeiting image according to an embodiment of the present disclosure is shown; 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 4 A schematic diagram of the structure of a document verification device based on an anti-counterfeiting image according to an embodiment of the present disclosure is shown; Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0020] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0021] Figure 1 A schematic diagram of a process of a file signing 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 anti-counterfeiting image includes: Step S101, performing hash processing on the file to be signed to obtain a hash value of the file to be signed.
[0022] 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 or 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.
[0023] Step S102: encrypt the hash value based on the symmetric encryption key to obtain an encrypted hash value.
[0024] 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, so that 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 through a symmetric encryption algorithm such as the Advanced Encryption Standard (AES) and the national secret algorithm SM4 to obtain an encrypted hash value.
[0025] Step S103: encrypt the symmetric encryption key based on the first asymmetric encryption public key to obtain an encryption key.
[0026] In this embodiment, it is necessary to pre-generate a first asymmetric encryption key pair, including 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 by 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) algorithm, RSA, SM2 and other algorithms.
[0027] Step S104: Generate an anti-counterfeiting image based on the encrypted hash value and the encryption key.
[0028] 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 the 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.
[0029] Step S105, embedding the anti-counterfeiting image into the document to be signed.
[0030] 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.
[0031] 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, and embeds the encrypted hash value and the encryption key into the file in the form of an anti-counterfeiting image, so that the verification information is more concealed and not easily observed or removed directly, which increases the difficulty of tampering, and can further improve the anti-counterfeiting performance of the file without affecting the normal display and transmission of the file, and avoids the key leakage risk that may exist in traditional digital signature technology.
[0032] 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.
[0033] In this embodiment, the timestamp information corresponding to the anti-counterfeiting image can be requested from a timestamp authority (TSA) server, or the timestamp information for generating the anti-counterfeiting image can be determined in the local system, and then the timestamp information is encrypted based on a preset second asymmetric encryption public key 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, the encryption key, and the 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 it is generated.
[0034] 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.
[0035] In this embodiment, for files to be signed of different types and confidentiality levels, the embedding strategies of the anti-counterfeiting images may be different. For example, for text files, the anti-counterfeiting images may be embedded in the footer of the files; for video files, the anti-counterfeiting images may be embedded in the files in a scrolling form; for files with a high confidentiality level, the embedding transparency may be set to the highest to ensure that the anti-counterfeiting images are difficult to be detected by ordinary means. Therefore, it is necessary to determine the embedding strategy of the anti-counterfeiting images based on the file type and confidentiality level of the files 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 images, wherein the embedding frequency represents the number of embedding times or embedding density of the anti-counterfeiting images in the files to be signed, for example, whether one or multiple anti-counterfeiting images are embedded in each page of the files to be signed; the embedding algorithm may be a discrete cosine transform (DCT) domain embedding algorithm and a discrete wavelet transform (DWT) domain embedding algorithm, etc. Then, based on the embedding strategy, the anti-counterfeiting images are embedded in the files to be signed, thereby improving the embedding efficiency while enhancing security.
[0036] Figure 2A schematic diagram of a process of a file verification method based on an anti-counterfeiting image according to an embodiment of the present disclosure is shown. Figure 2 As shown, a document verification method based on anti-counterfeiting images includes: Step S201, obtaining the file to be verified.
[0037] 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, an image file, an audio file or a video file, etc. The file to be verified is a signed file, and the file to be verified includes an anti-counterfeiting image.
[0038] Step S202: determining an encrypted hash value and an encryption key based on the anti-counterfeiting image in the document to be verified.
[0039] In this embodiment, the anti-counterfeiting image can be a QR code, a barcode, an anti-counterfeiting code, etc. Scanning the anti-counterfeiting image in the document to be verified can obtain an encrypted hash value and an encryption key. Specifically, when signing the document to be verified, the hash value of the document to be verified is symmetrically encrypted based on the symmetric encryption key to obtain an encrypted hash value, and the symmetric encryption key is asymmetrically encrypted to obtain an encryption key. The anti-counterfeiting image is generated by the encrypted hash value and the encryption key and embedded in the document to be verified.
[0040] Step S203: decrypt the encryption key based on the first asymmetric encryption private key to obtain a symmetric encryption key.
[0041] 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.
[0042] Step S204: decrypt the encrypted hash value based on the symmetric encryption key to obtain a first hash value.
[0043] In this embodiment, after decrypting to obtain the symmetric encryption key, it is necessary to decrypt the encrypted hash value based on the symmetric encryption key to obtain a first hash value, which can represent the content of the file to be verified when it is signed.
[0044] Step S205: performing hash processing on the document to be verified with the anti-counterfeiting image removed to obtain a second hash value.
[0045] 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 was signed. Since the first hash value is generated only 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.
[0046] Step S206: compare the first Hash value and the second Hash value to obtain a first verification result.
[0047] 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 is the same as the second hash value, it proves that the file to be verified has not been tampered with or forged since the signing. If the first hash value is different from the second hash value, it proves that the file to be verified may have been tampered with or forged since the signing. That is, in response to the first hash value being the same as the second hash value, 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 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.
[0048] The disclosed method for document verification based on anti-counterfeiting images only needs to extract the anti-counterfeiting image from the document to be verified, and obtain the symmetric encryption key through the first asymmetric encryption private key, and then decrypt the encrypted hash value and compare 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, not easy to be directly observed or easily removed, increases the difficulty of tampering, and further improves the anti-counterfeiting performance of the document. In another embodiment, step S202 "determining the encrypted hash value and the 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 the encryption key.
[0049] 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.
[0050] In another embodiment, a file verification method based on anti-counterfeiting images also 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.
[0051] 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.
[0052] 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: The first hash module 10 is used to perform hash processing on the file to be signed to obtain the 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.
[0053] 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.
[0054] In one possible implementation, a file signing 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.
[0055] In one embodiment, the embedding module 13 is also 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.
[0056] Figure 4 A schematic diagram of the structure of a document verification device based on an anti-counterfeiting image according to an embodiment of the present disclosure is shown. Figure 4 As shown, a document verification device based on anti-counterfeiting images includes: The acquisition module 20 is used to obtain the file to be verified; the determination module 21 is used to determine the encrypted hash value and the encryption key based on the anti-counterfeiting image in the file to be verified; the decryption module 22 is used to decrypt the encryption key based on the first asymmetric encryption private key to obtain the symmetric encryption key; the decryption module 22 is also used to decrypt the encrypted hash value based on the symmetric encryption key to obtain the first hash value; the second hash module 23 is used to perform hash processing on the file to be verified with the anti-counterfeiting image removed to obtain the second hash value; the verification module 24 is used to compare the first hash value and the second hash value to obtain a first verification result.
[0057] In one possible implementation, the determination module 21 is further used 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.
[0058] 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 document 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.
[0059] In one embodiment, the verification module 24 is further used to: in response to the first hash value and the second hash value being the same, determine 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, determine the first verification result is that the file to be verified has been tampered with.
[0060] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0061] Figure 5 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment 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 processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0062] like Figure 5 As shown, the 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 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0063] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0064] The computing unit 801 may be a variety of general and / or special processing components 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 dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as a file signature method based on an anti-counterfeiting image and / or a file verification method based on an anti-counterfeiting image. For example, in some embodiments, a file signature method based on an anti-counterfeiting image and / or a file verification method based on an anti-counterfeiting image may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the above-described 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 may be executed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute 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 in any other appropriate manner (e.g., by means of firmware).
[0065] Various implementations of the systems and techniques described above herein 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), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including 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.
[0066] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0067] 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, device, or equipment. 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, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0068] 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).
[0069] The systems and techniques described herein may 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 may 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.
[0070] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0071] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0072] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0073] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope 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; The anti-counterfeiting image is embedded in the document to be signed.
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. The method according to claim 1, characterized in that: Also 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; The encrypted timestamp is embedded in the anti-counterfeiting image.
4. The method according to any one of claims 1 to 3, characterized in that: The step of embedding the anti-counterfeiting image into the document to be signed comprises: Determine an embedding strategy for the anti-counterfeiting image based on the file type and confidentiality level of the file to be signed, 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; Based on the embedding strategy, the anti-counterfeiting image is embedded into the document to be signed.
5. 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; 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; The first Hash value and the second Hash value are compared to obtain a first verification result.
6. The method according to claim 5, characterized in that The step of determining the encrypted hash value and the 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 the encryption key.
7. The method according to claim 5, characterized in that Also includes: Based on the anti-counterfeiting image in the document to be verified, determining an encryption timestamp corresponding to the anti-counterfeiting image; 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.
8. The method according to any one of claims 5 to 7, 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.
9. A document signature device based on 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, used for encrypting the hash value based on a symmetric encryption key to obtain an encrypted hash value; The encryption module is further used 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; The embedding module is used to embed the anti-counterfeiting image into the document to be signed.
10. A document verification device based on anti-counterfeiting images, characterized in that: The device comprises: An acquisition module is used to obtain the file to be verified; A determination module, used to determine an encrypted hash value and an encryption key based on the anti-counterfeiting image in the document to be verified; A decryption module, used 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, used for performing hash processing on the file to be verified with the anti-counterfeiting image removed to obtain a second hash value; The verification module is used to compare the first Hash value and the second Hash value to obtain a first 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
Method for offline authenticity testing of a virtual document
EP3319006A1
Cited By
Digital asset right confirmation method based on electronic file verification and electronic equipment
CN121217355A