An anti-quantum signature method and device, electronic equipment and storage medium
By constructing a tree-shaped key structure using a true random number generator and the XOF algorithm, and determining the LMS signature nodes layer by layer, the problem of insufficient top-level security and high bottom-level computational overhead of the traditional LMS algorithm in quantum computer attacks is solved, thus realizing efficient and low-cost quantum-resistant signatures.
Patent Information
- Application Number
- CN202511349221.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-09-22
AI Technical Summary
Traditional LMS signature algorithms suffer from insufficient top-level security and excessive low-level computational overhead when resisting quantum computer attacks. Furthermore, their high key generation speed and storage costs make them unsuitable for resource-constrained devices.
A true random number generator is used to generate random numbers, and the XOF algorithm is used to process them to generate a one-time private key. The leaf nodes of the tree key structure are constructed, and the upper-level nodes are determined layer by layer. The XOF algorithm is used for non-root nodes, and the SHA3-512 algorithm is used for root nodes to generate LMS signatures.
It significantly reduces the number of hash iterations and storage overhead, improves signature generation speed, is suitable for resource-constrained devices, and ensures quantum-resistant security.
Smart Images

Figure CN120856309B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a quantum-resistant signature method, apparatus, electronic device, and storage medium. Background Technology
[0002] The Leighton-Micali Signature (LMS) algorithm is a hash-based post-quantum signature scheme with significant applications in encryption resistant to quantum computer attacks. Traditional LMS signature algorithms primarily rely on balanced binary trees for signing. The LMS public key is generated from the root node of the balanced binary tree, and each leaf node represents a hash value of a one-time signature (OTS) public key used for signature verification.
[0003] However, traditional LMS signature algorithms have the following drawbacks: Firstly, they use a fixed hash function (such as SHA-256) for each level of the balanced binary tree. However, the security requirements of different levels differ significantly. The top-level node (i.e., the root key) requires the highest security strength to resist quantum collision attacks; the bottom-level nodes (i.e., leaf keys) need to respond quickly and adapt to resource-constrained devices. Using a uniform Secure Hash Algorithm (SHA-256) leads to insufficient security at the top level and excessive computational overhead at the bottom level. Secondly, in traditional LMS schemes, the generation of the private key and the OTS public key requires 2... h (h is the number of levels in the balanced binary tree) hash operations, generating intermediate nodes requires 2... h -1 hash operation, therefore, the entire signature key generation requires 3×2 h -1 hash operation, many operations, large overall computational overhead and slow response. In addition, the required key storage space is also large. On resource-constrained devices, the signature generation speed and storage cost of traditional LMS schemes are bottlenecks. Summary of the Invention
[0004] This application provides a quantum-resistant signature method, apparatus, electronic device, and storage medium to at least solve the above-mentioned technical problems existing in the prior art.
[0005] According to a first aspect of this application, a quantum-resistant signature method is provided, comprising: generating random numbers based on a true random number generator; processing the random numbers based on the XOF algorithm to obtain multiple one-time private keys; processing the one-time private keys based on the XOF algorithm to obtain multiple leaf nodes of a tree-like key structure; determining upper-level nodes layer by layer based on the lower-level nodes of the tree-like key structure, starting from the layer where the leaf nodes are located, to obtain the tree-like key structure; determining the non-root nodes of the tree-like key structure based on the XOF algorithm, and determining the root node of the tree-like key structure based on the SHA3-512 algorithm; and generating an LMS signature of the information to be signed based on the tree-like key structure.
[0006] In one embodiment, processing the random number based on the XOF algorithm to obtain multiple one-time private keys includes: hashing the random number based on the XOF algorithm to obtain a first output digest; the length of the first output digest is... bit; divide the first output digest into A one-time private key of length n; where n is the output digest length of the XOF algorithm, and h is the number of layers in the tree-structured key structure.
[0007] In one embodiment, processing the one-time private key based on the XOF algorithm to obtain multiple leaf nodes of the tree-shaped key structure includes: concatenating all the one-time private keys to obtain concatenated private key data; hashing the concatenated private key data based on the XOF algorithm to obtain a second output digest; and segmenting the second output digest to obtain multiple leaf nodes; the number of leaf nodes is the same as the number of one-time private keys.
[0008] In one embodiment, the step of determining upper-level nodes layer by layer based on the lower-level nodes of the tree key structure, starting from the layer where the leaf node is located, to obtain the tree key structure includes: starting from the layer where the leaf node is located, concatenating four adjacent lower-level nodes layer by layer to obtain node combination data; in response to an upper-level node being a non-root node, hashing the node combination data based on the XOF algorithm to obtain multiple third output digests; splitting the third output digests to obtain multiple upper-level nodes; the length of the third output digest is 2n bits, and the length of the upper-level node is n bits; in response to an upper-level node being a root node, hashing the node combination data based on the SHA3-512 algorithm to obtain a fourth output digest; and determining the fourth output digest as the root node.
[0009] In one embodiment, generating an LMS signature for the information to be signed based on the tree-structured key structure includes: hashing the information to be signed using the XOF algorithm to obtain a fifth output digest; processing the target private key and the fifth output digest using the XOF algorithm to obtain an initial signature; the target private key is an unused one-time private key; determining the hash values of all sibling nodes of the target private key from the leaf node to the root node based on the index value of the target private key; and combining the initial signature, the index value, and the hash values of the sibling nodes to obtain the LMS signature.
[0010] In one embodiment, the step of processing the target private key and the fifth output digest based on the XOF algorithm to obtain the initial signature includes: concatenating the target private key and the fifth output digest to obtain signature input data; and hashing the signature input data based on the XOF algorithm to obtain the initial signature.
[0011] In one embodiment, a quantum-resistant signature method further includes: extracting the corresponding initial target signature, target index value, and target hash value of the sibling node from the LMS signature of the target information; performing hash processing on the target information based on the XOF algorithm to obtain a sixth output digest; determining the reconstructed root node of the tree key structure based on the initial target signature, the sixth output digest, the target index value, and the target hash value of the sibling node; and confirming that the LMS signature verification is successful if the reconstructed root node is the same as the root node of the tree key structure.
[0012] In one possible implementation, determining the reconstructed root node of the tree key structure based on the target initial signature, the sixth output digest, the target index value, and the target hash value of the sibling node includes: determining the target private key for generating the target initial signature based on the target initial signature and the sixth output digest; determining the target leaf node corresponding to the target private key based on the target private key; and determining the reconstructed root node of the tree key structure based on the target leaf node and the target hash value of the sibling node.
[0013] In one possible implementation, the XOF algorithm is either the SHAKE128 algorithm or the SHAKE256 algorithm.
[0014] According to a second aspect of this disclosure, a quantum-resistant signature device is provided, comprising: a random number generation module for generating random numbers based on a true random number generator; a first processing module for processing the random numbers based on the XOF algorithm to obtain multiple one-time private keys; a second processing module for processing the one-time private keys based on the XOF algorithm to obtain multiple leaf nodes of a tree-like key structure; a determination module for determining upper-level nodes layer by layer based on the lower-level nodes of the tree-like key structure, starting from the layer where the leaf nodes are located, to obtain the tree-like key structure; the non-root nodes of the tree-like key structure are determined based on the XOF algorithm, and the root nodes of the tree-like key structure are determined based on the SHA3-512 algorithm; and a signature module for generating an LMS signature of the information to be signed based on the tree-like key structure.
[0015] In one embodiment, the first processing module is further configured to: perform hash processing on the random number based on the XOF algorithm to obtain a first output digest; the length of the first output digest is... bit; divide the first output digest into A one-time private key of length n; where n is the output digest length of the XOF algorithm, and h is the number of layers in the tree-structured key structure.
[0016] In one embodiment, the second processing module is further configured to: concatenate all the one-time private keys to obtain concatenated private key data; perform hash processing on the concatenated private key data based on the XOF algorithm to obtain a second output digest; segment the second output digest to obtain multiple leaf nodes; the number of leaf nodes is the same as the number of one-time private keys.
[0017] In one embodiment, the determining module is further configured to: starting from the layer where the leaf node is located, concatenate the four adjacent lower-level nodes layer by layer to obtain node combination data; in response to an upper-level node being a non-root node, perform hash processing on the node combination data based on the XOF algorithm to obtain multiple third output digests; divide the third output digests to obtain multiple upper-level nodes; the length of the third output digest is 2n bits, and the length of the upper-level node is n bits; in response to an upper-level node being a root node, perform hash processing on the node combination data based on the SHA3-512 algorithm to obtain a fourth output digest; and determine the fourth output digest as the root node.
[0018] In one embodiment, the signature module is further configured to: hash the information to be signed based on the XOF algorithm to obtain a fifth output digest; process the target private key and the fifth output digest based on the XOF algorithm to obtain an initial signature; the target private key is an unused one-time private key; determine the hash values of all sibling nodes of the target private key from the leaf node to the root node based on the index value of the target private key; and combine the initial signature, the index value, and the hash values of the sibling nodes to obtain the LMS signature.
[0019] In one embodiment, the signature module is further configured to: concatenate the target private key and the fifth output digest to obtain signature input data; and perform hash processing on the signature input data based on the XOF algorithm to obtain an initial signature.
[0020] In one embodiment, a quantum-resistant signature device further includes a verification module, configured to: extract the corresponding initial target signature, target index value, and target hash value of the sibling node from the LMS signature of the target information; perform hash processing on the target information based on the XOF algorithm to obtain a sixth output digest; determine the reconstructed root node of the tree key structure based on the initial target signature, the sixth output digest, the target index value, and the target hash value of the sibling node; and confirm that the LMS signature verification is successful if the reconstructed root node is the same as the root node of the tree key structure.
[0021] In one embodiment, the verification module is further configured to: determine the target private key for generating the target initial signature based on the target initial signature and the sixth output digest; determine the target leaf node corresponding to the target private key based on the target private key; and determine the reconstructed root node of the tree key structure based on the target leaf node and the target hash value of the sibling node.
[0022] In one possible implementation, the XOF algorithm is either the SHAKE128 algorithm or the SHAKE256 algorithm.
[0023] According to a third aspect of this application, an electronic device is provided, comprising:
[0024] At least one processor; and
[0025] A memory communicatively connected to the at least one processor; wherein,
[0026] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in this application.
[0027] According to a fourth aspect of this application, a non-transitory computer-readable storage medium is provided storing computer instructions for causing the computer to perform the methods described in this application.
[0028] This application discloses a quantum-resistant signature method, apparatus, electronic device, and storage medium. It generates random numbers using a true random number generator and processes these random numbers using the XOF algorithm to generate multiple one-time private keys. Then, the XOF algorithm is applied again to each one-time private key to generate leaf nodes of a tree-like key structure. These leaf nodes serve as hash values of the one-time signature public keys for signature verification. Starting from the leaf node layer, the tree-like key structure is built upwards layer by layer. Non-root nodes are determined using the XOF algorithm, while the root node is determined using the SHA3-512 algorithm. Finally, an LMS signature is generated based on the tree-like key structure. Thus, by dynamically selecting the hash algorithm and configuring SHA3 variants differently according to the layer depth, using SHA3-512 at the top layer to enhance quantum collision resistance, and using the XOF algorithm at the bottom layer to reduce the number of hash iterations, the signature generation speed is significantly improved. Simultaneously, the scalable output characteristic of the XOF algorithm reduces the storage requirements during key generation and lowers the overall computational overhead. Furthermore, by combining TRNG true random number generation with key sharding technology, the dual goals of improving efficiency and reducing cost are achieved while ensuring quantum-resistant security.
[0029] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0030] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. Several embodiments of this application are illustrated in the drawings by way of example and not limitation, in which:
[0031] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
[0032] Figure 1 This application illustrates a flowchart of a quantum-resistant signature method according to an embodiment of the present application. Figure 1 ;
[0033] Figure 2 This application illustrates a flowchart of a quantum-resistant signature method according to an embodiment of the present application. Figure 2 ;
[0034] Figure 3 This application illustrates a flowchart of a quantum-resistant signature method according to an embodiment of the present application. Figure 3 ;
[0035] Figure 4 This diagram illustrates the structure of the LMS tree-structured key structure in the prior art.
[0036] Figure 5 A schematic diagram of the LMS tree key structure in an embodiment of this application is shown;
[0037] Figure 6 A schematic diagram of a quantum-resistant signature device according to an embodiment of this application is shown;
[0038] Figure 7 A schematic diagram of the composition structure of an electronic device according to an embodiment of this application is shown. Detailed Implementation
[0039] To make the objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0040] Figure 4 This diagram illustrates the structure of the LMS tree key structure in the prior art, such as... Figure 4 As shown, the LMS system is constructed from a balanced binary tree. The public key of the LMS system is the root node of this balanced binary tree, and each leaf node of the balanced binary tree is an OTS public key hash value used for signature verification.
[0041] like Figure 4 As shown, the steps for generating a traditional LMS tree-structured key are as follows:
[0042] 1. Parameter determination. This includes the height h of the Merkle tree (i.e., a tree-structured key structure) and the hash function hash; such as Figure 4 In the Merkle tree, there are 4 levels from the leaf node (level 4) to the root node (level 0), which means the height of the Merkle tree is h=4.
[0043] 2. Generating random numbers by hashing them using a hash function. One-time private keys sk1, sk2, sk3, ..., sk2h, that is, ... Figure 4 In the diagram, S1, S2, S3, ..., S16 represent the length of a one-time private key, which is equal to the digest length of the hash function.
[0044] 3. Generate the OTS public key pki = hash(ski), resulting in pk1, pk2, pk3, ..., pk2h, i.e. Figure 4 The La, Lb, Lc, ..., Lp shown can be used as leaf nodes with the OTS public key. Then, the hash operation is performed on adjacent leaf nodes layer by layer until the root node Root is generated, and the root node is used as the final public key.
[0045] The traditional LMS tree key structure generation method has the following main drawbacks: it uses a fixed hash function (such as SHA-256), which makes it impossible to meet the security requirements of different levels; the generation of private keys and OTS public keys requires multiple hash operations, and the generation of intermediate nodes also requires multiple hash operations, resulting in a large overall computational overhead; it requires a large key storage space, and on resource-constrained devices, such as IoT terminals, the signature generation speed and storage cost of the traditional LMS scheme are bottlenecks.
[0046] Figure 1 This application illustrates a flowchart of a quantum-resistant signature method according to an embodiment of the present application. Figure 1 ,like Figure 1 As shown, a quantum-resistant signature method includes:
[0047] Step S101: Generate random numbers based on a true random number generator.
[0048] In this embodiment, a True Random Number Generator (TRNG) is first used to generate random numbers. A TRNG is a device capable of generating truly random numbers, which are unpredictable and have high entropy. These random numbers will serve as the basis for subsequent key generation. For example, assuming a 1344-bit TRNG is used, it can generate a 1344-bit random number, which will be used as the input for the subsequent XOF algorithm.
[0049] Step S102: Based on the XOF algorithm, the random number is processed to obtain multiple one-time private keys.
[0050] In this embodiment, the Extendable Output Function (XOF) can generate an output digest of arbitrary length based on the input. The XOF algorithm can generate an output digest of a certain length based on random numbers. By splitting the output digest, multiple one-time private keys can be obtained.
[0051] Figure 5 A schematic diagram of the LMS tree key structure in an embodiment of this application is shown, as follows: Figure 5 As shown, the random number is processed by the XOF algorithm to obtain multiple one-time private keys S1, S2, S3, ..., S16.
[0052] Step S103: Based on the XOF algorithm, process the one-time private key to obtain multiple leaf nodes of the tree-shaped key structure.
[0053] In this embodiment, each one-time private key can be processed sequentially based on the XOF algorithm to obtain multiple leaf nodes, i.e., as shown below. Figure 5 The values La, Lb, Lc, ..., Lp are shown in the diagram.
[0054] Step S104: Starting from the layer where the leaf node is located, determine the upper-level node layer by layer based on the lower-level node of the tree key structure to obtain the tree key structure.
[0055] In this embodiment, it is necessary to determine the upper-level nodes layer by layer based on the lower-level nodes of the tree key structure, starting from the layer where the leaf node is located. The non-root nodes of the tree key structure are determined based on the XOF algorithm, and the root nodes of the tree key structure are determined based on the SHA3-512 algorithm.
[0056] like Figure 5 As shown, based on the XOF algorithm, the nodes of the 4th layer are processed to obtain the nodes of the 3rd layer; then based on the XOF algorithm, the nodes of the 3rd layer are processed to obtain the nodes of the 2nd layer; then based on the XOF algorithm, the nodes of the 2nd layer are processed to obtain the nodes of the 1st layer; finally based on the SHA3-512 algorithm, the nodes of the 1st layer are processed to obtain the nodes of the 0th layer (i.e., the root node).
[0057] Step S105: Based on the tree-structured key, generate an LMS signature for the information to be signed.
[0058] In this embodiment, an LMS signature for the information to be signed can be generated based on a pre-constructed tree-structured key. That is, the information to be signed is signed using an unused one-time private key in the pre-constructed tree-structured key, and the LMS signature is generated together with the hash values of all sibling nodes from the leaf node to the root node of the one-time private key and the signature information.
[0059] In this application, random numbers are generated using a true random number generator, and multiple one-time private keys are obtained by processing these random numbers using the XOF algorithm. These one-time private keys are then further processed using the XOF algorithm to obtain the leaf nodes of a tree-structured key structure. The tree-structured key structure is then constructed layer by layer, where non-root nodes are determined using the XOF algorithm, and the root node is determined using the SHA3-512 algorithm. Finally, an LMS signature of the information to be signed is generated based on the tree-structured key structure. This significantly reduces the number of hash iterations and storage overhead while ensuring quantum-resistant security, thus improving signature generation speed, making it particularly suitable for low-computing-power scenarios such as IoT terminals.
[0060] In another embodiment, step S102, "processing random numbers based on the XOF algorithm to obtain multiple one-time private keys," includes:
[0061] Based on the XOF algorithm, a random number is hashed to obtain the first output digest; the length of the first output digest is... bit;
[0062] The first output digest is divided into A one-time private key of length n;
[0063] Where n is the length of the output digest of the XOF algorithm, and h is the number of layers in the tree-structured key structure.
[0064] In this embodiment, the random number is processed by the XOF algorithm to generate a number of lengths. The first output digest is 256 bits. Here, n represents the output digest length of the XOF algorithm, and h represents the number of levels in the tree-structured key structure. For example, assuming the XOF algorithm is SHAKE256, the tree height h is 4, and the output digest length n is 256 bits, then the length of the first output digest is 256 × 10^25 bits. =4096 bits. Then, the first output digest is divided into A one-time private key of length n. For example... Figure 5 As shown, taking h=4 and n=256 as an example, the length of the first output digest is 4096 bits, which is divided into 16 one-time private keys of 256 bits each, namely S1, S2, ..., S16.
[0065] In another embodiment, step S103, "processing the one-time private key based on the XOF algorithm to obtain multiple leaf nodes of a tree-shaped key structure," includes:
[0066] Concatenate all one-time private keys to obtain concatenated private key data;
[0067] Based on the XOF algorithm, the private key concatenated data is hashed to obtain the second output digest;
[0068] The second output digest is split to obtain multiple leaf nodes; the number of leaf nodes is the same as the number of one-time private keys.
[0069] In this embodiment, all one-time private keys are first concatenated to form a single concatenated private key data. Specifically, assume the number of one-time private keys is... If there are n private keys, each with a length of n bits, then the total length of the data concatenated from the private keys is n × 10^2 ... For example, when the tree height h=4 and each private key length n=256 bits, there are 16 one-time private keys. Concatenating these private keys sequentially yields a 4096-bit concatenated private key data. Figure 5 As shown, S1, S2, ..., S16 are concatenated to obtain the private key concatenation data {S1, S2, ..., S16}.
[0070] In this embodiment, the private key concatenation data is processed by the XOF algorithm to generate a data structure of length n× The second output digest is a 4096-bit data structure. For example, assuming the XOF algorithm is SHAKE256 and the private key concatenation data is 4096 bits long, then after processing with the SHAKE256 algorithm, a 4096-bit second output digest is obtained. Finally, the second output digest is divided into multiple leaf nodes. Since the length of the second output digest is n× bits, and the number of private keys at one time is Therefore, the second output summary can be divided into several parts. A leaf node with a length of n bits. For example... Figure 5 As shown, taking h=4 and n=256 as an example, the 4096-bit second output digest is divided into 16 leaf nodes of 256 bits each, namely La, Lb, ..., Lp.
[0071] In this application, all one-time private keys are concatenated to form a concatenated private key data. The XOF algorithm is then used to hash this concatenated private key data to obtain a second output digest. Finally, the second output digest is divided into multiple leaf nodes. This method effectively utilizes the scalable output characteristic of the XOF algorithm to generate the same number of leaf nodes as the one-time private keys, reducing the number of hash operations and improving the efficiency of key generation.
[0072] In another embodiment, step S104, "starting from the layer where the leaf node is located, determining the upper-level node layer by layer based on the lower-level nodes of the tree key structure to obtain the tree key structure," includes:
[0073] Starting from the layer where the leaf node is located, the four adjacent lower-level nodes are concatenated layer by layer to obtain the node combination data;
[0074] In response to the fact that the upper-level node is not the root node, the node combination data is hashed based on the XOF algorithm to obtain multiple third output digests; the third output digests are then split to obtain multiple upper-level nodes; the length of the third output digest is 2n bits, and the length of the upper-level node is n bits.
[0075] In response to the upper-level node being the root node, the node combination data is hashed based on the SHA3-512 algorithm to obtain the fourth output digest; the fourth output digest is then used to determine the root node.
[0076] In this embodiment, starting from the layer containing the leaf node, the four adjacent lower-level nodes are concatenated to form a node combination data. For example, assuming the number of leaf nodes is... If each leaf node has a length of n bits, then in the first layer (leaf node layer), every 4 leaf nodes are concatenated to form a node combination data. Taking h=4 and n=256 as an example, there are 16 leaf nodes in the leaf node layer. Every 4 leaf nodes are concatenated to obtain 4 node combination data, and the length of each node combination data is 4×256=1024 bits.
[0077] If the parent node is not the root node, the XOF algorithm is used to hash the node combination data. After processing by the XOF algorithm, a third output digest of length 2n bits is generated. Then, this third output digest is split into two parent nodes of length n bits each. Taking n=256 as an example, the node combination data, after processing by the XOF algorithm, yields a third output digest of 512 bits, which is then split into two parent nodes of length 256 bits each.
[0078] If the upper-level node is the root node, the SHA3-512 algorithm is used to hash the node combination data. The SHA3-512 algorithm generates a fourth output digest of 512 bits. This fourth output digest will be used to determine the root node. Taking h=4 as an example, when building to the first layer, the four second-layer nodes are concatenated and processed by the SHA3-512 algorithm to obtain a 512-bit fourth output digest, which is then used to determine the root node. The hash value of this root node will be used as the final public key for signature verification.
[0079] like Figure 5 As shown, taking h=4, n=256, and the XOF algorithm SHAKE256 as an example, the four adjacent leaf nodes (public keys) are concatenated to form four sets of data. Each set is processed using SHAKE256 to generate four 512-bit digests. Each 512-bit digest is then divided into two 256-bit nodes, resulting in eight third-level nodes: {Hab, Hcd, ..., Hop}.
[0080] The eight nodes of layer 3 are concatenated in groups of four to form two sets of data. Each set is then processed using SHAKE256 to generate two 512-bit digests. Each 512-bit digest is then split into two 256-bit nodes, resulting in four layer 2 nodes: {Habcd, Hefgh, Hijkl, Hmnop}.
[0081] The four nodes of the second layer are concatenated and processed using SHAKE256 to generate a 512-bit digest. This 512-bit digest is then divided into two 256-bit nodes, resulting in two first-layer nodes: {Habcdefgh, Hijklmnop}.
[0082] The two nodes of the first layer are concatenated and processed using the SHA512 algorithm to generate the final root node ROOT, which is the 0th layer.
[0083] In the key generation structure proposed in this application, the entire key generation process requires... This second hash operation, compared to the traditional scheme... Hash operations significantly improve the speed of key generation. Based on the example above, when the Merkle tree height is 4, the traditional LMS key generation scheme requires 47 hash operations, but the key generation scheme in this application only requires 10.
[0084] In this application, node combination data is formed by concatenating four adjacent lower-level nodes layer by layer, and different hash algorithms are selected for processing according to the type of upper-level nodes. For non-root nodes, the XOF algorithm is used to generate a third output digest and split it into upper-level nodes; for the root node, the SHA3-512 algorithm is used to generate a fourth output digest and determine it as the root node. This effectively reduces the number of hash operations, improves the efficiency of key generation, and enhances the root node's resistance to quantum collisions through the SHA3-512 algorithm, ensuring the security and integrity of the entire tree-shaped key structure.
[0085] Figure 2 This application illustrates a flowchart of a quantum-resistant signature method according to an embodiment of the present application. Figure 2 ,like Figure 2 As shown, step S105, "Generating an LMS signature for the information to be signed based on a tree-structured key," includes:
[0086] Step S201: Based on the XOF algorithm, the information to be signed is hashed to obtain the fifth output digest.
[0087] In this embodiment, the XOF algorithm is first used to hash the information to be signed. After the signature information is processed by the XOF algorithm, a fifth output digest of length n bits is generated. For example, assuming the XOF algorithm is SHAKE256, after the signature information is processed by the SHAKE256 algorithm, a fifth output digest of 256 bits is obtained.
[0088] Step S202: Based on the XOF algorithm, process the target private key and the fifth output digest to obtain the initial signature.
[0089] In this embodiment, an unused one-time private key is selected as the target private key. Then, the XOF algorithm is used to hash the target private key and the fifth output digest to obtain the initial signature.
[0090] Step S203: Based on the index value of the target private key, determine the hash values of all sibling nodes of the target private key from the leaf node to the root node.
[0091] In this embodiment, based on the index value of the target private key, the hash values of all sibling nodes of the target private key from the leaf node to the root node are determined. These sibling node hash values will be used as part of the authentication path to verify the validity of the signature. For example, assuming the index value of the target private key SK_i is i, starting from the leaf node, the hash values of all sibling nodes are determined layer by layer upwards, and the sibling nodes and the current node can jointly generate the parent node.
[0092] like Figure 5 As shown, assuming the target private key is S1, its corresponding leaf node is La, and its path to the root node is: La (level 4), Hab (level 3), Habcd (level 2), Habcdefgh (level 1), ROOT (level 0). Its sibling nodes at level 4 are Lb, Lc, and Ld; its sibling nodes at level 3 are Hef and Hgh; and its sibling nodes at level 2 are Hijkl and Hmnop.
[0093] Step S204: Combine the initial signature, index value, and hash value of the sibling node to obtain the LMS signature.
[0094] In this embodiment, the initial signature, the index value of the target private key, and the hash value of the sibling node are combined to obtain the final LMS signature. This LMS signature will be used to verify the integrity and authenticity of the information to be signed.
[0095] In this application, the XOF algorithm is used to hash the information to be signed, generating a fifth output digest. An initial signature is then generated based on the target private key and the fifth output digest. Simultaneously, the hash values of all sibling nodes from the leaf node to the root node are determined using the index value of the target private key. The initial signature, the index value, and the hash values of the sibling nodes are then combined to form the final LMS signature. Therefore, LMS signatures can be generated efficiently while ensuring quantum resistance, and the authentication path mechanism ensures that the signature verification process is simple and efficient.
[0096] In another embodiment, step S202, "processing the target private key and the fifth output digest based on the XOF algorithm to obtain an initial signature," includes:
[0097] The target private key and the fifth output digest are concatenated to obtain the signature input data;
[0098] Based on the XOF algorithm, the signature input data is hashed to obtain the initial signature.
[0099] In this embodiment, to generate the initial signature, the target private key and the fifth output digest must first be concatenated. Specifically, the target private key is an unused one-time private key, and the fifth output digest is the digest obtained after processing the information to be signed using the XOF algorithm. These two data are concatenated together to form the signature input data. For example, assuming the target private key is SK_i and the fifth output digest is d, then the signature input data is SK_i||d. Next, the signature input data is hashed using the XOF algorithm to generate the initial signature SIG=XOF(SK_i||d).
[0100] Figure 3 This application illustrates a flowchart of a quantum-resistant signature method according to an embodiment of the present application. Figure 3 ,like Figure 3 As shown, a quantum-resistant signature method also includes:
[0101] Step S301: Extract the corresponding target initial signature, target index value, and target hash value of the sibling node from the target information LMS signature.
[0102] In this embodiment, to verify the validity of the LMS signature, it is first necessary to extract the corresponding initial target signature, target index value, and target hash value of the sibling node from the LMS signature of the target information. Specifically, the LMS signature includes the initial signature, index value, and authentication path (i.e., the hash value of the sibling node). For example, the LMS signature is represented as (SIG, i, H_brothers), where SIG is the initial signature, i is the index value, and H_brothers is the hash value of the sibling node.
[0103] Step S302: Based on the XOF algorithm, the target information is hashed to obtain the sixth output digest.
[0104] In this embodiment, the XOF algorithm is used to hash the target information to obtain a sixth output digest. This target information is the original information that needs to be verified, and it is the same as the information to be signed used during signature generation. By processing the target information using the XOF algorithm, a sixth output digest that is the same as the fifth output digest used during signature generation can be obtained. For example, assuming the target information is M, hashing M using an XOF algorithm (such as SHAKE256) yields a 256-bit sixth output digest d'.
[0105] Step S303: Based on the target initial signature, the sixth output digest, the target index value, and the target hash value of the sibling node, determine the reconstructed root node of the tree key structure.
[0106] In this embodiment, a portion of the tree-shaped key structure is reconstructed based on the target initial signature, the sixth output digest, the target index value, and the target hash value of the sibling nodes, up to the root node.
[0107] In step S304, in response to the fact that the reconstructed root node is the same as the root node of the tree key structure, the LMS signature verification is confirmed to be successful.
[0108] In this embodiment, the reconstructed root node is compared with the root node of the tree key structure. If they are the same, the LMS signature verification is confirmed to be successful; otherwise, the signature verification fails. For example, assuming the reconstructed root node is Root' and the root node of the tree key structure is Root, if Root' == Root, the signature verification is successful; otherwise, the verification fails.
[0109] In this application, the target initial signature, target index value, and target hash value of sibling nodes are extracted from the LMS signature. The target information is then hashed using the XOF algorithm to obtain the sixth output digest. Based on this information, the root node of the tree-structured key structure is reconstructed. If the reconstructed root node is identical to the root node of the tree-structured key structure, the signature verification is confirmed to be successful. This method can efficiently verify the validity of LMS signatures while ensuring quantum-resistant security. Furthermore, the authentication path mechanism ensures a simple and efficient verification process.
[0110] In another embodiment, step S303, "determining the reconstructed root node of the tree key structure based on the target initial signature, the sixth output digest, the target index value, and the target hash value of the sibling node," includes:
[0111] Based on the target initial signature and the sixth output digest, determine the target private key for generating the target initial signature;
[0112] Based on the target private key, determine the target leaf node corresponding to the target private key;
[0113] Based on the target hash values of the target leaf node and its sibling nodes, determine the reconstructed root node of the tree key structure.
[0114] In this embodiment, the initial target signature is actually obtained by hashing the target private key and the signature input data concatenated by the fifth output digest using the XOF algorithm. Both the fifth output digest d and the sixth output digest d' are obtained by hashing the information to be signed (the information to be signed is called the target information) using the XOF algorithm. Therefore, the target private key SK_i can be deduced from the initial target signature and the sixth output digest.
[0115] In this embodiment, it is also necessary to determine the leaf node corresponding to the target private key SK_i. That is, using the target private key SK_i, the target leaf node is generated using the same XOF algorithm as when the signature was generated. For example, assuming the target private key is SK_i, the target leaf node L_i is obtained by hashing SK_i using an XOF algorithm (such as SHAKE256).
[0116] In this embodiment, the target private key can also be determined by the target index value i corresponding to the target private key in the tree key structure. If the actual corresponding leaf node is the same as the target leaf node L_i, then the next step can be continued.
[0117] In this embodiment, the root node of the tree key structure can also be reconstructed based on the target leaf node L_i and the target hash values H_brothers of its sibling nodes. The specific steps are as follows:
[0118] Starting from the target leaf node L_i, the tree key structure is reconstructed layer by layer upwards using the target hash values H_brothers of its sibling nodes. During this reconstruction, the same hash algorithm (such as XOF or SHA3-512) used during signature generation is employed for hash calculations until the root node is reached. After reconstruction, the resulting root node is compared with the root node of the tree key structure to verify the signature's validity.
[0119] like Figure 5As shown, assuming the target private key is S1, its corresponding leaf node is La, its sibling nodes at level 4 are Lb, Lc, and Ld, its sibling nodes at level 3 are Hef and Hgh, and its sibling nodes at level 2 are Hijkl and Hmnop. Based on La and its sibling nodes Lb, Lc, and Ld, and the XOF algorithm, we can obtain Hab and Hcd at level 3; based on Hab, Hcd and its sibling nodes Hef and Hgh, and the XOF algorithm, we can obtain Habcd and Hefgh at level 2; based on Habcd, Hefgh and its sibling nodes Hijkl and Hmnop, and the XOF algorithm, we can obtain Habcdefgh and Hijklmnop at level 1; based on Habcdefgh and Hijklmnop at level 1, and the SHA3-512 algorithm, we can obtain the root node ROOT at level 0, which is the root node of the reconstructed tree key structure.
[0120] In this application, the target private key is determined based on the target initial signature and the sixth output digest, and then the leaf node corresponding to the target private key is determined. Finally, the root node of the tree-shaped key structure is reconstructed based on the hash values of the leaf node and its sibling nodes. This ensures the accuracy and efficiency of the signature verification process, and by reconstructing layer by layer, the correctness of each layer of nodes is verified, thereby ensuring the integrity and security of the entire signature verification process.
[0121] In another embodiment, the XOF algorithm is either the SHAKE128 algorithm or the SHAKE256 algorithm.
[0122] In this embodiment, the XOF algorithm can be either the SHAKE128 algorithm or the SHAKE256 algorithm. Both of these algorithms belong to the SHA-3 algorithm family and have good resistance to quantum attacks.
[0123] The choice between the SHAKE128 and SHAKE256 algorithms depends on specific security requirements and device performance. If the application requires high performance and the output digest length is short, the SHAKE128 algorithm can be chosen; if higher security is required and device performance allows, the SHAKE256 algorithm can be selected.
[0124] Figure 6 A schematic diagram of a quantum-resistant signature device according to an embodiment of this application is shown, as follows: Figure 6 As shown, a quantum-resistant signature device includes:
[0125] The random number generation module 10 is used to generate random numbers based on a true random number generator;
[0126] The first processing module 11 is used to process random numbers based on the XOF algorithm to obtain multiple one-time private keys;
[0127] The second processing module 12 is used to process the one-time private key based on the XOF algorithm to obtain multiple leaf nodes of the tree key structure;
[0128] The determination module 13 is used to determine the upper-level nodes layer by layer based on the lower-level nodes of the tree key structure, starting from the layer where the leaf node is located, to obtain the tree key structure; the non-root nodes of the tree key structure are determined based on the XOF algorithm, and the root nodes of the tree key structure are determined based on the SHA3-512 algorithm;
[0129] The signature module 14 is used to generate an LMS signature of the information to be signed based on a tree-structured key structure.
[0130] In one embodiment, the first processing module 11 is further configured to:
[0131] Based on the XOF algorithm, a random number is hashed to obtain the first output digest; the length of the first output digest is... bit;
[0132] The first output digest is divided into A one-time private key of length n;
[0133] Where n is the length of the output digest of the XOF algorithm, and h is the number of layers in the tree-structured key structure.
[0134] In one embodiment, the second processing module 12 is further configured to:
[0135] Concatenate all one-time private keys to obtain concatenated private key data;
[0136] Based on the XOF algorithm, the private key concatenated data is hashed to obtain the second output digest;
[0137] The second output digest is split to obtain multiple leaf nodes; the number of leaf nodes is the same as the number of one-time private keys.
[0138] In one possible implementation, the determining module 13 is further configured to:
[0139] Starting from the layer where the leaf node is located, the four adjacent lower-level nodes are concatenated layer by layer to obtain the node combination data;
[0140] In response to the fact that the upper-level node is not the root node, the node combination data is hashed based on the XOF algorithm to obtain multiple third output digests; the third output digests are then split to obtain multiple upper-level nodes; the length of the third output digest is 2n bits, and the length of the upper-level node is n bits.
[0141] In response to the upper-level node being the root node, the node combination data is hashed based on the SHA3-512 algorithm to obtain the fourth output digest; the fourth output digest is then used to determine the root node.
[0142] In one possible implementation, the signature module 14 is further configured to:
[0143] Based on the XOF algorithm, the information to be signed is hashed to obtain the fifth output digest.
[0144] Based on the XOF algorithm, the target private key and the fifth output digest are processed to obtain the initial signature; the target private key is an unused one-time private key.
[0145] Based on the index value of the target private key, determine the hash values of all sibling nodes of the target private key from the leaf node to the root node;
[0146] The initial signature, index value, and hash value of the sibling node are combined to obtain the LMS signature.
[0147] In one possible implementation, the signature module 14 is further configured to:
[0148] The target private key and the fifth output digest are concatenated to obtain the signature input data;
[0149] Based on the XOF algorithm, the signature input data is hashed to obtain the initial signature.
[0150] In one possible implementation, a quantum-resistant signature device further includes a verification module for:
[0151] Extract the corresponding initial target signature, target index value, and target hash value of the sibling node from the LMS signature of the target information;
[0152] Based on the XOF algorithm, the target information is hashed to obtain the sixth output digest;
[0153] Based on the target initial signature, the sixth output digest, the target index value, and the target hash value of the sibling node, determine the reconstructed root node of the tree key structure;
[0154] If the reconstructed root node is the same as the root node of the tree key structure, then the LMS signature verification is confirmed to be successful.
[0155] In one possible implementation, the verification module is further configured to:
[0156] Based on the target initial signature and the sixth output digest, determine the target private key for generating the target initial signature;
[0157] Based on the target private key, determine the target leaf node corresponding to the target private key;
[0158] Based on the target hash values of the target leaf node and its sibling nodes, determine the reconstructed root node of the tree key structure.
[0159] In one possible implementation, the XOF algorithm is either the SHAKE128 algorithm or the SHAKE256 algorithm.
[0160] According to embodiments of this application, this application also provides an electronic device and a readable storage medium.
[0161] Figure 7 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of this application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.
[0162] like Figure 7 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the electronic device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0163] Multiple components in electronic device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of displays, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows electronic device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0164] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as a quantum-resistant signature method. For example, in some embodiments, a quantum-resistant signature method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of a quantum-resistant signature method described above can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform a quantum-resistant signature method by any other suitable means (e.g., by means of firmware).
[0165] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0166] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0167] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0168] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0169] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0170] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0171] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.
[0172] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0173] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A quantum-resistant signature method applied to resource-constrained devices, characterized in that, The method includes: Generate random numbers based on a true random number generator; Based on the Extensible Output Function (XOF) algorithm, the random number is processed to obtain multiple one-time private keys; Based on the XOF algorithm, the one-time private key is processed to obtain multiple leaf nodes of a tree-shaped key structure; Starting from the layer where the leaf node is located, the upper-level node is determined layer by layer based on the lower-level node of the tree key structure to obtain the tree key structure; the non-root nodes of the tree key structure are determined based on the XOF algorithm, and the root node of the tree key structure is determined based on the SHA3-512 algorithm; Based on the tree-shaped key structure, an LMS signature of the information to be signed is generated; The step of generating an LMS signature for the information to be signed based on the tree-structured key structure includes: Based on an unused one-time private key in the constructed tree key structure, the information to be signed is signed, and an LMS signature is generated by combining the hash values of all sibling nodes from the leaf node to the root node with the signature information based on the one-time private key.
2. The method according to claim 1, characterized in that, The random number is processed using the XOF algorithm to obtain multiple one-time private keys, including: Based on the XOF algorithm, the random number is hashed to obtain a first output digest; the length of the first output digest is... bit; The first output digest is segmented into A one-time private key of length n; Where n is the length of the output digest of the XOF algorithm, and h is the number of layers in the tree-structured key structure.
3. The method according to claim 1, characterized in that, The one-time private key is processed based on the XOF algorithm to obtain multiple leaf nodes of the tree-shaped key structure, including: Concatenate all the one-time private keys to obtain concatenated private key data; Based on the XOF algorithm, the concatenated private key data is hashed to obtain a second output digest; The second output digest is segmented to obtain multiple leaf nodes; the number of leaf nodes is the same as the number of one-time private keys.
4. The method according to claim 1, characterized in that, The process of determining the upper-level nodes layer by layer based on the lower-level nodes of the tree key structure, starting from the layer where the leaf node is located, to obtain the tree key structure includes: Starting from the layer where the leaf node is located, the four adjacent lower-level nodes are spliced together layer by layer to obtain the node combination data; In response to the fact that the upper-level node is not a root node, the node combination data is hashed based on the XOF algorithm to obtain multiple third output digests; the third output digests are then divided to obtain multiple upper-level nodes; the length of the third output digest is 2n bits, and the length of the upper-level node is n bits. In response to the upper-level node being the root node, the combined data of the nodes is hashed based on the SHA3-512 algorithm to obtain a fourth output digest; the fourth output digest is then determined as the root node.
5. The method according to claim 1, characterized in that, The step of generating an LMS signature for the information to be signed based on the tree-structured key includes: Based on the XOF algorithm, the information to be signed is hashed to obtain the fifth output digest; Based on the XOF algorithm, the target private key and the fifth output digest are processed to obtain the initial signature; the target private key is an unused one-time private key. Based on the index value of the target private key, determine the hash values of all sibling nodes of the target private key from the leaf node to the root node; The initial signature, index value, and hash value of the sibling node are combined to obtain the LMS signature.
6. The method according to claim 5, characterized in that, The initial signature is obtained by processing the target private key and the fifth output digest based on the XOF algorithm, including: The target private key and the fifth output digest are concatenated to obtain the signature input data; Based on the XOF algorithm, the signature input data is hashed to obtain the initial signature.
7. The method according to claim 5, characterized in that, The method further includes: Extract the corresponding initial target signature, target index value, and target hash value of the sibling node from the LMS signature of the target information; Based on the XOF algorithm, the target information is hashed to obtain the sixth output digest; Based on the target initial signature, the sixth output digest, the target index value, and the target hash value of the sibling node, determine the reconstructed root node of the tree key structure; If the reconstructed root node is the same as the root node of the tree key structure, then the LMS signature verification is confirmed to be successful.
8. The method according to claim 7, characterized in that, The step of determining the reconstructed root node of the tree key structure based on the target initial signature, the sixth output digest, the target index value, and the target hash value of the sibling node includes: Based on the target initial signature and the sixth output digest, determine the target private key for generating the target initial signature; Based on the target private key, determine the target leaf node corresponding to the target private key; Based on the target leaf node and the target hash value of the sibling node, the reconstructed root node of the tree key structure is determined.
9. The method according to claim 1, characterized in that, The XOF algorithm is either the SHAKE128 algorithm or the SHAKE256 algorithm.
10. A quantum-resistant signature device, applied to resource-constrained devices, characterized in that, The device includes: The random number generation module is used to generate random numbers based on a true random number generator. The first processing module is used to process the random number based on the Extensible Output Function (XOF) algorithm to obtain multiple one-time private keys; The second processing module is used to process the one-time private key based on the XOF algorithm to obtain multiple leaf nodes of a tree-shaped key structure; The determination module is used to determine the upper-level nodes layer by layer based on the lower-level nodes of the tree key structure, starting from the layer where the leaf node is located, to obtain the tree key structure; the non-root nodes of the tree key structure are determined based on the XOF algorithm, and the root nodes of the tree key structure are determined based on the SHA3-512 algorithm; The signature module is used to generate an LMS signature of the information to be signed based on the tree-shaped key structure. The step of generating an LMS signature for the information to be signed based on the tree-structured key structure includes: Based on an unused one-time private key in the constructed tree key structure, the information to be signed is signed, and an LMS signature is generated by combining the hash values of all sibling nodes from the leaf node to the root node with the signature information based on the one-time private key.
11. The apparatus according to claim 10, characterized in that, The first processing module is also used for: Based on the XOF algorithm, the random number is hashed to obtain a first output digest; the length of the first output digest is... bit; The first output digest is segmented into A one-time private key of length n; Where n is the length of the output digest of the XOF algorithm, and h is the number of layers in the tree-structured key structure.
12. The apparatus according to claim 10, characterized in that, The second processing module is also used for: Concatenate all the one-time private keys to obtain concatenated private key data; Based on the XOF algorithm, the concatenated private key data is hashed to obtain a second output digest; The second output digest is segmented to obtain multiple leaf nodes; the number of leaf nodes is the same as the number of one-time private keys.
13. The apparatus according to claim 10, characterized in that, The determining module is also used for: Starting from the layer where the leaf node is located, the four adjacent lower-level nodes are spliced together layer by layer to obtain the node combination data; In response to the fact that the upper-level node is not a root node, the node combination data is hashed based on the XOF algorithm to obtain multiple third output digests; the third output digests are then divided to obtain multiple upper-level nodes; the length of the third output digest is 2n bits, and the length of the upper-level node is n bits. In response to the upper-level node being the root node, the combined data of the nodes is hashed based on the SHA3-512 algorithm to obtain a fourth output digest; the fourth output digest is then determined as the root node.
14. The apparatus according to claim 10, characterized in that, The signature module is also used for: Based on the XOF algorithm, the information to be signed is hashed to obtain the fifth output digest; Based on the XOF algorithm, the target private key and the fifth output digest are processed to obtain the initial signature; The target private key is an unused one-time private key; Based on the index value of the target private key, determine the hash values of all sibling nodes of the target private key from the leaf node to the root node; The initial signature, index value, and hash value of the sibling node are combined to obtain the LMS signature.
15. The apparatus according to claim 14, characterized in that, The signature module is also used for: The target private key and the fifth output digest are concatenated to obtain the signature input data; Based on the XOF algorithm, the signature input data is hashed to obtain the initial signature.
16. The apparatus according to claim 14, characterized in that, The device further includes a verification module for: Extract the corresponding initial target signature, target index value, and target hash value of the sibling node from the LMS signature of the target information; Based on the XOF algorithm, the target information is hashed to obtain the sixth output digest; Based on the target initial signature, the sixth output digest, the target index value, and the target hash value of the sibling node, determine the reconstructed root node of the tree key structure; If the reconstructed root node is the same as the root node of the tree key structure, then the LMS signature verification is confirmed to be successful.
17. The apparatus according to claim 16, characterized in that, The verification module is also used for: Based on the target initial signature and the sixth output digest, determine the target private key for generating the target initial signature; Based on the target private key, determine the target leaf node corresponding to the target private key; Based on the target leaf node and the target hash value of the sibling node, the reconstructed root node of the tree key structure is determined.
18. The apparatus according to claim 10, characterized in that, The XOF algorithm is either the SHAKE128 algorithm or the SHAKE256 algorithm.
19. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
20. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-9.
Citation Information
Patent Citations
Digital signature method and device, storage medium and electronic equipment
CN117201034A
Post-quantum signature method, post-quantum signature verification method and related devices
CN119728114A