Post-quantum one-time digital signature generation method and device using sm3 national secret algorithm
By constructing a hash chain to generate a signature scheme using the national cryptographic algorithm SM3, the security problem of existing public-key cryptography algorithms under quantum computing attacks is solved, realizing efficient and secure post-quantum one-time digital signatures, which are suitable for various resource-constrained platforms.
Patent Information
- Application Number
- CN202410151227.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-02
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-02-02
AI Technical Summary
Existing public-key cryptography algorithms based on mathematical problems such as large integer factorization, discrete logarithms, and elliptic curves are not secure enough against quantum computing attacks. Furthermore, existing one-time signature schemes lose security after the key is used, have slow signing speeds and large signature values, and the verification chain cannot guarantee the correctness of the data.
A hash chain is constructed using the national cryptographic algorithm SM3, generating 48 private key blocks and 48 public key blocks. 48 signature blocks and a verification public key are generated through hash operations. The validity of the signature is verified using an index method, which simplifies the length of the public and private keys and the signature length.
It provides a post-quantum-secure digital signature scheme, which improves signing speed, enhances security, is suitable for resource-constrained hardware and software platforms, and broadens the application areas of hash functions.
Smart Images

Figure CN118054899B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of information security and cryptography, and in particular to a method and device for generating a post-quantum one-time digital signature using a SM3 national cryptographic algorithm. BACKGROUND
[0002] With the application and development of quantum computers, traditional public key cryptographic algorithms based on large integer factorization, discrete logarithm, elliptic curve, etc. will face more threatening quantum computing attacks. In order to counter the impact of quantum computing on information security, the research and optimization of a new generation of post-quantum cryptographic algorithms with the ability to resist quantum computing attacks are imminent.
[0003] In July 2022, the National Institute of Standards and Technology of the United States released the first batch of standardized post-quantum cryptographic algorithms. Among the first batch of standardized algorithms, there is a public key encryption algorithm CRYSTALS-Kyber and three digital signature algorithms, CRYSTALS-Dilithium, Falcon, and SPHINCS+. SPHINCS+ is a stateless signature scheme constructed using a hash function. SPHINCS+ uses a one-time signature scheme WOTS+ and a few-time signature scheme FORS at the bottom, and expands it into a multi-time signature scheme by expanding a binary hash tree.
[0004] A one-time signature scheme means that its key pair can only be used once, and after completing the signature, the key pair completely loses its security. In the WOTS+ signature scheme, a hash chain structure is used to construct a signature scheme. In the WOTS+ scheme, the security parameter is 256 bits, and the signature private key, public key, and digital signature are all 67x32 bytes, i.e. the generated signature value is large, the signature speed is slow, and the digital signature generation process needs the participation of the verification chain, but the verification chain cannot completely guarantee the correctness of the data. SUMMARY
[0005] The present application provides a method and device for generating a post-quantum one-time digital signature using a SM3 national cryptographic algorithm to solve the problems existing in the prior art. The technical solutions provided by the present application are as follows:
[0006] On the one hand, a method for generating a post-quantum one-time digital signature using a SM3 national cryptographic algorithm is provided, which comprises:
[0007] S1. Generate a signature private key under a predetermined security parameter, wherein the signature private key comprises 48 private key blocks, and each private key block is 32 bytes of pseudo-random hexadecimal data;
[0008] S2, using SM3 to hash 48 private key blocks respectively, 48 hash chains and 48 public key blocks are generated, each public key block is 32 bytes of hexadecimal data, and 48 public key blocks constitute a signature public key;
[0009] S3, using SM3 to hash the message to be signed, obtaining a 32-byte message digest, calculating the node position index of each hash chain according to the message digest, and taking the data in the indexed chain node as a signature block of digital signature, the digital signature contains 48 signature blocks, each signature block is 32 bytes of hexadecimal data;
[0010] S4, using SM3 to hash each signature block of the digital signature respectively, obtaining the verification public key of each signature block, and using the verification public key to verify the digital signature.
[0011] Optionally, the S1 specifically comprises:
[0012] Under the security parameter of 256 bits, the private key seed SK.seed is taken as the seed data of the pseudo-random number generator PRNG to generate 48 pseudo-random numbers sk0, sk1…sk 47 , each pseudo-random number is 32 bytes of pseudo-random hexadecimal data, each pseudo-random number is taken as a constituent element of the signature private key SK, called a private key block, and the signature private key SK contains 48 private key blocks, denoted as SK=sk0, sk1…sk 47 .
[0013] Optionally, the S2 specifically comprises:
[0014] Using the SM3 algorithm to hash 48 private key blocks w times respectively, w=127 or 255, 48 hash chains L0, L1, L2…L 47 are obtained, each hash chain contains w+1 hash nodes, each private key block is taken as the first node of the corresponding hash chain, the data in the latter node in each two adjacent chain nodes in the hash chain is the SM3 hash value of the data in the former node, and the tail node of each hash chain is the public key block corresponding to each private key block. The signature public key PK contains 48 public key blocks corresponding to 48 private key blocks, denoted as PK=pk0, pk1…pk 47 .
[0015] Optionally, when w=127, the S3 specifically comprises:
[0016] The 32-byte message digest in hexadecimal form contains 64 data elements of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, with the position of the first element in the hexadecimal form of the message digest defined as 1, the position of the last element in the hexadecimal form of the message digest defined as 64, and the sum of the positions of each element of 0-F calculated as the position information of each element;
[0017] The position information of each element is divided by 127 and recorded as t1, and the results of the modulo division of the position information of 0-F are mapped in order to the position nodes t1+1 of the 0-15th hash chain as the node position indexes of the 0-15th hash chain, and the data in the indexed chain nodes are taken as the 0-15th signature blocks in the digital signature;
[0018] The 32-byte message digest in binary form is 256 bits, each group of 8 bits is divided into 32 groups, each group of 8-bit binary data is calculated as a decimal data, and 32 message digest groups of decimal data are calculated;
[0019] The 32 message digest groups of decimal data are divided by 127 and recorded as t2, and the results of the modulo division of the 1-32 groups of decimal data are mapped in order to the position nodes t2+1 of the 16-47th hash chain as the node position indexes of the 16-47th hash chain, and the data in the indexed chain nodes are taken as the 16-47th signature blocks in the digital signature.
[0020] Optionally, when w=255, the S3 specifically includes:
[0021] The 32-byte message digest in hexadecimal form contains 64 data elements of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, with the position of the first element in the hexadecimal form of the message digest defined as 1, the position of the last element in the hexadecimal form of the message digest defined as 64, and the sum of the positions of each element of 0-F calculated as the position information of each element;
[0022] The position information of each element is divided by 255 and recorded as t3, and the results of the modulo division of the position information of 0-F are mapped in order to the position nodes t3+1 of the 0-15th hash chain as the node position indexes of the 0-15th hash chain, and the data in the indexed chain nodes are taken as the 0-15th signature blocks in the digital signature;
[0023] The 32-byte message digest in binary form is 256 bits, each group of 8 bits is divided into 32 groups, each group of 8-bit binary data is calculated as a decimal data, and 32 message digest groups of decimal data are calculated, recorded as t4;
[0024] The decimal data of group 1-32 is mapped in sequence to the position node t4+1 of the 16-47th hash chain, as the node position index of the 16-47th hash chain, and the data in the indexed chain node is taken as the 16-47th signature block in the digital signature.
[0025] Optionally, when w = 127, the S4 specifically comprises:
[0026] The corresponding 0-15th signature block in the digital signature is subjected to 127-t1 times of hash operation using SM3 to obtain 0-15th verification public key vpk0, vpk1…vpk 15 ;
[0027] The corresponding 16-47th signature block in the digital signature is subjected to 127-t2 times of hash operation using SM3 to obtain 16-47th verification public key vpk 16 , vpk 17 …vpk 47 , and the complete verification public key VPK is recorded as VPK = vpk0, vpk1…vpk 47 ;
[0028] Verification is performed on whether vpk0, vpk1…vpk 47 is equal to pk1, pk2…pk 47 , if VPK = PK, the signature is valid, and if VPK ≠ PK, the signature is invalid.
[0029] Optionally, when w = 127, the S4 specifically comprises:
[0030] The corresponding 0-15th signature block in the digital signature is subjected to 255-t3 times of hash operation using SM3 to obtain 0-15th verification public key vpk0, vpk1…vpk 15 ;
[0031] The corresponding 16-47th signature block in the digital signature is subjected to 255-t4 times of hash operation using SM3 to obtain 16-47th verification public key vpk 16 , vpk 17 …vpk 47 , and the complete verification public key VPK is recorded as VPK = vpk0, vpk1…vpk 47 ;
[0032] Verification is performed on whether vpk0, vpk1…vpk 47 is equal to pk1, pk2…pk 47 , if VPK = PK, the signature is valid, and if VPK ≠ PK, the signature is invalid.
[0033] In another aspect, a post-quantum one-time digital signature generation device using a national cryptographic algorithm SM3 is provided, and the device comprises:
[0034] A private key generation module is configured to generate a signature private key under preset security parameters, and the signature private key comprises 48 private key blocks, each of which is 32 bytes of pseudo-random hexadecimal data.
[0035] A public key generation module is configured to use SM3 to perform hash operations on the 48 private key blocks respectively, to generate 48 hash chains and 48 public key blocks, each of which is 32 bytes of hexadecimal data, and the 48 public key blocks constitute a signature public key.
[0036] A digital signature generation module is configured to use SM3 to perform a hash operation on a message to be signed to obtain a 32-byte message digest, to calculate a node position index of each hash chain according to the message digest, and to use data in the indexed chain node as a signature block of a digital signature, wherein the digital signature comprises 48 signature blocks, each of which is 32 bytes of hexadecimal data.
[0037] A signature verification module is configured to use SM3 to perform hash operations on each signature block of the digital signature respectively to obtain a verification public key of each signature block, and to use the verification public key to verify the digital signature.
[0038] In another aspect, an electronic device is provided, which comprises a processor and a memory, and the memory stores instructions that are loaded and executed by the processor to implement the above-mentioned post-quantum one-time digital signature generation method using the national cryptographic algorithm SM3.
[0039] In another aspect, a computer-readable storage medium is provided, which stores instructions that are loaded and executed by a processor to implement the above-mentioned post-quantum one-time digital signature generation method using the national cryptographic algorithm SM3.
[0040] Compared with the prior art, the above technical solution has at least the following beneficial effects:
[0041] First, the signature scheme is constructed by using the national cryptographic algorithm SM3 to construct hash chains and keys, and the security of the signature scheme depends on the security of SM3, which has very reliable post-quantum security guarantee and fills the gap of the current domestic commercial digital signature algorithm in terms of quantum resistance.
[0042] Second, by changing the signature structure, the length of the public and private keys used in the existing signature scheme based on a hash function and the length of the generated digital signature are shortened, and the length of the public and private keys used in the present application and the length of the generated digital signature are both 48x32 bytes. This compact post-quantum one-time digital signature generation method improves the signature speed.
[0043] Thirdly, in terms of security, the present application does not use a verification chain, and the two index modes in the present application verify each other, thereby improving the security of the scheme.
[0044] Fourthly, the present application is based on the national secret algorithm SM3, and the signature scheme constructed by SM3 not only widens the application field of the hash function, but also makes the present scheme have good compatibility and applicability, can be deployed on various resource-limited software and hardware platforms, and has a wide application field. BRIEF DESCRIPTION OF DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0046] Figure 1 A flow chart of a post-quantum one-time digital signature generation method using the national secret algorithm SM3 is provided for the embodiments of the present application.
[0047] Figure 2 A private key generation schematic diagram is provided for the embodiments of the present application.
[0048] Figure 3 A hash chain generation and public key generation schematic diagram is provided for the embodiments of the present application.
[0049] Figure 4 An element position information schematic diagram for obtaining a hexadecimal form of a message digest is provided for the embodiments of the present application.
[0050] Figure 5 A decimal data schematic diagram for obtaining a message digest group is provided for the embodiments of the present application.
[0051] Figure 6 A block diagram of a post-quantum one-time digital signature generation device using the national secret algorithm SM3 is provided for the embodiments of the present application.
[0052] Figure 7 A structural schematic diagram of an electronic device is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0053] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0054] like Figure 1 As shown, this embodiment of the invention provides a method for generating a post-quantum primary digital signature using the national cryptographic algorithm SM3, the method comprising:
[0055] S1. Under preset security parameters, generate a signature private key, which contains 48 private key blocks, each of which is 32 bytes of pseudo-random hexadecimal data;
[0056] S2. Use SM3 to perform hash operations on the 48 private key blocks respectively, generating 48 hash chains and 48 public key blocks. Each public key block is 32 bytes of hexadecimal data, and the 48 public key blocks constitute the signature public key.
[0057] S3. Use SM3 to perform a hash operation on the message to be signed to obtain a 32-byte message digest. Calculate the node position index of each hash chain based on the message digest. Use the data in the indexed chain node as the signature block of the digital signature. The digital signature contains 48 signature blocks, each of which is 32 bytes of hexadecimal data.
[0058] S4. Use SM3 to perform hash operations on each signature block of the digital signature to obtain the verification public key of each signature block, and use the verification public key to verify the digital signature.
[0059] The following is combined with Figures 2-5 This invention provides a detailed description of a post-quantum primary digital signature generation method using the national cryptographic algorithm SM3, the method comprising:
[0060] S1. Under preset security parameters, generate a signature private key, which contains 48 private key blocks, each of which is 32 bytes of pseudo-random hexadecimal data;
[0061] Optionally, S1 specifically includes:
[0062] like Figure 2 As shown, with a security parameter of 256 bits, the private key seed SK.seed is used as the seed data for the pseudo-random number generator PRNG to generate 48 pseudo-random numbers sk0, sk1...sk 47Each pseudo-random number is a 32-byte pseudo-random hexadecimal data. Each pseudo-random number serves as a constituent element of the signing private key SK, called a private key block. The signing private key SK contains 48 private key blocks, denoted as SK = sk0, sk1...sk 47 .
[0063] S2. Use SM3 to perform hash operations on the 48 private key blocks respectively, generating 48 hash chains and 48 public key blocks. Each public key block is 32 bytes of hexadecimal data, and the 48 public key blocks constitute the signature public key.
[0064] Optionally, S2 specifically includes:
[0065] The SM3 national cryptographic algorithm is used to perform w hash operations on each of the 48 private key blocks, where w = 127 or 255 (e.g., ...). Figure 2 and 3 As shown in the diagram (using 127 as an example), 48 hash chains are obtained, namely L0, L1, L2...L... 47 Each hash chain contains w+1 hash nodes. Each private key block serves as the head node of its corresponding hash chain. In each hash chain, the data in the subsequent node is the SM3 hash value of the data in the preceding node. The tail node of each hash chain is the public key block corresponding to each private key block. The signature public key PK contains 48 public key blocks corresponding to 48 private key blocks, denoted as PK = pk0, pk1, ..., pk 47 .
[0066] Specifically, taking w=127 as an example, L 0,0 =sk0,L 0,1 =H(L) 0,0 )...L 0,127 =H(L) 0,126 ), L 1,0 =sk1,L 1,1 =H(L) 1,0 L 1,2 =H(L) 1,1 )...L 1,127 =H(L) 1,126 )...L 47,0 =sk 47 L 47,1 =H(L) 47,0 )...L 47,127 =H(L) 47,126 ), where H is the hash function SM3, L a,b For chain nodes.
[0067] The public key block is the hash value obtained by performing 127 hash operations on the data in the corresponding private key block using the SM3 hash function, i.e., pk0 = H. 127 (sk0), pk1 = H 127(sk1), pk2 = H 127 (sk2)…pk 47 = H 127 (sk 47 ), denoted as PK = pk0, pk1…pk 47 .
[0068] S3, hashing the message to be signed using SM3 to obtain a 32-byte message digest, calculating the node position index of each hash chain according to the message digest, taking the data in the indexed chain node as the signature block of the digital signature, the digital signature containing 48 signature blocks, each signature block being 32 bytes of hexadecimal data;
[0069] Optionally, when w = 127, the S3 specifically includes:
[0070] The hexadecimal form of the 32-byte message digest contains 64 data elements of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, with the position of the first element in the hexadecimal form of the message digest defined as 1, and the position of the last element in the hexadecimal form of the message digest defined as 64. The sum of the positions of each element 0-F is calculated as the position information of each element;
[0071] As shown in the following table, the position information of element 0 in the hexadecimal form of the SM3 digest of the message "Hello World!" is 144. Figure 4
[0072] The position information of each element is divided by 127, denoted as t1, and the results of the position information of 0-F are mapped to the position nodes t1+1 of the 0-15th hash chain in order, as the node position index of the 0-15th hash chain, and the data in the indexed chain node is taken as the 0-15th signature block in the digital signature;
[0073] Specifically, L0 is the position information mapping chain of element 0, L1 is the position information mapping chain of element 1, L2 is the position information mapping chain of element 2, and so on, and LE is the position information mapping chain of element E, and LF is the position information mapping chain of element F. 14 15
[0074] For example, the position information 144 of element 0 is divided by 127 to obtain 17, i.e. t1 = 17, and the 17th+1 = 18th node of the 0th hash chain L0 is taken as the node position index, and the data corresponding to the 18th node of the 0th hash chain L0 is taken as the 1st block signature block of the digital signature.
[0075] The binary form of the 32-byte message digest is 256 bits, which is divided into 32 groups of 8 bits each, and each group of 8-bit binary data is calculated as a decimal data, and 32 message digest groups of decimal data are calculated.
[0076] As shown in the binary form of the SM3 digest of the message "Hello World!", the first 8-bit group is 01110111, and the decimal data is calculated as 119. Similarly, 32 message digest groups of decimal data are calculated. Figure 5
[0077] The decimal data of the 32 message digest groups is divided by 127, denoted as t2, and the results of the modulo operation of the decimal data of groups 1-32 are mapped to the position nodes t2+1 of the 16th-47th hash chain in order, as the node position index of the 16th-47th hash chain. The data in the indexed chain node is used as the 16th-47th signature block in the digital signature.
[0078] For example, the decimal data 119 of the first group is divided by 127 to obtain 119, i.e. t2=119, and the 119th node of the 16th hash chain L 15 is used as the node position index, and the data corresponding to the 119th node of the 16th hash chain L 15 is used as the 17th signature block of the digital signature.
[0079] Optionally, when w=255, the S3 specifically includes:
[0080] The hexadecimal form of the 32-byte message digest contains 64 data elements of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. The position of the first element in the hexadecimal form of the message digest is defined as 1, and the position of the last element in the hexadecimal form of the message digest is defined as 64. The sum of the positions of each element of 0-F is calculated as the position information of each element.
[0081] The position information of each element is divided by 255, denoted as t3, and the results of the modulo operation of the position information of 0-F are mapped to the position nodes t3+1 of the 0th-15th hash chain in order, as the node position index of the 0th-15th hash chain. The data in the indexed chain node is used as the 0th-15th signature block in the digital signature.
[0082] The binary form of the 32-byte message digest is 256 bits, which is divided into 32 groups of 8 bits each, and each group of 8-bit binary data is calculated as a decimal data, and 32 message digest groups of decimal data are calculated, denoted as t4.
[0083] The decimal data of the group 1-32 is mapped to the position node t4+1 of the 16-47th hash chain in sequence, as the node position index of the 16-47th hash chain, and the data in the indexed chain node is taken as the 16-47th signature block in the digital signature.
[0084] The finally generated digital signature is denoted as σ = σ0, σ1…σ 47 .
[0085] S4, using SM3 to hash each signature block of the digital signature respectively to obtain the verification public key of each signature block, and using the verification public key to verify the digital signature.
[0086] Optionally, when w = 127, the S4 specifically includes:
[0087] The 0-15th signature block in the digital signature is hashed using SM3 for 127-t1 times to obtain the 0-15th verification public key vpk0, vpk1…vpk 15 ;
[0088] The 16-47th signature block in the digital signature is hashed using SM3 for 127-t2 times to obtain the 16-47th verification public key vpk 16 , vpk 17 …vpk 47 , and the complete verification public key VPK is denoted as VPK = vpk0, vpk1…vpk 47 ;
[0089] Whether vpk0, vpk1…vpk 47 is equal to pk1, pk2…pk 47 , if VPK = PK, the signature is valid, and if VPK ≠ PK, the signature is invalid.
[0090] Optionally, when w = 255, the S4 specifically includes:
[0091] The 0-15th signature block in the digital signature is hashed using SM3 for 255-t3 times to obtain the 0-15th verification public key vpk0, vpk1…vpk 15 ;
[0092] The 16-47th signature block in the digital signature is hashed using SM3 for 255-t4 times to obtain the 16-47th verification public key vpk 16 , vpk 17 …vpk 47 , and the complete verification public key VPK is denoted as VPK = vpk0, vpk1…vpk 47 ;
[0093] Verify vpk0, vpk1...vpk 47 whether equal to pk1, pk2...pk 47 If VPK=PK, the signature is valid, if VPK≠PK, the signature is invalid.
[0094] As Figure 6 shown, the embodiment of the present application also provides a post-quantum one-time digital signature generation device using a national encryption algorithm SM3, the device comprising:
[0095] A private key generation module 610 is configured to generate a signature private key under preset security parameters, the signature private key comprising 48 private key blocks, each private key block being 32 bytes of pseudo-random hexadecimal data.
[0096] A public key generation module 620 is configured to use SM3 to perform hash operations on the 48 private key blocks respectively, to generate 48 hash chains and 48 public key blocks, each public key block being 32 bytes of hexadecimal data, and the 48 public key blocks constituting a signature public key.
[0097] A digital signature generation module 630 is configured to use SM3 to perform a hash operation on a message to be signed to obtain a 32-byte message digest, to calculate a node position index of each hash chain according to the message digest, and to use data in the indexed chain node as a signature block of a digital signature, the digital signature comprising 48 signature blocks, each signature block being 32 bytes of hexadecimal data.
[0098] A signature verification module 640 is configured to use SM3 to perform hash operations on each signature block of the digital signature respectively to obtain a verification public key of each signature block, and to use the verification public key to verify the digital signature.
[0099] The post-quantum one-time digital signature generation device using the national encryption algorithm SM3 provided by the embodiment of the present application has a function structure corresponding to the post-quantum one-time digital signature generation method using the national encryption algorithm SM3 provided by the embodiment of the present application, and will not be described here.
[0100] Figure 7 is a structural schematic diagram of an electronic device 700 provided by the embodiment of the present application. The electronic device 700 can have relatively large differences due to different configurations or performances, and can include one or more processors (Central Processing Units, CPU) 701 and one or more memories 702, wherein the memory 702 stores instructions, the instructions are loaded and executed by the processor 701 to realize the steps of the post-quantum one-time digital signature generation method using the national encryption algorithm SM3.
[0101] In the example embodiment, a computer readable storage medium, such as a memory including instructions executable by a processor in a terminal to perform the above method for generating a post-quantum one-time digital signature using the SM3 national cryptographic algorithm, is also provided. For example, the computer readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0102] Those of ordinary skill in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by a program instructing relevant hardware to complete, and the program can be stored in a computer readable storage medium, such as a read-only memory, a magnetic disk, or an optical disk.
[0103] The above description is merely preferred embodiments of the present application, and is not intended to limit the present application. Any modification, equivalent replacement, improvement, and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A post-quantum one-time digital signature generation method using a national cryptographic algorithm SM3, characterized in that, The method comprises: S1, generating a signature private key under a preset security parameter, the signature private key comprising 48 private key blocks, each private key block being 32 bytes of pseudo-random hexadecimal data; S2, performing hash operation on the 48 private key blocks respectively using SM3 to generate 48 hash chains and 48 public key blocks, each public key block being 32 bytes of hexadecimal data, and the 48 public key blocks constituting a signature public key; S3, performing hash operation on a message to be signed using SM3 to obtain a 32-byte message digest, calculating a node position index of each hash chain according to the message digest, and taking data in the indexed chain node as a signature block of the digital signature, the digital signature comprising 48 signature blocks, each signature block being 32 bytes of hexadecimal data; S4, performing hash operation on each signature block of the digital signature respectively using SM3 to obtain a verification public key of each signature block, and using the verification public key to verify the digital signature.
2. The method of claim 1, wherein, The S1 specifically comprises: Under the security parameter of 256 bits, the private key seed SK.seed is taken as the seed data of a pseudo-random number generator PRNG to generate 48 pseudo-random numbers sk0, sk1…sk 47 Each pseudo-random number is 32-byte pseudo-random hexadecimal data, each pseudo-random number is taken as a constituent element of a signature private key SK, referred to as a private key block, and the signature private key SK contains 48 private key blocks, denoted as SK=sk0, sk1…sk 47 .
3. The method of claim 1, wherein, The S2 specifically comprises: Using the SM3 algorithm, 48 private key blocks are hashed w times, w = 127 or 255, to obtain 48 hash chains, L0, L1, L2...L 47 Each hash chain contains w+1 hash nodes, each private key block is the first node of the corresponding hash chain, and the data in the latter node of each two adjacent chain nodes in the hash chain is the SM3 hash value of the data in the former node. The tail node of each hash chain is the public key block corresponding to each private key block. The signature public key PK contains 48 public key blocks corresponding to 48 private key blocks, denoted as PK = pk0, pk1...pk 47 .
4. The method of claim 3, wherein, When w=127, the S3 specifically comprises: The hexadecimal form of the 32-byte message digest comprises 64 data elements of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F, the position of the first element in the hexadecimal form of the message digest is defined as 1, the position of the last element in the hexadecimal form of the message digest is defined as 64, the sum of the positions of each element of 0-F is calculated as the position information of each element; The position information of each element is divided by 127 to obtain t1, and the results of the position information of 0-F are mapped to the position node t1+1 of the 0-15th hash chain in sequence as the node position index of the 0-15th hash chain, and the data in the indexed chain node is taken as the 0-15th signature block in the digital signature; The binary form of the 32-byte message digest is 256 bits, each 8 bits is divided into a group, a total of 32 groups, each group of 8-bit binary data is calculated as a decimal data, and 32 message digest groups of decimal data are calculated; The 32 message digest groups of decimal data are divided by 127 to obtain t2, and the results of the decimal data of 1-32 groups are mapped to the position node t2+1 of the 16th-47th hash chain in sequence as the node position index of the 16th-47th hash chain, and the data in the indexed chain node is taken as the 16th-47th signature block in the digital signature.
5. The method of claim 3, wherein, When w=255, the S3 specifically comprises: The hexadecimal form of the 32-byte message digest comprises 64 data elements of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F, the position of the first element in the hexadecimal form of the message digest is defined as 1, the position of the last element in the hexadecimal form of the message digest is defined as 64, the sum of the positions of each element of 0-F is calculated as the position information of each element; The position information of each element is taken modulo 255, denoted as t3, and the results of the modulo operation of the position information of 0-F are sequentially mapped to the position nodes t3+1 of the 0-15th hash chain as node position indexes of the 0-15th hash chain, and the data in the indexed chain nodes are taken as the 0-15th signature block in the digital signature; The binary form of the 32-byte message digest is 256 bits, each 8 bits is divided into a group, a total of 32 groups, each group of 8-bit binary data is calculated as a decimal data, and 32 message digest groups of decimal data are calculated, denoted as t4; The 1st-32th group of decimal data is sequentially mapped to the position nodes t4+1 of the 16th-47th hash chain as node position indexes of the 16th-47th hash chain, and the data in the indexed chain nodes are taken as the 16th-47th signature block in the digital signature.
6. The method of claim 4, wherein, When w=127, the S4 specifically includes: The corresponding 0-15 signature blocks in the digital signature are subjected to 127-t1 times hash operation using SM3 to obtain 0-15 verification public keys vpk0, vpk1...vpk 15 ; The corresponding signature blocks 16-47 in the digital signature are subjected to 127-t2 hash operation using SM3 to obtain verification public keys 16-47 vpk 16 , vpk 17 … vpk 47 , complete verification public key VPK, denoted as VPK = vpk0, vpk1…vpk 47 ; Verification vpk0, vpk1...vpk 47 Equal to pk1, pk2...pk 47 If VPK = PK, the signature is valid, if VPK ≠ PK, the signature is invalid.
7. The method of claim 5, wherein, When w=255, the S4 specifically includes: The corresponding 0-15 signature blocks in the digital signature are subjected to 255-t3 times hash operation using SM3 to obtain 0-15 verification public keys vpk0, vpk1...vpk 15 ; The corresponding signature blocks 16-47 in the digital signature are subjected to 255-t 4th hash operation using SM3 to obtain verification public keys 16-47 vpk 16 , vpk 17 … vpk 47 , the complete verification public key VPK is recorded as VPK = vpk0, vpk1…vpk 47 ; Verification vpk0, vpk1...vpk 47 Equal to pk1, pk2...pk 47 Equal to pk1, pk2...pk If VPK = PK, the signature is valid, if VPK ≠ PK, the signature is invalid.
8. A post-quantum one-time digital signature generation device using a state secret algorithm SM3, characterized in that, The device includes: A private key generation module configured to generate a signature private key under a preset security parameter, the signature private key including 48 private key blocks, each private key block being 32 bytes of pseudo-random hexadecimal data; A public key generation module configured to perform hash operation on the 48 private key blocks respectively using SM3 to generate 48 hash chains and 48 public key blocks, each public key block being 32 bytes of hexadecimal data, and the 48 public key blocks constituting a signature public key; A digital signature generation module configured to perform hash operation on a message to be signed using SM3 to obtain a 32-byte message digest, calculate the node position indexes of each hash chain according to the message digest, and take the data in the indexed chain nodes as signature blocks of a digital signature, the digital signature including 48 signature blocks, each signature block being 32 bytes of hexadecimal data; A signature verification module configured to perform hash operation on each signature block of the digital signature respectively using SM3 to obtain a verification public key of each signature block, and use the verification public key to verify the digital signature. 9.An electronic device, comprising a processor and a memory having instructions stored therein, wherein, The instructions are loaded and executed by the processor to implement the post-quantum one-time digital signature generation method using the SM3 algorithm.
10. A computer-readable storage medium having stored therein instructions, the medium being characterized by: The instructions are loaded and executed by the processor to implement the post-quantum one-time digital signature generation method using the SM3 algorithm.
Citation Information
Patent Citations
Electronic official certificate verification method and system based on block chain
CN116915407A
Public key restoration method and device based on national cryptographic algorithm, and medium
CN117081739A