Digital Signature Electronic Seal Generation Method Based on Blockchain Storage
By storing and managing electronic seals on the blockchain and combining digital signature technology, the problem of difficulty in achieving anti-counterfeiting functions in the existing technology is solved, and the safety and effectiveness of electronic seals are achieved, while satisfying the habits and experiences of physical documents and seals.
Patent Information
- Application Number
- CN202411983064.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2044-12-31
AI Technical Summary
It is difficult for existing electronic seal technology to realize the anti-counterfeiting function of electronic seals while meeting physical documents and seal habits.
A digital signature electronic seal generation method based on blockchain storage is adopted, and user identification, electronic seal and data seal are stored through the management nodes and multiple blocks of the blockchain, and electronic seals are generated through digital signatures and seal surface images.
It realizes the anti-counterfeiting function of electronic seals, and at the same time meets the habits and experiences of physical documents and seals, ensuring the safety and effectiveness of electronic seals.
Smart Images

Figure CN119903557B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of seals, and particularly to a method for generating a digital signature electronic seal based on blockchain storage. Background Art
[0002] Electronic seal technology uses advanced digital technology to simulate traditional physical seals. Its management and usage methods conform to the habits and experiences of physical seals. The electronic documents stamped with it have the same appearance, the same validity, and similar usage methods as the paper documents stamped with physical seals.
[0003] For example, when conducting product exhibitions and displays, by presenting electronic documents stamped with electronic seals, the presented electronic documents conform to the habits and experiences of physical documents and seals. Summary of the Invention
[0004] To solve one of the above technical defects, this application provides a method for generating a digital signature electronic seal based on blockchain storage.
[0005] This application provides a method for generating a digital signature electronic seal based on blockchain storage. The blockchain includes a management node and multiple blocks;
[0006] Among them, each block corresponds to a user; any block stores the user identification of the corresponding user through a head node, and stores the electronic seal and data seal of the corresponding user through a linked list connected to the head node; the electronic seal contains the digital signature of the corresponding user, and the digital signature is generated according to the seal surface image of the corresponding user; the data seal is generated according to the electronic seal.
[0007] The linked list of any block corresponds one-to-one to the seal surface image of the corresponding user; the first node of any linked list of any block stores the corresponding seal surface image and the identification of the seal surface image, the second node stores the electronic seal generated by the corresponding seal surface image, and the other nodes correspond one-to-one to the electronic data; any other node of any linked list of any block stores a data seal and an electronic data identification, and the data seal is generated according to the electronic seal stored in the second node of any linked list of any block and the corresponding electronic data, and the electronic data identification is the identification of the electronic data for generating the data seal.
[0008] The method includes:
[0009] Obtain the first user identification, the first seal surface image, and the identification of the first seal surface image of the first user; among them, the seal surface image is a digital image;
[0010] Send the first user identification to the management node so that the management node determines whether there is a first block in the blockchain and feedbacks the first block determination result; among them, the head node of the first block stores the first user identification;
[0011] If the determination result of the first block is that the first block does not exist, generate a first electronic seal according to the first seal face image, and send the first seal face image, the identifier of the first seal face image, and the first electronic seal to the management node, so that the management node adds a new block in the blockchain. This block includes a head node and a linked list connected to the head node. The first user identifier is stored in the head node. The linked list includes two nodes. The first node stores the first seal face image and the identifier of the first seal face image, and the second node stores the first electronic seal;
[0012] If the determination result of the first block is that the first block exists, send the identifier of the first seal face image to the management node, so that the management node determines whether there is a first linked list in the first block in the blockchain and feedbacks the determination result of the first linked list; wherein, the first node of the first linked list stores the identifier of the first seal face image;
[0013] If the determination result of the first linked list is that the first linked list does not exist, generate a first electronic seal according to the first seal face image, and send the first seal face image, the identifier of the first seal face image, and the first electronic seal to the management node, so that the management node adds a new linked list in the first block. This linked list is connected to the head node of the first block and includes two nodes. The first node stores the first seal face image and the identifier of the first seal face image, and the second node stores the first electronic seal;
[0014] Among them, generating the first electronic seal according to the first seal face image includes:
[0015] Determine the attribute values of each pixel point in the first seal face image;
[0016] Determine the first digest according to the first user identifier and the attribute values of each pixel point;
[0017] Concatenate the hash value of the preset minimum value and the public key of the device executing the method as the first key;
[0018] Encrypt the first digest with the first key to obtain the first digital signature;
[0019] Generate the first electronic seal according to the first digital signature and the first seal face image.
[0020] The present application provides a method for generating a digital signature electronic seal based on blockchain storage. The blockchain includes a management node and multiple blocks. Among them, each block stores user identification through a head node and stores electronic seals and data seals through a linked list. The method includes: obtaining user identification and a seal face image. If there is no block storing the user identification in the blockchain, or if there is a block storing the user identification but the linked list of the block does not store the electronic seal generated from the seal face image, determine the attribute values of each pixel point in the user identification and the seal face image to obtain a digital signature, generate an electronic seal based on the digital signature and the seal face image, and enable the management node to store the electronic seal in the blockchain. The method of the present application realizes the anti-counterfeiting of electronic seals through blockchain storage and digital signatures while meeting the habits and experiences of physical documents and seals. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0022] Figure 1 is a schematic structural diagram of a blockchain provided by an embodiment of the present application;
[0023] Figure 2 is another schematic structural diagram of a blockchain provided by an embodiment of the present application;
[0024] Figure 3 is a schematic structural diagram of a block provided by an embodiment of the present application;
[0025] Figure 4 is another schematic structural diagram of a block provided by an embodiment of the present application;
[0026] Figure 5 is a schematic structural diagram of a linked list provided by an embodiment of the present application;
[0027] Figure 6 is a schematic diagram of data storage of a blockchain provided by an embodiment of the present application;
[0028] Figure 7 is a schematic flowchart of a method for generating a digital signature electronic seal based on blockchain storage provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0029] In order to make the technical solutions and advantages in the embodiments of the present application clearer and more understandable, the exemplary embodiments of the present application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than an exhaustive list of all embodiments. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.
[0030] In the process of implementing the present application, the inventors found that the electronic seal technology simulates traditional physical seals with advanced digital technology. Its management and usage methods conform to the habits and experiences of physical seals. The electronic documents stamped with it have the same appearance, the same validity, and similar usage methods as the paper documents stamped with physical seals. For example, when conducting product exhibitions and displays, by presenting electronic documents stamped with electronic seals, the presented electronic documents conform to the habits and experiences of physical documents and seals.
[0031] In view of the above problems, the embodiments of the present application provide a method for generating a digital signature electronic seal based on blockchain storage. The blockchain includes a management node and multiple blocks; wherein, each block stores a user identifier through a header node and stores an electronic seal and a data seal through a linked list; the method includes: obtaining a user identifier and a seal face image; if there is no block storing the user identifier in the blockchain, or if there is a block storing the user identifier, but the linked list of the block does not store the electronic seal generated from the seal face image, determining the attribute values of each pixel point in the user identifier and the seal face image to obtain a digital signature, generating an electronic seal according to the digital signature and the seal face image, and enabling the management node to store the electronic seal in the blockchain. The method of the present application realizes the anti-counterfeiting of electronic seals through blockchain storage and digital signatures while meeting the habits and experiences of physical documents and seals.
[0032] This embodiment provides a method for generating a digital signature electronic seal based on blockchain storage, and this method is implemented based on blockchain. As Figure 1 shown, the blockchain includes a management node and multiple blocks.
[0033] 1. Management node
[0034] The management node is used to communicate with the device that executes the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment, search for data from the blocks through various smart contracts stored thereon, and feedback the data.
[0035] For example, based on the communication with the device that executes the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment, after obtaining the user identifier, the management node determines whether there is a block storing the user identifier in the blockchain and feedbacks the determination result of the block.
[0036] For another example, after obtaining an electronic seal based on communication between the management node and a device that executes the method for generating a digital signature electronic seal stored on a blockchain provided in this embodiment, the management node stores the electronic seal in the blockchain.
[0037] For another example, after obtaining a data seal based on communication between the management node and a device that executes the method for generating a digital signature electronic seal stored on a blockchain provided in this embodiment, the management node stores the data seal in the blockchain.
[0038] 2. Block
[0039] Wherein, each block corresponds to a user one by one.
[0040] For example, if there are 3 users, the blockchain includes one management node and 3 blocks. As Figure 2 shown, Block 1 corresponds to User 1, Block 2 corresponds to User 2, and Block 3 corresponds to User 3.
[0041] Each block includes a head node and at least one linked list. Any block stores the user identifier of the corresponding user through a head node, and stores the electronic seal and data seal of the corresponding user through the linked list connected to the head node. As Figure 3 shown.
[0042] Wherein, the electronic seal contains the digital signature of the corresponding user, and the digital signature is generated according to the seal face image of the corresponding user. The data seal is generated according to the electronic seal.
[0043] The linked list of any block corresponds to the seal face image of the corresponding user one by one. For example, User 1 has 2 seals, and each seal has a seal impression. Therefore, there will be two seal face images, and each seal face image corresponds to a seal impression. That is to say, the seal face image is a digitalized seal impression. Then, Block 1 corresponding to User 1 will have a head node and 2 linked lists. Linked List 1 corresponds to Seal Face Image 1, and Linked List 2 corresponds to Seal Face Image 2. As Figure 4 shown.
[0044] Each linked list includes at least a first node and a second node. In addition, other nodes may also be included. As Figure 5 shown.
[0045] The first node of any linked list of any block stores the corresponding seal face image and the identifier of the seal face image, and the second node stores the electronic seal generated from the corresponding seal face image. The other nodes correspond to electronic data one by one.
[0046] Any other node of any linked list of any block stores a data seal and an electronic data identifier, and the data seal is generated according to the electronic seal stored in the second node of any linked list of any block and the corresponding electronic data. The electronic data identifier is the identifier of the electronic data for generating the data seal.
[0047] The storage content of the head node and each block in the blockchain is as Figure 6 shown. The head node stores the user identification of the user corresponding to the block. The first node of the linked list stores the corresponding seal surface image and the identification of the seal surface image. The secondary node stores the electronic seal generated from the corresponding seal surface image. Other nodes store the data seal and the electronic data identification.
[0048] Based on the above blockchain structure, the implementation process of the digital signature electronic seal generation method based on blockchain storage provided in this embodiment is as Figure 7 shown.
[0049] 701. Obtain the first user identification, the first seal surface image, and the identification of the first seal surface image of the first user.
[0050] Among them, the seal surface image is a digital image. This image is the digital image of the trace left after the seal is fully and completely impressed through a medium (such as printing ink, gum pigment, etc.) or directly on paper, fabric, mud, and similar carriers (such as sealing wax), which is opposite to the shape of the engraved surface of the direct-view seal, that is, the seal impression.
[0051] After obtaining the first seal surface image, it will query whether there is a seal surface image identical to it among all the processed seal surface images (an existing image comparison method can be used for comparison to determine whether there is a seal surface image identical to it). If not, an identification will be assigned to it as the identification of the first seal surface image, and the first seal surface image and the identification of the first seal surface image will be stored. If there is, the identification of the identical seal surface image will be obtained as the identification of the first seal surface image.
[0052] That is to say, the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment will maintain a correspondence between the seal surface image and its identification, and store all the obtained seal surface images and their identifications.
[0053] Each seal surface image corresponds to a unique seal impression and at the same time corresponds to a unique identification of the seal surface image.
[0054] 702. Send the first user identification to the management node so that the management node determines whether the first block exists in the blockchain and feedbacks the first block determination result.
[0055] Among them, the head node of the first block stores the first user identification.
[0056] Since the user identifier of the user corresponding to each block is stored in the head node of the block, it is possible to determine whether there is relevant information corresponding to the user in the blockchain by checking whether there is a block with the user identifier. If the user has ever generated an electronic seal through the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment, there will definitely be a corresponding block in the blockchain.
[0057] For example, the implementation process of step 702 is as follows:
[0058] 702-1. The device that executes the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment sends the first user identifier to the management node.
[0059] 702-2. After receiving the first user identifier, the management node determines whether there is a first block in the blockchain through a smart contract.
[0060] For example, in a specific implementation, each block in the blockchain maintains a ledger of the correspondence between blocks and user identifiers. This ledger stores the correspondence between all blocks in the blockchain and the user identifiers of the users corresponding to them. The management node uses the smart contract to enable each block to search its maintained ledger of the correspondence between blocks and user identifiers to determine whether there is a block corresponding to the first user identifier. If the blocks feedback the same block corresponding to the first user identifier, it is determined that the first block determination result is that there is a first block, and this first block is the same block. If not all blocks feedback the same block corresponding to the first user identifier, the first block determination result is that there is no first block.
[0061] 702-3. The management node feeds back the first block determination result to the device that executes the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment.
[0062] 703. If the first block determination result is that there is no first block, generate a first electronic seal according to the first seal face image, and send the first seal face image, the identifier of the first seal face image, and the first electronic seal to the management node, so that the management node adds a new block in the blockchain. This block includes a head node and a linked list connected to the head node. The head node stores the first user identifier, and the linked list includes two nodes. The first node stores the first seal face image and the identifier of the first seal face image, and the second node stores the first electronic seal.
[0063] If the first block determination result is that there is no first block, it means that the first user is the first user to generate an electronic seal through the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment. Therefore, a block corresponding to the first user will be added to the blockchain through step 703. The specific implementation process of step 703 is as follows:
[0064] 703-1, the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment generates a first electronic seal according to the first seal face image.
[0065] Among them, the process of generating the first electronic seal according to the first seal face image is as follows:
[0066] 801, determine the attribute values of each pixel point in the first seal face image.
[0067] Among them, the attribute values include valid values and object values.
[0068] The implementation details of step 801 are as follows:
[0069] 801-1, identify each object in the first seal face image and determine the type of each object.
[0070] Among them, the types are text, numbers, and others.
[0071] Each object and the type of the object in the first seal face image can be identified by existing image recognition methods.
[0072] The object here is the valid content in the seal impression. For example, if the seal is a seal with the name XY, then the valid content in the seal impression is XY, and the valid content here is also the content of a special color (such as red content, or blue content, etc.), while the invalid content is white or transparent color. Then X is an object in the seal face image, and Y is an object in the seal face image.
[0073] Because the seal face image is a seal impression, therefore, each object can be identified by color. For example, identify the object composed of pixels of a special color (such as red), and then identify the type of the object through existing object recognition methods, such as numbers, text, or others that are neither numbers nor text.
[0074] 801-2, determine the valid values of each pixel point in the first seal face image.
[0075] Among them, if any pixel point is a pixel point of the valid content of the first seal face image, the valid value of any pixel point is 1. If any pixel point is not a pixel point of the valid content of the first seal face image, the valid value of any pixel point is 0.
[0076] The valid value indicates whether the pixel is a pixel that constitutes an object. For any pixel i, if the color of pixel i is a special color (such as red), then pixel i is determined to be a pixel of the valid content of the first seal face image, and the valid value of pixel i is 1. If the color of pixel i is not a special color (such as white or transparent), then pixel i is determined not to be a pixel of the valid content of the first seal face image, and the valid value of pixel i is 0.
[0077] 801-3, determine the object values of the pixels in the first seal face image.
[0078] Among them, if any pixel is a pixel of the text type object in the first seal face image, the object value of any pixel is 2. If any pixel is a pixel of the digital type object in the first seal face image, the object value of any pixel is 1. If any pixel is a pixel of other type objects in the first seal face image, the object value of any pixel is 0.
[0079] The object value indicates the type of the object constituted by the pixel. For any pixel i, if pixel i is a pixel in the text, then pixel i is determined to be a pixel of the text type object in the first seal face image, and the object value of pixel i is 2. If pixel i is a pixel in the number, then pixel i is determined to be a pixel of the digital type object in the first seal face image, and the object value of pixel i is 1. If pixel i is not a pixel in the number or text, then pixel i is determined to be a pixel of other type objects in the first seal face image, and the object value of pixel i is 0.
[0080] Since non-numeric and non-text can be pixels of valid content (such as pixels of flowers, etc.) or pixels of non-valid content (such as pixels of the background), therefore, pixels with an object value of 0 may be pixels of valid content or pixels of non-valid content, and their valid values can be 0 or 1. Pixels with an object value of 1 and pixels with an object value of 2 must be pixels of valid content, and their valid values must be 1.
[0081] 802, determine the first digest according to the first user identifier and the attribute values of each pixel.
[0082] Since the attribute value of each pixel includes a valid value and an object value, therefore, in step 802, the first digest will be determined according to the first user identifier and the attribute values (including valid values and object values) of the pixels in the first seal face image. The process is as follows:
[0083] 802-1, determine the first registration time of the first user according to the first user identifier.
[0084] 802-2, starting from the right side of the first registration time, obtain the first digit at the rightmost position, the second digit at the second rightmost position, and the third digit at the third rightmost position.
[0085] For example, if the registration time is December 31, 2024, it can be formatted as 20241231. Then obtain the first digit at the rightmost position (i.e., 1), the second digit at the second rightmost position (i.e., 3), and the third digit at the third rightmost position (i.e., 2).
[0086] 802-3, determine the first character at the first digit position to the left of the hash value of the first user identifier, determine the second character at the second digit position to the left of the hash value of the first user identifier, and determine the third character at the third digit position to the left of the hash value of the first user identifier.
[0087] If the hash value of the first user identifier is ABCDE, then the first character at the first digit position to the left of ABCDE (i.e., A) (i.e., the character at the 1st position from A in ABCDE is B), the second character at the second digit position to the left of ABCDE (i.e., A) (i.e., the character at the 3rd position from A in ABCDE is D), and the third character at the third digit position to the left of ABCDE (i.e., A) (i.e., the character at the 2nd position from A in ABCDE is C). Therefore, the first character is B, the second character is D, and the third character is C.
[0088] 802-4, determine the first selection value as the decimal ASCII code value of the first character, determine the second selection value as the decimal ASCII code value of the second character, and determine the third selection value as the decimal ASCII code value of the third character.
[0089] For example, determine the first selection value as the decimal ASCII code value of the first character (i.e., B) (i.e., 66), determine the second selection value as the decimal ASCII code value of the second character (i.e., D) (i.e., 68), and determine the third selection value as the decimal ASCII code value of the third character (i.e., C) (i.e., 67).
[0090] 802-5, determine the signature value of each pixel point as the product of the effective value and the object value of each pixel point.
[0091] For example, the signature value of any pixel point i is the effective value of pixel point i × the object value of pixel point i.
[0092] Since there are two effective values for any pixel point, which are 1 or 0 respectively, and three object values, which are 3, 2 or 1 respectively, there are four possible products of the effective value and the object value, which are 3, 2, 1 or 0 respectively.
[0093] Among them, the signature value of the pixel points in the effective content area is 3, or 2, or 1, and the signature value of the pixel points in the non-effective area is 0.
[0094] 802 - 6. Determine the signature value of each pixel point as the first digest.
[0095] If the seal surface image is an image of 1920×1080, then it has 1920 columns of pixels and 1080 rows of pixels. The pixel point in the upper left corner of the seal surface image can be labeled as 1, and the pixel points in the first row are sequentially labeled from left to right to obtain pixel points labeled from 2 to 1920. Then, starting from the left side of the second row, label them sequentially from right to left to obtain pixel points labeled from 1921 to 3840. Then, starting from the left side of the third row, label the pixel points in the order of from left to right and from top to bottom until the pixel point in the lower right corner of the seal surface image, and thus label the pixel points of the seal surface image.
[0096] Arrange the signature values of each pixel point in ascending order of the label. The arranged signature value sequence is the first digest.
[0097] 803. Concatenate the hash value of the preset minimum value with the public key of the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment to form the first key.
[0098] Among them, the public key can be requested by the first user (or the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment) from the CA (Certificate Authority).
[0099] 804. Encrypt the first digest with the first key to obtain the first digital signature.
[0100] 805. Generate the first electronic seal according to the first digital signature and the first seal surface image.
[0101] Among them, the electronic seal includes image content and digital signature content. The implementation process of step 805 is as follows:
[0102] 805 - 1. Determine the signature value of each pixel point in the first seal surface image according to the first digest.
[0103] Among them, the signature value of any pixel point is determined according to the attribute value of any pixel point, and the determination process is as shown in step 801.
[0104] Since the first digest determined in step 802 - 6 is the sequence of signature values of each pixel point arranged in ascending order of the label, the signature value of each pixel point can be obtained through the label.
[0105] 805-2, form a first set of pixel points with all the pixel points in the first target row of the first seal face image having a signature value of 2, form a second set of pixel points with all the pixel points in the second target row of the first seal face image having a signature value of 1, and form a third set of pixel points with all the pixel points in the third target row of the first seal face image having a signature value of 0.
[0106] Among them, the elements in any set of pixel points are arranged in ascending order of pixel point numbers. The pixel points start from the upper left corner of the first seal face image and are numbered in sequence row by row from left to right and column by column from top to bottom. The first target row is the row in the first seal face image that is a multiple of the first selection value, the second target row is the row in the first seal face image that is a multiple of the second selection value, and the third target row is the row in the first seal face image that is a multiple of the third selection value.
[0107] For example, if the seal face image is an image of 1920×1080, which has 1920 columns of pixel points and 1080 rows of pixel points, and in step 802-4, the first selection value is determined to be 66, the second selection value is 68, and the third selection value is 67. Then, the first target row is the row in the first seal face image that is a multiple of 66 (i.e., row 66, 132, 198,..., 1056), the second target row is the row in the first seal face image that is a multiple of 68 (i.e., row 68, 136, 204,..., 1020), and the third target row is the row in the first seal face image that is a multiple of 67 (i.e., row 67, 134, 201,..., 1072).
[0108] In step 805-2, form a first set of pixel points with all the pixel points in row 66, 132, 198,..., 1056 of the first seal face image having a signature value of 2. Form a second set of pixel points with all the pixel points in row 68, 136, 204,..., 1020 of the first seal face image having a signature value of 1. Form a third set of pixel points with all the pixel points in row 67, 134, 201,..., 1072 of the first seal face image having a signature value of 0.
[0109] Among them, the elements in the first set of pixel points, the second set of pixel points, and the third set of pixel points are all arranged in ascending order of pixel point numbers. In this way, each element in the first set of pixel points, the second set of pixel points, and the third set of pixel points has two numbers, one is the identifier of the element in the set of pixel points, and this number is numbered in sequence by all the elements in the set of pixel points, and the other is the pixel point number corresponding to the element in the first seal face image, and this number is determined in step 802-5.
[0110] 805-3, determine the pixel points corresponding to the elements in the first pixel point set whose element identifiers are multiples of the first selection value, the elements in the second pixel point set whose element identifiers are multiples of the second selection value, and the elements in the third pixel point set whose element identifiers are multiples of the third selection value in the first seal face image as the first target pixel points.
[0111] For example, determine the elements (i.e., the 66th element, the 132nd element, the 198th element, … in the first pixel point set) in the first pixel point set whose element identifiers (i.e., the identifiers of the elements in the pixel point set) are multiples of the first selection value (i.e., 66, 132, 198, …), determine the elements (i.e., the 68th element, the 136th element, the 204th element, … in the second pixel point set) in the second pixel point set whose element identifiers (i.e., the identifiers of the elements in the pixel point set) are multiples of the second selection value (i.e., 68, 136, 204, …), and determine the elements (i.e., the 68th element, the 134th element, the 201st element, … in the third pixel point set) in the third pixel point set whose element identifiers (i.e., the identifiers of the elements in the pixel point set) are multiples of the third selection value (i.e., 67, 134, 201, …).
[0112] Determine the pixel points corresponding to the 66th element, the 132nd element, the 198th element, … in the first pixel point set in the first seal face image, the pixel points corresponding to the 68th element, the 136th element, the 204th element, … in the second pixel point set in the first seal face image, and the pixel points corresponding to the 68th element, the 134th element, the 201st element, … in the third pixel point set in the first seal face image as the first target pixel points.
[0113] 805-4, update the pixel value of the first target pixel points with pixel value 0 to a preset minimum value, and update the pixel value of the first target pixel points with non-0 pixel values to the pixel value minus 1 to form the first image.
[0114] The first image is different from the first seal face image only in the pixel values of the first target pixel points, and the pixel values of other pixel points remain unchanged.
[0115] Among them, the pixel value is the color value of the pixel point. For example, if the effective content of the first seal face image is special color content (such as red content), then the pixel value is the value of the red channel of the pixel point. If the value of the red channel of any first target pixel point is 0 (i.e., the any first target pixel point is a pixel point of invalid content), then update the value of its red channel to a preset minimum value. If the value of the red channel of any first target pixel point is non-0 (i.e., the any first target pixel point is a pixel point of valid content), then update the value of its red channel to the current value - 1.
[0116] In addition, since the seal surface image is an impression of the seal, it is impossible to ensure that the colors of all valid contents are the same during the process of leaving an impression (for example, uneven distribution of the stamp pad ink will cause deviation in the red color of the valid contents). Therefore, the values of the red channels of the pixel points of each valid content in the seal surface image are not exactly the same (such as the values of the red channels of the pixel points of all valid contents are 255), but will be different (such as the values of the red channels of the pixel points of some valid contents are 255, some are 254, and some are 250, etc.). In step 805-4, after updating the first target pixel points with non-zero red channel values to the current value -1, this update is not easily noticeable due to the differences in the red channel values of the seal surface image itself.
[0117] 805-5. Determine the first image as the image content of the first electronic seal, and determine the first digital signature as the digital signature content of the first electronic seal.
[0118] Since in step 805-4, the update of the pixel values of the first target pixel points with non-zero red channel values is not easily noticeable due to the differences in the red channel values of the seal surface image itself. Therefore, if the first electronic seal is stolen, the thief can only obtain some changed pixel points through the minimum value of the image content of the first electronic seal (i.e., the first image), and cannot obtain all the changed pixel points. However, the pixel points of the minimum value are background pixel points, and the valid content cannot be restored after obtaining these pixel points. Therefore, the image content of the first electronic seal itself has the function of preventing theft. At the same time, the first digital signature also plays a signature role to further protect the security of the electronic seal.
[0119] 703-2. The device that executes the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment sends the first seal surface image, the identifier of the first seal surface image, and the first electronic seal to the management node.
[0120] 703-3. After receiving the first seal surface image, the identifier of the first seal surface image, and the first electronic seal, the management node adds a new block in the blockchain.
[0121] Among them, the newly added block includes a head node and a linked list connected to the head node. The head node stores the first user identifier. The linked list includes two nodes. The first node stores the first seal surface image and the identifier of the first seal surface image, and the second node stores the first electronic seal.
[0122] That is, after the management node receives the first seal surface image, the identifier of the first seal surface image, and the first electronic seal, a new block is added after the last block of the blockchain through a smart contract. The newly added block includes a head node (the first user identifier is stored in the head node) and a linked list connected to the head node (the linked list includes two nodes, where the first node stores the first seal surface image and the identifier of the first seal surface image, and the second node stores the first electronic seal).
[0123] 704. If the first block determination result is that the first block exists, the identifier of the first seal surface image is sent to the management node, so that the management node determines whether there is a first linked list in the first block in the blockchain and feeds back the first linked list determination result.
[0124] Among them, the first node of the first linked list stores the identifier of the first seal surface image.
[0125] If the first block determination result is that the first block exists, it means that the first user has generated an electronic seal through the digital signature electronic seal generation method based on blockchain storage provided in this embodiment. Then 1) the device executing the digital signature electronic seal generation method based on blockchain storage provided in this embodiment sends the identifier of the first seal surface image to the management node. 2) After obtaining the identifier of the first seal surface image, the management node determines through the smart contract whether there is a linked list (i.e., the first linked list) in the first block whose first node stores the identifier of the first seal surface image. 3) If the first block includes the first linked list, the management node feeds back to the device executing the digital signature electronic seal generation method based on blockchain storage provided in this embodiment that the first linked list exists. If the first block does not include the first linked list, the management node feeds back to the device executing the digital signature electronic seal generation method based on blockchain storage provided in this embodiment that the first linked list does not exist.
[0126] 705. If the first linked list determination result is that the first linked list exists, it means that the first user has generated the corresponding electronic seal through the digital signature electronic seal generation method based on blockchain storage provided in this embodiment. Therefore, at this time, no new generation is performed and the electronic seal generation process ends. If the first linked list determination result is that the first linked list does not exist, the first electronic seal is generated according to the first seal surface image, and the first seal surface image, the identifier of the first seal surface image, and the first electronic seal are sent to the management node, so that the management node adds a linked list to the first block. The linked list is connected to the head node of the first block and includes two nodes, where the first node stores the first seal surface image and the identifier of the first seal surface image, and the second node stores the first electronic seal.
[0127] If the result determined by the first linked list is that the first linked list does not exist, it means that although the first user has generated an electronic seal using the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment, the electronic seal corresponding to the non-first seal surface image generated by the user needs to generate the electronic seal corresponding to the first seal surface image through the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment. The generation process is as follows:
[0128] 901. The device that executes the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment generates a first electronic seal according to the first seal surface image.
[0129] In this step, the process of generating the first electronic seal according to the first seal surface image is the same as the process in step 703-1, that is, it is implemented through steps 801 to 805. For details, please refer to steps 801 to 805, and will not be described in detail here.
[0130] 902. The device that executes the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment sends the first seal surface image, the identifier of the first seal surface image, and the first electronic seal to the management node.
[0131] 903. The management node adds a new linked list in the first block. The linked list is connected to the head node of the first block, and the linked list includes two nodes. The first node stores the first seal surface image and the identifier of the first seal surface image, and the second node stores the first electronic seal.
[0132] That is, after the management node receives the first seal surface image, the identifier of the first seal surface image, and the first electronic seal, since it exists in the block corresponding to the first user (i.e., the first block), it will not create a new block, but create a new linked list under the first block to store the first electronic seal. That is, the management node adds a new linked list in the first block through a smart contract. The linked list is connected to the head node of the first block. The newly added linked list includes two nodes. The first node stores the first seal surface image and the identifier of the first seal surface image, and the second node stores the first electronic seal.
[0133] The above steps 701 to 705 achieve the generation of the electronic seal. Whenever there is a new user, or a user has a new seal, the corresponding electronic seal can be generated through steps 701 to 705, and the generated electronic seal is stored in the blockchain, realizing the digitization of the seal and also realizing the anti-counterfeiting function of the seal.
[0134] After the electronic seal is generated, in order to further protect the security of the electronic seal stamping, the electronic seal will be fine-tuned according to the different electronic data stamped with the electronic seal, so that it can be determined whether the electronic data stamped with the fine-tuned electronic seal is a legal stamping.
[0135] For example, when an electronic seal is to be affixed to a piece of electronic data (such as an electronic product certification certificate), after the approver confirms permission to affix the seal, first determine the seal face image of the electronic seal to be affixed, then fine-tune the electronic seal corresponding to the seal face image of the electronic seal to be affixed to the electronic data to obtain a data seal corresponding to the electronic data, and save the data seal to the blockchain. After the approver's approval, the stamper reads the corresponding data seal from the blockchain for affixing.
[0136] The process of generating a data seal after approval is introduced below, and this process is implemented through steps 1001 to 1005.
[0137] 1001. Obtain the first electronic data identifier of the first electronic data and the identifier of the second seal face image.
[0138] Among them, the first electronic data is the electronic data to be approved that needs to be affixed with an electronic seal.
[0139] All seal face images that the approver is determined to be authorized to use can be displayed to the approver (the authorized seal face images can include the electronic seals generated by the approver, and can also include the electronic seals generated by other users. The authorized seal face images can be set by relevant personnel when the approver registers). When the approver selects a seal face image, the device implementing the digital signature electronic seal generation method based on blockchain storage provided in this embodiment obtains the identifier of the second seal face image according to the corresponding relationship between the seal face image it maintains and its identifier.
[0140] 1002. Determine the second user identifier of the user to whom the second seal face image belongs.
[0141] For example, since the approver will know the information of the seals they are authorized to use, when the approver selects the second seal face image, they will input the identifier of the owner of the second seal face image, and this step is to obtain the identifier of the owner of the second seal face image input by the approver, that is, the second user identifier.
[0142] 1003. Send the second user identifier, the first electronic data identifier, and the identifier of the second seal face image to the management node, so that when the management node determines that there is no first other node in the blockchain, it feeds back the second electronic seal. The first other node is other nodes in the second linked list, and the first other node stores the first electronic data identifier. The second linked list is connected to the head node of the second block. The first node of the second linked list stores the identifier of the second seal face image, and the second node of the second linked list stores the second electronic seal. The head node of the second block stores the second user identifier.
[0143] In step 1003, it can be implemented through the following steps:
[0144] 1003 - 1. The device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment sends the second user identifier, the first electronic data identifier, and the identifier of the second seal face image to the management node.
[0145] 1003 - 2. After the management node receives the second user identifier, the first electronic data identifier, and the identifier of the second seal face image, when it determines that there is no first other node in the blockchain, it feeds back the second electronic seal to the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment.
[0146] Wherein, the first other node is another node in the second linked list, and the first electronic data identifier is stored in the first other node. The second linked list is connected to the head node of the second block. The first node of the second linked list stores the identifier of the second seal face image, and the second node of the second linked list stores the second electronic seal. The head node of the second block stores the second user identifier.
[0147] Specifically, the specific implementation process of the management node in step 1003 - 2 is as follows:
[0148] 1. The management node determines whether there is a block (i.e., the second block) whose head node stores the second user identifier.
[0149] Wherein, the determination process of the second block is similar to the determination process of the first block in step 702. Refer to step 702 for details and it will not be introduced in detail here.
[0150] 2. If there is no second block, it is determined that the user identifier provided by the reviewer is incorrect, either an error occurred during the provision by the reviewer or the reviewer does not know the user identifier (such as the reviewer has no right to review or the reviewer's identity has been stolen, etc.). In this case, for security reasons, the review process of the reviewer will be prohibited. The management node feeds back the relevant information of "data seal generation failed" to the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment and exits the data seal generation process.
[0151] 3. If there is a second block, the management node performs the following steps:
[0152] 1) Determine whether there is a linked list (i.e., the second linked list) in all the linked lists of the second block whose first node stores the identifier of the second seal face image.
[0153] Wherein, the determination process of the second linked list is similar to the determination process of the first linked list in step 704. Refer to step 704 for details and it will not be introduced in detail here.
[0154] 2) If there is no second linked list, the electronic seal corresponding to the second seal surface image is not stored in the blockchain. In this case, for security reasons, the review process of this reviewer will be prohibited, and relevant information of "data seal generation failed" will be fed back to the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment, and the data seal generation process will be exited.
[0155] 3) If there is a second linked list, determine whether the first electronic data identifier is stored in other nodes of the second linked list. If a certain other node (such as the first other node) of the second linked list stores the first electronic data identifier, it means that the seal request of this electronic data has been approved and the approval is passed, so there is no need to repeat the approval, and the data seal generation process is terminated. If all other nodes of the second linked list do not store the first electronic data identifier (that is, there is no first other node in the blockchain), it means that this electronic data has not been approved, then obtain the second electronic seal stored in the secondary node of the second linked list, and feed back the second electronic seal to the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment.
[0156] 1004. The device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment generates a first data seal according to the first electronic data and the fed-back second electronic seal.
[0157] Since the electronic seal includes image content and digital signature content, therefore, step 1004 can be implemented through the following steps:
[0158] 1004-1. Determine the first storage time of the first electronic data according to the first electronic data identifier.
[0159] 1004-2. Form a fourth selection value with the rightmost two digits in the first storage time.
[0160] For example, if the first storage time of the first electronic data is September 21, 2022, its format can be changed to 20220921, then obtain the rightmost two digits (that is, 21) to form the fourth selection value (that is, the fourth selection value is 21).
[0161] 1004-3. Determine the second digest of the first electronic data.
[0162] This step uses the existing digest generation method to obtain the second digest of the first electronic data. For example, by operating on the first electronic data through a hash algorithm (SHA), a fixed-length string is obtained, and this string is the second digest.
[0163] 1004-4. Encrypt the second digest and the digital signature content of the second electronic seal with the first key to obtain a second digital signature.
[0164] Among them, the first key is the key obtained in step 803, that is, the key obtained by concatenating the hash value of the preset minimum value with the public key of the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment.
[0165] 1004-5. Generate a first data seal according to the second digital signature, the fourth selection value, and the image content of the second electronic seal.
[0166] Among them, the data seal includes image content and digital signature content.
[0167] The generation process of step 1004-5 is as follows:
[0168] 1. Extract the second image from the image content of the second electronic seal.
[0169] That is, extract the image content of the second electronic seal, and this image content is the second image.
[0170] 2. Determine the pixel point in the middle position of the fourth target row in the second image as the second target pixel point.
[0171] Among them, the fourth target row is the row in the second image whose row number is a multiple of the fourth selection value.
[0172] For example, the second image is an image of 1920×1080, which has 1920 columns of pixel points and 1080 rows of pixel points. In step 1004-2, the fourth selection value is determined to be 21, then the fourth target row is the row in the second image whose row number is a multiple of 21 (i.e., the 21st row, 42nd row, 63rd row,..., 1071st row). The pixel point in the middle column of each fourth target row (i.e., the pixel point in the 960th column, that is, the 960th pixel point counted from the left in each fourth target row) is the second target pixel point.
[0173] 3. Update the pixel value of the second target pixel point with a pixel value of 0 to the preset minimum value, and update the pixel value of the second target pixel point with a non-0 pixel value to the pixel value minus 1 to form a third image.
[0174] The third image is only different from the second image in the pixel value of the second target pixel point, and the pixel values of other pixel points remain unchanged.
[0175] Among them, the pixel value is the color value of the pixel point. For example, if the effective content of the second image is special color content (such as red content), then the pixel value is the value of the red channel of the pixel point. If the value of the red channel of any second target pixel point is 0, then update the value of its red channel to the preset minimum value. If the value of the red channel of any second target pixel point is non-0 (i.e., this any first target pixel point is a pixel point of effective content), then update the value of its red channel to the current value - 1.
[0176] It should be noted that since the second image is obtained from the corresponding seal surface image, therefore, the value of the red channel of any second target pixel point being 0 may be that the pixel value of the pixel point with this label in the seal surface image is 0, or it may be that the pixel value of the pixel point with this label in the seal surface image is 1, and it becomes 0 after being updated to the current value -1 when obtaining the second image from the seal surface image. The value of the red channel of any second target pixel point being non-zero may be that the pixel value of the pixel point with this label in the seal surface image is non-zero, or it may be that the pixel value of the pixel point with this label in the seal surface image becomes non-zero after being updated to the current value -1 when obtaining the second image from the seal surface image.
[0177] 4. Determine the third image as the image content of the first data seal, and determine the second digital signature as the digital signature content of the first data seal.
[0178] Due to the update of the pixel values of the first target pixel points with non-zero red channel values in the above step 3, it is not easily noticeable due to the differences in the red channel values of the seal surface image itself. Therefore, if the first data seal is stolen, the thief can only obtain some changed pixel points through the minimum value of the image content (i.e., the third image) of the first data seal, and cannot obtain all the changed pixel points, and cannot restore the valid content. Therefore, the image content of the first data seal itself has an anti-theft function. At the same time, the second digital signature also plays a signature role to further protect the security of the data seal.
[0179] 1005. The device implementing the method for generating a digital signature electronic seal based on blockchain storage provided in this embodiment sends the first data seal to the management node.
[0180] 1006. The management node adds a node at the end of the second linked list, and stores the second data seal and the first electronic data identifier in this node.
[0181] The above steps 1001 to 1006 are the data seal generation process, which realizes the generation of digital seals. Whenever a digital seal needs to be generated for an electronic data, the corresponding digital seal will first be generated through steps 1001 to 1006, and the generated digital seal will be stored in the blockchain. Since each data seal is obtained based on an electronic seal and electronic data, even if the same electronic seal is used, different data seals will be obtained due to different electronic data, realizing the uniqueness of the data seal. Therefore, the above steps 1001 to 1006 realize the digitization of the seal while also realizing the approval and anti-counterfeiting functions of seal use.
[0182] After the digital seal is generated, the process of stamping the data seal on the electronic data can be carried out. Next, the process of reading the corresponding data seal from the blockchain for stamping is introduced:
[0183] 1101. Obtain the second electronic data to be sealed with a seal and the identifier of the third seal face image to be sealed.
[0184] Among them, the second electronic data is the electronic data that needs to be sealed with an electronic seal.
[0185] The third seal face image is the seal face image of the electronic seal that needs to be sealed on the second electronic data.
[0186] All seal face images that the seal affixing person has the right to use can be determined (the seal face images that the seal affixing person has the right to use can include the electronic seals generated by him, and can also include the electronic seals generated by other users. The seal face images that the seal affixing person has the right to use can be set by relevant personnel when the seal affixing person registers). Display all seal face images that the seal affixing person has the right to use to the seal affixing person. When the seal affixing person selects a seal face image, the device implementing the digital signature electronic seal generation method based on blockchain storage provided in this embodiment obtains the identifier of the third seal face image according to the corresponding relationship between the seal face image it maintains and its identifier.
[0187] 1102. Determine the second electronic data identifier of the second electronic data.
[0188] 1103. Determine the third user identifier of the user to whom the third seal face image belongs.
[0189] For example, since the seal affixing person will know the information of the seal he needs to affix, when the seal affixing person selects the third seal face image, he will input the identifier of the owner of the third seal face image. This step is to obtain the identifier of the owner of the third seal face image input by the seal affixing person, that is, the third user identifier.
[0190] 1104. Send the third user identifier, the second electronic data identifier, and the identifier of the third seal face image to the management node, so that the management node determines and feedbacks the second data seal in the blockchain.
[0191] Among them, the second data seal is stored in the second other node in the third linked list, and this second other node also stores the second electronic data identifier. The head node of the third linked list stores the identifier of the third seal face image. The head node connected to the third linked list stores the third user identifier.
[0192] In step 1104, it can be implemented through the following steps:
[0193] 1104-1. The device implementing the digital signature electronic seal generation method based on blockchain storage provided in this embodiment sends the third user identifier, the second electronic data identifier, and the identifier of the third seal face image to the management node.
[0194] 1104-2, after the management node receives the third user identifier, the second electronic data identifier and the identifier of the third seal surface image, when determining the second data seal in the blockchain, it feeds back the second data seal to the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment.
[0195] The second data seal is stored in the second other node in the third linked list, and the second other node also stores the second electronic data identifier. The first node of the third linked list stores the identifier of the third seal face image. The head node connected to the third linked list stores the third user identifier.
[0196] Specifically, in step 1104-2, the management node implements the following process:
[0197] 1. The management node determines whether there is a block (ie, the third block) in which the head node stores the third user identifier.
[0198] The process of determining the third block is similar to the process of determining the first block in step 702, and reference is made to step 702, which will not be described in detail here.
[0199] 2. If the third block does not exist, it is determined that the user ID provided by the reviewer is wrong. Either an error occurred in the process of providing the seal by the seal stamping person, or the seal stamping person does not know the user ID (such as the seal stamping person has no right to stamp the electronic seal, or the seal stamping person has been stolen, etc.). At this time, for safety reasons, the electronic seal stamping process of the seal stamping person will be prohibited, and the management node will feedback relevant information of "data seal acquisition failure" to the device executing the digital signature electronic seal generation method based on blockchain storage provided in this embodiment, and exit the electronic seal stamping process.
[0200] 3. If the third block exists, the management node executes the following steps:
[0201] 1) Determine whether there is a first node storing the identifier of the third seal face image in all the linked lists of the third block (ie, the third linked list).
[0202] The process of determining the third linked list is similar to the process of determining the first linked list in step 704, and reference is made to step 704, which will not be described in detail here.
[0203] 2) If the third linked list does not exist, the electronic seal corresponding to the third seal face image is not stored in the blockchain. At this time, for security reasons, the electronic seal stamping process of the person who stamps the seal will be prohibited, and the relevant information of "data seal acquisition failure" will be fed back to the device executing the digital signature electronic seal generation method based on blockchain storage provided in this embodiment, and the electronic seal stamping process will be exited.
[0204] 3) If there is a third linked list, determine whether other nodes of the third linked list store the second electronic data identifier. If a certain other node of the third linked list (such as the second other node) stores the second electronic data identifier, it indicates that the seal request of this electronic data has been approved and the approval is passed. At this time, the second data seal stored in the second other node of the third linked list can be obtained, and the second data seal is fed back to the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment. If all other nodes of the second linked list do not store the second electronic data identifier (that is, there is no second other node in the blockchain), it indicates that this electronic data has not been approved or has not passed the approval. At this time, for security reasons, the electronic seal stamping process of the seal stamping personnel will be prohibited, and relevant information of "data seal acquisition failed" is fed back to the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment, and the electronic seal stamping process is exited.
[0205] 1105, determine the third seal corresponding to the third seal face image according to the second data seal.
[0206] Since the data seal includes image content and digital signature content, and the digital signature content of the data seal is composed of a digest and the digital signature content of the electronic seal that generates this data seal. Therefore, the implementation process of step 1105 is as follows:
[0207] 1105-1, splice the hash value of the preset minimum value with the public key of the device that executes the method to obtain the second key.
[0208] The key obtained by splicing the hash value of the preset minimum value with the public key of the device that executes the digital signature electronic seal generation method based on blockchain storage provided in this embodiment.
[0209] 1105-2, decrypt the digital signature content of the second data seal through the second key to obtain the third digest and the digital signature content of the third electronic seal.
[0210] Among them, the second data seal is generated according to the third electronic seal.
[0211] 1105-3, if the third digest is the same as the digest of the second electronic data, it indicates that the data seal is incorrect. For security reasons, the electronic seal stamping process of the seal stamping personnel will be prohibited, and the electronic seal stamping process is exited. If the third digest is the same as the digest of the second electronic data, determine the third seal according to the digital signature content of the third electronic seal and the image content of the second data seal.
[0212] Since the digital signature of the electronic seal is obtained according to the signature values of each pixel point in the seal face image, the implementation process of step 1105-3 is as follows:
[0213] 1. Determine the second storage time of the second electronic data.
[0214] 2. Form a fifth selection value from the rightmost two digits in the second storage time.
[0215] This step is similar to step 1004-2. Refer to step 1004-2 for implementation.
[0216] 3. Extract the fourth image from the image content of the second data seal.
[0217] 4. Determine the third target pixel point as the pixel point in the middle of the fifth target row in the fourth image.
[0218] Among them, the fifth target row is the row whose row number in the fourth image is a multiple of the fifth selection value.
[0219] This step is similar to step 2 in step 1004-5. Refer to step 2 in step 1004-5 for implementation.
[0220] 5. Update the pixel value of the third target pixel point with a preset minimum value to 0, and update the pixel value of the third target pixel point with a non-preset minimum value to the pixel value plus 1 to form a fifth image.
[0221] This step is the reverse process of step 3 in step 1004-5. In step 3 of step 1004-5, the target pixel point with a pixel value of 0 is updated to a preset minimum value, and the target pixel point with a non-zero pixel value is updated to the pixel value - 1. Therefore, in this step, if the third target pixel point is a preset minimum value, if the third target pixel point is not a preset minimum value, so update it to the pixel value + 1 to achieve restoration. The restored fifth image is the image part of the corresponding electronic seal.
[0222] 6. Determine the second registration time of the third user according to the third user identifier.
[0223] 7. Starting from the right side of the second registration time, obtain the fourth digit in the rightmost position, the fifth digit in the second rightmost position, and the sixth digit in the third rightmost position.
[0224] This step is similar to step 802-2. Refer to step 802-2 for implementation.
[0225] 8. Determine the fourth character at the fourth digit position to the left of the hash value of the third user identifier, determine the fifth character at the fifth digit position to the left of the hash value of the third user identifier, and determine the sixth character at the sixth digit position to the left of the hash value of the third user identifier.
[0226] This step is similar to step 802-3. Refer to step 802-3 for implementation.
[0227] 9. Determine that the sixth selection value is the decimal ASCII code value of the fourth character, determine that the seventh selection value is the decimal ASCII code value of the fifth character, and determine that the eighth selection value is the decimal ASCII code value of the sixth character.
[0228] This step is similar to step 802-4. Refer to step 802-4 for implementation.
[0229] 10. Decrypt the digital signature content of the third electronic seal with the second key to obtain the signature value of each pixel point.
[0230] 11. According to the signature value of each pixel point, form a fourth pixel point set with all pixel points whose signature value is 2 in the sixth target row of the fifth image, form a fifth pixel point set with all pixel points whose signature value is 1 in the seventh target row of the fifth image, and form a sixth pixel point set with all pixel points whose signature value is 0 in the eighth target row of the fifth image. Among them, the elements in any pixel point set are arranged in ascending order according to the pixel point label. The pixel points start from the upper left corner of the fifth image and are numbered in sequence row by row from left to right and column by column from top to bottom. The sixth target row is the row in the fifth image whose row number is a multiple of the sixth selection value, the seventh target row is the row in the fifth image whose row number is a multiple of the seventh selection value, and the eighth target row is the row in the fifth image whose row number is a multiple of the eighth selection value.
[0231] This step is similar to step 805-2. Refer to step 805-2 for implementation.
[0232] 12. Determine that the pixel points corresponding to the elements in the fourth pixel point set whose element identifiers are multiples of the sixth selection value, the elements in the fifth pixel point set whose element identifiers are multiples of the seventh selection value, and the elements in the sixth pixel point set whose element identifiers are multiples of the eighth selection value in the fifth image are all fourth target pixel points.
[0233] This step is similar to step 805-3. Refer to step 805-3 for implementation.
[0234] 13. Update the pixel value of the fourth target pixel point with the pixel value being the preset minimum value to 0, and update the pixel value of the fourth target pixel point with the pixel value not being the preset minimum value to the pixel value plus 1 to form the third seal.
[0235] This step is the reverse process of step 805-4. In step 805-4, the target pixel point with the pixel value of 0 is updated to the preset minimum value, and the target pixel point with the pixel value not being 0 is updated to the pixel value - 1. Therefore, in this step, if the fourth target pixel point is the preset minimum value, if the fourth target pixel point is not the preset minimum value, so update it to the pixel value + 1 to achieve restoration. The restored fifth image is the seal surface image of the image part for generating the corresponding electronic seal, that is, the third seal.
[0236] 1106. Stamp the third seal on the second electronic data.
[0237] For example, add the data of the third seal to the second electronic data to form the second electronic data with a seal.
[0238] In addition, the smart contracts that perform different functions can be the same or different, and the content of the smart contract is not limited in this embodiment.
[0239] The above steps 1101 to 1106 are the electronic seal stamping process, which realizes the process of stamping on electronic data. Whenever it is necessary to stamp an electronic data, the stamping will be first carried out through steps 1101 to 1106. Since the seal obtained is from the blockchain, and the non-modifiable nature of the blockchain ensures the accuracy of the obtained seal. In addition, what is obtained from the blockchain is not the seal itself, but the data seal based on the seal. The generation process of the data seal ensures the legality of this stamping behavior, and the digital signature of the data seal ensures the authenticity of this stamping behavior. And there is no interaction of any other data during the process of restoring the data seal to the electronic seal and then restoring the electronic seal to the seal face image. Only the device that generates the data seal will obtain the real relevant data. This restoration reduces the security risk of the seal face image restoration process caused by other data interactions, and further ensures the security of the seal face image.
[0240] This embodiment provides a method for generating a digital signature electronic seal based on blockchain storage. The blockchain includes a management node and multiple blocks; wherein, each block stores the user identification through a head node and stores the electronic seal and the data seal through a linked list; the method includes: obtaining the user identification and the seal face image; if there is no block storing the user identification in the blockchain, or if there is a block storing the user identification, but the linked list of the block does not store the electronic seal generated from the seal face image, obtaining a digital signature according to the determined attribute values of each pixel point in the user identification and the seal face image, generating an electronic seal according to the digital signature and the seal face image, and enabling the management node to store the electronic seal in the blockchain. The method of this embodiment realizes the anti-counterfeiting of the electronic seal through blockchain storage and digital signature while satisfying the habits and experiences of physical documents and seals.
[0241] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code. The solutions in the embodiments of the present application can be implemented in various computer languages. For example, object-oriented programming languages such as Java and interpreted scripting languages such as JavaScript, etc.
[0242] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0243] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implements the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0244] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0245] Furthermore, the terms "first", "second", etc. are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first", "second", etc. may explicitly or implicitly include one or more of such features. In the description of the present application, "a plurality of" means at least two, such as two, three, etc., unless otherwise specifically defined.
[0246] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications falling within the scope of the present application.
[0247] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.
Claims
1. A method for generating a digital signature electronic seal based on blockchain storage, characterized in that: The blockchain includes a management node and multiple blocks; Among them, blocks correspond to users one by one; any block stores the user identification of the corresponding user through a head node, and stores the electronic seal and data seal of the corresponding user through a linked list connected to the head node; the electronic seal contains the digital signature of the corresponding user, and the digital signature is generated according to the seal surface image of the corresponding user; the data seal is generated according to the electronic seal; The linked list of any block corresponds to the seal face image of the corresponding user one by one; the first node of any linked list of any block stores the corresponding seal face image and the identifier of the seal face image, the secondary node stores the electronic seal generated by the corresponding seal face image, and the other nodes correspond to the electronic data one by one; any other node of any linked list of any block stores a data seal and an electronic data identifier, and the data seal is generated according to the electronic seal stored in the secondary node of any linked list of any block and the corresponding electronic data, and the electronic data identifier is the identifier of the electronic data generating the data seal; The method comprises: Acquire a first user identification of a first user, a first seal surface image, and an identification of the first seal surface image; wherein the seal surface image is a digitized image; Sending the first user identifier to the management node, so that the management node determines whether the first block exists in the blockchain, and feeds back a determination result of the first block; wherein the head node of the first block stores the first user identifier; If the first block determination result is that the first block does not exist, a first electronic seal is generated according to the first seal face image, and the first seal face image, the identifier of the first seal face image, and the first electronic seal are sent to the management node, so that the management node adds a new block in the blockchain, the block includes a head node and a linked list connected to the head node, the head node stores the first user identifier, and the linked list includes two nodes, wherein the first node stores the first seal face image and the identifier of the first seal face image, and the secondary node stores the first electronic seal; If the first block determination result is that the first block exists, sending the identifier of the first seal surface image to the management node, so that the management node determines whether the first linked list exists in the first block in the blockchain, and feeds back the first linked list determination result; wherein the first node of the first linked list stores the identifier of the first seal surface image; If the first linked list determination result is that the first linked list does not exist, a first electronic seal is generated according to the first seal face image, and the first seal face image, the identifier of the first seal face image and the first electronic seal are sent to the management node, so that the management node adds a linked list in the first block, the linked list is connected to the head node of the first block, and the linked list includes two nodes, wherein the first node stores the first seal face image and the identifier of the first seal face image, and the second node stores the first electronic seal; The step of generating a first electronic seal according to the first seal surface image includes: Determining the attribute value of each pixel in the first seal surface image; Determine a first summary according to the first user identifier and the attribute value of each pixel; Concatenate a hash value of a preset minimum value and a public key of a device executing the method into a first key; Encrypt the first summary using the first key to obtain a first digital signature; A first electronic seal is generated according to the first digital signature and the first seal surface image.
2. The method according to claim 1, characterized in that The attribute value includes a valid value and an object value; The determining the attribute value of each pixel in the first seal surface image includes: Identify each object in the first seal surface image and determine the type of each object; the type is text, number, or other; Determine the effective value of each pixel in the first seal surface image; wherein, if any pixel is a pixel of effective content of the first seal surface image, the effective value of any pixel is 1, and if any pixel is not a pixel of effective content of the first seal surface image, the effective value of any pixel is 0; Determine the object value of each pixel point in the first seal surface image; wherein, if any pixel point is a pixel point of a text type object in the first seal surface image, the object value of any pixel point is 2; if any pixel point is a pixel point of a digital type object in the first seal surface image, the object value of any pixel point is 1; if any pixel point is a pixel point of other types of objects in the first seal surface image, the object value of any pixel point is 0.
3. The method according to claim 1, characterized in that The attribute value includes a valid value and an object value; The determining a first summary according to the first user identifier and the attribute value of each pixel point includes: Determining a first registration time of the first user according to the first user identifier; Starting from the right side of the first registration time, obtain the first digit of the rightmost position, the second digit of the second rightmost position, and the third digit of the third rightmost position; Determine a first character that is a first digit away from the left side of the hash value of the first user identifier, determine a second character that is a second digit away from the left side of the hash value of the first user identifier, and determine a third character that is a third digit away from the left side of the hash value of the first user identifier; Determine the first selected value as the decimal ASCII code value of the first character, determine the second selected value as the decimal ASCII code value of the second character, and determine the third selected value as the decimal ASCII code value of the third character; Determine that the signature value of each pixel is the product of the effective value of each pixel and the object value; The signature value of each pixel is determined as the first summary.
4. The method according to claim 1, characterized in that: The electronic seal includes image content and digital signature content; Generating a first electronic seal according to the first digital signature and the first seal surface image includes: Determine the signature value of each pixel in the first seal surface image according to the first summary; wherein the signature value of any pixel is determined according to the attribute value of any pixel; All pixel points with a signature value of 2 in a first target row in the first seal surface image form a first pixel point set, all pixel points with a signature value of 1 in a second target row in the first seal surface image form a second pixel point set, and all pixel points with a signature value of 0 in a third target row in the first seal surface image form a third pixel point set; wherein, the elements in any pixel point set are arranged from small to large according to the pixel point number; the pixels are numbered in order from left to right in each row and from top to bottom, starting from the upper left corner of the first seal surface image; the first target row is the row whose number of rows in the first seal surface image is a multiple of the first selected value, the second target row is the row whose number of rows in the first seal surface image is a multiple of the second selected value, and the third target row is the row whose number of rows in the first seal surface image is a multiple of the third selected value; Determine the pixel points corresponding to the elements in the first pixel point set identified as multiples of the first selected value, the elements in the second pixel point set identified as multiples of the second selected value, and the elements in the third pixel point set identified as multiples of the third selected value in the first seal surface image as first target pixel points; The pixel value of the first target pixel point whose pixel value is 0 is updated to the preset minimum value, and the pixel value of the first target pixel point whose pixel value is not 0 is updated to the pixel value minus 1, so as to form a first image; The first image is determined as the image content of the first electronic seal, and the first digital signature is determined as the digital signature content of the first electronic seal.
5. The method according to claim 1, characterized in that: The method further comprises: Obtaining a first electronic data identifier of the first electronic data and an identifier of the second seal surface image; Determining a second user identifier of a user to which the second seal face image belongs; The second user identifier, the first electronic data identifier, and the identifier of the second seal face image are sent to the management node, so that when the management node determines that the first other node does not exist in the blockchain, the second electronic seal is fed back; wherein the first other node is another node in the second linked list, and the first other node stores the first electronic data identifier; the second linked list is connected to the head node of the second block, the first node of the second linked list stores the identifier of the second seal face image, and the secondary node of the second linked list stores the second electronic seal; the head node of the second block stores the second user identifier; Generate a first data seal according to the first electronic data and the fed-back second electronic seal; The first data seal is sent to the management node, so that the management node adds a node at the end of the second linked list, and stores the second data seal and the first electronic data identifier in the node.
6. The method according to claim 5, characterized in that The electronic seal includes image content and digital signature content; The step of generating a first data seal according to the first electronic data and the fed-back second electronic seal includes: determining a first storage time of the first electronic data according to the first electronic data identifier; The rightmost two bits in the first storage time form a fourth selected value; determining a second digest of the first electronic data; Encrypt the second summary and the digital signature content of the second electronic seal by using the first key to obtain a second digital signature; A first data seal is generated according to the second digital signature, the fourth selected value and the image content of the second electronic seal.
7. The method according to claim 6, characterized in that The data seal includes image content and digital signature content; Generating a first data seal according to the second digital signature, the fourth selected value and the image content of the second electronic seal comprises: extracting a second image from the image content of the second electronic seal; Determine a pixel point at a middle position in a fourth target row in the second image as a second target pixel point; wherein the fourth target row is a row in the second image whose number of rows is a multiple of a fourth selected value; The pixel value of the second target pixel point whose pixel value is 0 is updated to a preset minimum value, and the pixel value of the second target pixel point whose pixel value is not 0 is updated to the pixel value minus 1, so as to form a third image; The third image is determined as the image content of the first data seal, and the second digital signature is determined as the digital signature content of the first data seal.
8. The method according to claim 1, characterized in that The method further comprises: Acquire the second electronic data to be stamped and the identification of the third seal surface image to be stamped; Determining a second electronic data identifier of the second electronic data; Determine a third user identifier of the user to which the third seal face image belongs; Sending the third user identifier, the second electronic data identifier and the identifier of the third seal face image to the management node, so that the management node determines and feeds back the second data seal in the blockchain; wherein the second data seal is stored in the second other node in the third linked list, and the second other node also stores the second electronic data identifier; the first node of the third linked list stores the identifier of the third seal face image; the head node connected to the third linked list stores the third user identifier; determining a third seal corresponding to the third seal face image according to the second data seal; A third seal is stamped in the second electronic data.
9. The method according to claim 8, characterized in that The data seal includes image content and digital signature content, and the digital signature content of the data seal is composed of a summary and the digital signature content of the electronic seal that generates the data seal; The step of determining the third seal corresponding to the third seal surface image according to the second data seal comprises: Concatenate the hash value of the preset minimum value with the public key of the device executing the method to obtain a second key; Decrypting the digital signature content of the second data seal by using the second key to obtain the third summary and the digital signature content of the third electronic seal; wherein the second data seal is generated according to the third electronic seal; If the third summary is the same as the summary of the second electronic data, the third seal is determined according to the digital signature content of the third electronic seal and the image content of the second data seal.
10. The method according to claim 9, characterized in that The digital signature of the electronic seal is obtained according to the signature value of each pixel in the seal surface image; Determining the third seal according to the digital signature content of the third electronic seal and the image content of the second data seal includes: determining a second storage time of the second electronic data; The rightmost two bits in the second storage time form a fifth selection value; extracting a fourth image from the image content of the second data seal; Determine the pixel point at the middle position in the fifth target row in the fourth image as the third target pixel point; wherein the fifth target row is a row in the fourth image whose number of rows is a multiple of the fifth selection value; The pixel value of the third target pixel point whose pixel value is the preset minimum value is updated to 0, and the pixel value of the third target pixel point whose pixel value is not the preset minimum value is updated to the pixel value plus 1, so as to form a fifth image; Determining a second registration time of the third user according to the third user identifier; Starting from the right side of the second registration time, obtain the fourth digit at the rightmost position, the fifth digit at the second rightmost position, and the sixth digit at the third rightmost position; Determine the fourth character at the fourth digit to the left of the hash value of the third user identifier, determine the fifth character at the fifth digit to the left of the hash value of the third user identifier, and determine the sixth character at the sixth digit to the left of the hash value of the third user identifier; Determine the sixth selected value as the decimal ASCII code value of the fourth character, determine the seventh selected value as the decimal ASCII code value of the fifth character, and determine the eighth selected value as the decimal ASCII code value of the sixth character; The digital signature content of the third electronic seal is decrypted by the second key to obtain the signature value of each pixel; According to the signature value of each pixel point, all the pixel points with a signature value of 2 in the sixth target row of the fifth image form a fourth pixel point set, all the pixel points with a signature value of 1 in the seventh target row of the fifth image form a fifth pixel point set, and all the pixel points with a signature value of 0 in the eighth target row of the fifth image form a sixth pixel point set; wherein, the elements in any pixel point set are arranged from small to large according to the pixel point number; the pixels are numbered in sequence from left to right in each row and from top to bottom, starting from the upper left corner of the fifth image; the sixth target row is the row in the fifth image whose number of rows is a multiple of the sixth selection value, the seventh target row is the row in the fifth image whose number of rows is a multiple of the seventh selection value, and the eighth target row is the row in the fifth image whose number of rows is a multiple of the eighth selection value; Determine the pixel points corresponding to the elements in the fourth pixel point set identified as multiples of the sixth selected value, the elements in the fifth pixel point set identified as multiples of the seventh selected value, and the elements in the sixth pixel point set identified as multiples of the eighth selected value in the fifth image as fourth target pixel points; The pixel value of the fourth target pixel point whose pixel value is the preset minimum value is updated to 0, and the pixel value of the fourth target pixel point whose pixel value is not the preset minimum value is updated to the pixel value plus 1, so as to form a third seal.
Citation Information
Patent Citations
Seal registration method, verification method and anti-counterfeiting system based on block chain
CN111490870A
Digital seal using method and device based on block chain
CN114331437A