Short signature generation method and device, electronic equipment and computer storage medium
By generating random numbers and signature factors and combining hash values to generate short digital signatures, the problem of excessively long digital signatures in the prior art is solved, and the data volume is reduced and the transmission and storage efficiency is improved.
Patent Information
- Application Number
- CN202411884515.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-12-19
AI Technical Summary
In the prior art, the length of digital signatures is longer, resulting in a large amount of data during transmission or storage, affecting efficiency.
By generating a random number, a signature factor is generated based on the random number, the first private key and the first public key are further generated, and the first signature part is generated in combination with the pre-generated hash value. Finally, the random number and the first signature part are combined to obtain a short digital signature.
The length of the digital signature is reduced, and the amount of data transmitted or stored in a short digital signature is only half that of the prior art, which increases the transmission speed or reduces the space required for storage.
Smart Images

Figure CN119675878A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of information security technology, and in particular to a short signature generation method, device, electronic device and computer storage medium. Background Art
[0002] With the development of cloud platforms, big data, blockchain and other technologies, data security has become a crucial issue, so it is necessary to take corresponding security technical measures for data. As one of the means to ensure network information security, the digital signature mechanism can solve problems such as forgery, denial, impersonation and tampering of data, and improve data security.
[0003] At present, cryptographic devices use the national secret SM2 elliptic curve algorithm to generate the first signature part and the second signature part of the digital signature, and combine the first signature part and the second signature part to form a digital signature.
[0004] However, when a large number of digital signatures are transmitted or stored, the digital signature formed by the combination of the first signature part and the second signature part is relatively long, resulting in a large amount of data for transmitting or storing the digital signatures. Summary of the invention
[0005] In view of this, embodiments of the present application provide a short signature generation method, device, electronic device and computer storage medium to at least partially solve the above problems.
[0006] According to a first aspect of an embodiment of the present application, a short signature generation method is provided, including: generating a random number; generating a signature factor based on the random number; generating a first private key and a first public key based on the signature factor; generating a first signature part based on the first private key, the first public key and a pre-generated hash value; combining the random number and the first signature part to obtain a short digital signature.
[0007] In a possible implementation, generating a signature factor according to the random number includes: obtaining a signature identifier; obtaining a conversion parameter according to the length of the signature identifier; and obtaining the signature factor by calculating through a hash algorithm according to pre-calculated preprocessing information, the signature identifier, the conversion parameter, the information to be signed, and the random number.
[0008] In a possible implementation, generating the first private key and the first public key according to the signature factor includes: determining N index coordinates according to the M bits included in the signature factor, where N is an integer greater than or equal to 2, and 2 Mis an index range of a combination factor table, the combination factor table including a private key combination factor table and / or a public key combination factor table; extracting N private key elements corresponding to the index coordinates from the private key combination factor table according to the N index coordinates; extracting N public key elements corresponding to the index coordinates from the public key combination factor table according to the N index coordinates, wherein the public key combination factor table is generated according to the private key combination factor table; generating a first private key according to the N private key elements, and generating a first public key according to the N public key elements.
[0009] In a possible implementation, generating a first private key based on the N private key elements and generating a first public key based on the N public key elements include: performing a finite field addition operation on the N private key elements to obtain the first private key; and performing an elliptic point addition operation on the N public key elements to obtain the first public key.
[0010] In a possible implementation, the method further includes: determining whether the first private key is equal to 0; if the first private key is equal to 0, generating a random number to regenerate the first private key.
[0011] In a possible implementation, generating the first signature part according to the first private key, the first public key and a pre-generated hash value includes: calculating the second signature part according to the hash value and the horizontal coordinate in the first public key; generating the first signature part according to the hash value, the first private key, the signature private key and the second signature part.
[0012] In a possible implementation, it is determined whether the first signature part and the second signature part are equal to 0; if the first signature part and / or the second signature part are equal to 0, random numbers are generated to regenerate the first signature part and the second signature part.
[0013] According to the second aspect of an embodiment of the present application, a short signature generation device is provided, including: a first generation unit for generating a random number; a second generation unit for generating a signature factor based on the random number; a third generation unit for generating a first private key and a first public key based on the signature factor; a fourth generation unit for generating a first signature part based on the first private key, the first public key and a pre-generated hash value; and a combination unit for combining the random number and the first signature part to obtain a short digital signature.
[0014] According to a third aspect of an embodiment of the present application, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method described in the first aspect.
[0015] According to a fourth aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect is implemented.
[0016] According to the short signature generation method provided in the embodiment of the present application, a random number is generated, a signature factor is generated according to the random number, a first private key and a first public key are generated according to the signature factor, a first signature part is generated according to the first private key, the first public key and a pre-generated hash value, the random number and the first signature part are combined to obtain a short digital signature. Since the short digital signature finally generated is a combination of the random number and the first signature part, compared with the digital signature in the prior art including the first signature part and the second signature part, the length of the digital signature is reduced, and the amount of data transmitted or stored for the short digital signature is only half of that in the prior art. The amount of data transmitted or stored for the digital signature is low, which can increase the transmission speed or reduce the storage space required for storing the digital signature. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0018] Figure 1 This is a flow chart of a short signature generation method provided in an embodiment of the present application;
[0019] Figure 2 This is a flowchart of a method for generating a private key and a public key provided in an embodiment of the present application;
[0020] Figure 3 is a schematic diagram of a short signature generation device provided in an embodiment of the present application;
[0021] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.
[0023] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0024] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0025] Figure 1 is a flow chart of a short signature generation method provided in an embodiment of the present application. Figure 1 As shown, the method includes the following steps 101 to 105:
[0026] Step 101: Generate a random number.
[0027] Generate a random number z, which can be a random number generated according to the user's ID, or a randomly generated number, etc. In one example, the length of the random number z is 1 byte. The 1-byte random number z is to avoid the appearance of infinity points or zero values in the signature calculation. If this occurs, the step needs to be recalculated.
[0028] Step 102: Generate a signature factor based on the random number.
[0029] A signature factor t is generated according to a random number. In one example, the length of the signature factor t is 32 bytes.
[0030] Step 103: Generate a first private key and a first public key according to the signature factor.
[0031] Generate the first private key sk based on the signature factor t m and the first public key PKm , the first private key sk m and the first public key PK m Correspondingly. If PK m If it is a point at infinity, you need to regenerate a 1-byte random number z and calculate sk m and PK m .
[0032] Step 104: Generate a first signature part according to the first private key, the first public key and the pre-generated hash value.
[0033] Optionally, preprocessing information can be generated based on the relevant parameters of the elliptic curve and the identity of the signer, and a hash value e can be generated based on the preprocessing information. Specifically, the relevant parameters of the elliptic curve are initialized, and the formula Z is used. A =H 256 (ENTL A ||ID A ||a||b||x G ||y G ||x A ||y A ) Calculate the preprocessing information Z A , where Z A Used to represent preprocessing information, H 256 () is used to represent the hash function, ID A Used to represent the signer's identity, ENTL A By ID A The bit length is converted into two bytes, a and b are used to represent two elements in the prime field Fp and satisfy y 2 =x 3 +ax+b,(x G ,y G ) is used to represent the coordinates of the base point G on the elliptic curve, n is the order of the base point G, (x A ,y A ) is used to represent the signature public key held by the signer, and the corresponding signature private key is d A , that is, (x A ,y A ) = d A *G.
[0034] After calculating the preprocessing information Z A After that, according to the preprocessing information Z A By the following formula e = H v (Z A ||Ms) calculates the hash value e, where H v () is used to represent the hash function, Ms is the message to be signed, i.e. the original signature, and e is used to represent the hash value e. Thus, the generation of the hash value e can be realized.
[0035] It should be understood that H 256 () and H v () is used to characterize the hash function, which is generally the national secret SM3 hash algorithm, through which the hash value e can be generated.
[0036] After generating the hash value e, according to the first private key sk m and the first public key PK m and hash value e to generate the first signature part s, which is 32 bytes. If s is 0, you need to regenerate a 1-byte random number z and calculate sk m and PK m .
[0037] Step 105: Combine the random number and the first signature part to obtain a short digital signature.
[0038] The random number z and the first signature part s are combined to obtain a short digital signature (z||s). It should be understood that the length of the first signature part s is 32 bytes, and the length of the random number z is 1 byte, so the length of the short digital signature is 33 bytes. The length of the digital signature including the first signature part and the second signature part in the prior art is 64 bytes. Therefore, the length of the short digital signature provided in the embodiment of the present application is only 51.6% of the length of the digital signature in the prior art.
[0039] It should be noted that when performing signature verification, the second signature part r can be restored based on the public parameters, the original signature and the random number z in the signature value, thereby converting the short digital signature (z||s) into a digital signature (r||s) to achieve authentication of the signature. For specific descriptions, please refer to the description in the subsequent embodiments.
[0040] In an embodiment of the present application, a random number is generated, a signature factor is generated based on the random number, a first private key and a first public key are generated based on the signature factor, a first signature part is generated based on the first private key, the first public key and a pre-generated hash value, the random number and the first signature part are combined to obtain a short digital signature. Since the short digital signature finally generated is a combination of the random number and the first signature part, compared with the digital signature in the prior art that includes the first signature part and the second signature part, the length of the digital signature is reduced, and the amount of data transmitted or stored for the short digital signature is only half of that in the prior art. The amount of data transmitted or stored for the digital signature is low, which can increase the transmission speed or reduce the storage space required to store the digital signature.
[0041] In one possible implementation, when generating a signature factor based on a random number, a signature identifier can be obtained, a conversion parameter can be obtained based on the length of the signature identifier, and the signature factor can be obtained by calculating through a hash algorithm based on pre-calculated preprocessing information, the signature identifier, the conversion parameter, the generation signature information and the random number.
[0042] The signature is a unique identifiable ID. S , for example: the name or domain name of the system. In one example, the signature ID S Public as a public parameter of the system. Get ID S After ID S The length is converted to obtain the conversion parameter ENTL s ,ENTL S By ID S The bit length is converted into two bytes according to the preprocessing information Z A , Signature ID s , conversion parameter ENTL s , the information to be signed Ms and the random number z are hashed by the hash algorithm t=H v (z||ENTL s ||ID s ||Z A ||Ms) calculates the signature factor t. It should be noted that the preprocessing information Z A Please refer to the calculation method in the above embodiment, which will not be described in detail here.
[0043] In an embodiment of the present application, a signature factor is obtained by calculating through a hash algorithm based on pre-calculated preprocessing information, a signature identifier, a conversion parameter, a signature generation information and a random number. Since the signature factor is generated based on a random number and the signature identifier is a public parameter, the first private key and the first public key generated based on the signature factor can be deduced based on the random number to convert the random number into a second signature part. Therefore, when transmitting a digital signature, only a short digital signature composed of the first signature part and the random number can be transmitted, thereby reducing the amount of data transmitted or stored.
[0044] Figure 2 is a flowchart of a method for generating a private key and a public key provided in an embodiment of the present application, such as Figure 2 As shown, when generating the first private key and the first public key according to the library signature factor, the following steps 201 to 204 may be performed:
[0045] Step 201: Determine N index coordinates according to the M bits included in the signature factor.
[0046] Determine N index coordinates based on the M bits included in the signature factor, where N is an integer greater than or equal to 2. Mis the index range of the combination factor table. It should be understood that since the signature factor t is data generated by the hash algorithm, the length of the signature factor t is 256 bits. M is obtained according to the size of the combination factor table. For example, when M is 8 bits, the combination factor table has 256 elements, and the signature factor includes a total of 256 / 8=32 index coordinates. When M is 12 bits, the combination factor table has 4096 elements, and one signature factor includes 256 / 12=21 index coordinates. When M is 16 bits, the combination factor table has 65536 elements, and the signature factor includes a total of 256 / 16=8 index coordinates, that is, N is equal to the ratio of the bit length of t to the bit length of M. The combination factor table includes a private key combination factor table and / or a public key combination factor table.
[0047] Step 202: Extract N private key elements corresponding to the index coordinates from the private key combination factor table according to the N index coordinates.
[0048] A private key combination factor table is pre-generated. According to the N index coordinates, N private key elements corresponding to the index coordinates are extracted from the private key combination factor table. In one example, a plurality of non-repeating random numbers k are generated when the signature device is initialized. i ∈[1,n-1], forming the private key combination factor table.
[0049] Step 203: extract N public key elements corresponding to the index coordinates from the public key combination factor table according to the N index coordinates.
[0050] The public key combination factor table is generated according to the private key combination factor table. In one example, the public key combination factor table can be generated according to the formula P i =[k i ]*G generates a public key element corresponding to each private key element in the private key combination factor table to form a public key combination factor table. It should be noted that since the public key combination factor table is generated according to the private key combination factor table, the N private key elements extracted according to the N index coordinates correspond to the N public key elements, that is, the N private key elements correspond to the N public key elements one by one, and both satisfy P i =[k i ]*G. G is the base point (x G ,y G ).
[0051] It should be noted that the public key combination factor table can be made public as a public parameter of the system, that is, the identification ID S and the public key combination factor table as the public parameters disclosed by the system.
[0052] Step 204: Generate a first private key according to the N private key elements, and generate a first public key according to the N public key elements.
[0053] In an embodiment of the present application, N index coordinates are determined according to the M bits included in the signature factor, N private key elements are extracted from the private key combination factor table according to the N index coordinates, and N public key elements are extracted from the public key combination factor table according to the N index coordinates, thereby achieving generation of a first private key and a first public key according to the signature factor. Since the first private key and the first public key are generated according to the signature factor, and the signature factor is generated according to a random number, the first public key can be restored according to the public parameters, the signature original and the random number z in the signature value during the signature verification process to restore the digital signature including the first signature part and the second signature part, so that the short digital signature can represent a digital signature of normal length to reduce the amount of data in the transmission or storage process.
[0054] In one possible implementation, when generating a first private key based on N private key elements and generating a first public key based on N public key elements, a finite field addition operation can be performed on the N private key elements to obtain the first private key, and an elliptic point addition operation can be performed on the N public key elements to obtain the first public key.
[0055] In the embodiment of the present application, a finite field addition operation is performed on N private key elements to obtain a first private key, and an elliptic point addition operation is performed on N public key elements to obtain a first public key. The first private key generated by the finite field addition operation and the first public key generated by the elliptic curve point addition operation replace the result of generating a random number k and calculating the point multiplication operation of k and the base point G in the existing signature generation method. Since the private key combination factor table and the public key combination factor table are generated in advance, the point multiplication operation does not need to be performed in the generation process of the short digital signature. The amount of operation of a small number of finite field addition operations and a small number of elliptic curve point addition operations is much smaller than a point multiplication operation. Therefore, the amount of operation of the short signature generation method is low, and only a small number of point addition operations need to be calculated. The performance requirements of the cryptographic device are low, so the short signature generation method is suitable for cryptographic devices with poor performance and has high applicability. It can also improve the signature performance per unit time of the same cryptographic device by reducing the amount of signature operation.
[0056] In a possible implementation, it may also be determined whether the first private key is equal to 0. If the first private key is equal to 0, random number generation is performed to regenerate the first private key.
[0057] If the value of the first private key is 0, that is, the first private key sk m ==0, the process of generating a random number is re-executed, so that a new signature factor can be generated according to the re-generated random number, and then a new index coordinate is determined according to the new signature factor, so that the private key element can be extracted according to the new index coordinate to generate a new first private key.
[0058] In an embodiment of the present application, if the first private key is equal to 0, a random number is regenerated, and then the first private key can be regenerated, so that the first private key generated according to this method can meet the signature requirements and prevent the first public key from being an infinite point on the ellipse due to the first private key being equal to 0.
[0059] In one possible implementation, when the first signature part is generated based on the first private key, the first public key and the pre-generated hash value, the second signature part can be calculated based on the hash value and the horizontal coordinate in the first public key, and the first signature part can be generated based on the first private key, the signature private key and the second signature part.
[0060] According to the hash value and the abscissa in the first public key, the second signature part r is calculated by the following formula r = (e + x1) mod n, where e is the signature message Ms and the preprocessing information Z A The calculated hash value, x1, is used to represent the first public key PK i The x-axis coordinate of n is used to represent the order of the base point G. It should be understood that since the generation process of the public key is a point addition operation of the elliptic curve, the final value of the first public key is the point (x1, y1) on the elliptic curve.
[0061] According to the first private key, the signature private key and the second signature part, the following formula s=((1+d A ) -1 *(sk i -r*d A ))mod n generates the first signature part s, where d A Used to represent the signature private key held by the signing user, sk i The normal signing process is to combine the second signature part r and the first signature part s to form a digital signature (r, s), but in the embodiment of the present application, the second signature part r is calculated by the hash value and the first public key, and the first public key is obtained according to the signature factor, and the signature factor is generated according to the random number, and the identification ID can be identified in this scheme S The public key combination factor table is used as the public parameters disclosed by the system. Therefore, during the signature verification process, the second signature part r can be calculated through the public parameters, the signature original and the random number z in the signature value. Therefore, the digital signature (r, s) can be represented by a short signature (z||s).
[0062] In an embodiment of the present application, the second signature part can be calculated according to the hash value and the horizontal coordinate in the first public key, and the first signature part can be generated according to the first private key, the signature private key and the second signature part, thereby realizing the generation of a digital signature. During the signature verification process, the first public key can be calculated through the public parameters, the signature original and the random number z in the signature value, thereby restoring the second signature part r. Therefore, the digital signature (r, s) can be represented by a short digital signature (z||s) to reduce the amount of data during transmission or storage.
[0063] In a possible implementation, it is determined whether the first signature part and the second signature part are equal to 0. If the first signature part and / or the second signature part are equal to 0, random numbers are generated to regenerate the first signature part and the second signature part.
[0064] When the first signature part and / or the second signature part is equal to 0, the step of generating a random number is re-executed. After the random number is regenerated, the signature factor changes due to the change in the random number, which changes the first private key and the first public key generated according to the signature factor. Thus, the first signature part and the second signature part can be regenerated until the requirements are met.
[0065] In an embodiment of the present application, when the first signature part and / or the second signature part does not meet the requirements, a random number is regenerated to ensure the validity of the short digital signature, avoid the generation of an invalid short digital signature, and improve the practicality of the short signature generation method.
[0066] Figure 3 is a schematic diagram of a short signature generation device provided in an embodiment of the present application, such as Figure 3 As shown, the device 300 includes:
[0067] The first generating unit 301 is used to generate a random number.
[0068] The second generating unit 302 is used to generate a signature factor according to a random number.
[0069] The third generating unit 303 is used to generate a first private key and a first public key according to the signature factor.
[0070] The fourth generating unit 304 is used to generate a first signature part according to the first private key, the first public key and the pre-generated hash value.
[0071] The combining unit 305 is used to combine the random number and the first signature part to obtain a short digital signature.
[0072] In an embodiment of the present application, the first generation unit 301 can be used to execute step 101 in the above method embodiment, the second generation unit 302 can be used to execute step 102 in the above method embodiment, the third generation unit 303 can be used to execute step 103 in the above method embodiment, the fourth generation unit 304 can be used to execute step 104 in the above method embodiment, and the combination unit 305 can be used to execute step 105 in the above method embodiment.
[0073] In a possible implementation, the second generation unit 302 is further used to obtain a signature identifier, obtain a conversion parameter according to the length of the signature identifier, and obtain a signature factor through a hash algorithm based on pre-calculated preprocessing information, the signature identifier, the conversion parameter, the information to be signed, and a random number.
[0074] In a possible implementation, the third generation unit 303 is further configured to determine N index coordinates according to the M bits included in the signature factor, where N is an integer greater than or equal to 2, and 2 M is an index range of a combination factor table, the combination factor table includes a private key combination factor table and / or a public key combination factor table, N private key elements corresponding to the index coordinates are extracted from the private key combination factor table according to the N index coordinates, and N public key elements corresponding to the index coordinates are extracted from the public key combination factor table according to the N index coordinates, wherein the public key combination factor table is generated according to the private key combination factor table, a first private key is generated according to the N private key elements, and a first public key is generated according to the N public key elements.
[0075] In a possible implementation, the third generation unit 303 is further configured to perform a finite field addition operation on the N private key elements to obtain a first private key, and to perform an elliptic point addition operation on the N public key elements to obtain a first public key.
[0076] In a possible implementation, the first generation unit 301 is further configured to determine whether the first private key is equal to 0. If the first private key is equal to 0, a random number is generated to regenerate the first private key.
[0077] In a possible implementation, the fourth generation unit 304 is further configured to calculate the second signature part according to the hash value and the horizontal coordinate in the first public key, and generate the first signature part according to the hash value, the first private key, the signature private key and the second signature part.
[0078] In a possible implementation, the first generation unit 301 is also used to determine whether the first signature part and the second signature part are equal to 0. If the first signature part and / or the second signature part are equal to 0, a random number is generated to regenerate the first signature part and the second signature part.
[0079] It should be noted that, since the information interaction, execution process, etc. between the modules in the above-mentioned short signature generation device are based on the same concept as the above-mentioned short signature generation method embodiment, the specific contents can be found in the description in the above-mentioned short signature generation method embodiment and will not be repeated here.
[0080] Reference Figure 4 , shows a schematic diagram of the structure of an electronic device according to an embodiment of the present application. The specific embodiment of the present application does not limit the specific implementation of the electronic device.
[0081] like Figure 4 As shown, the electronic device may include: a processor (processor) 402 , a communication interface (Communications Interface) 404 , a memory (memory) 406 , and a communication bus 408 .
[0082] in:
[0083] The processor 402 , the communication interface 404 , and the memory 406 communicate with each other via a communication bus 408 .
[0084] The communication interface 404 is used to communicate with other electronic devices or servers.
[0085] The processor 402 is used to execute the program 410, and specifically can execute the relevant steps in the above-mentioned short signature generation method embodiment.
[0086] Specifically, the program 410 may include program codes, which include computer operation instructions.
[0087] The processor 402 may be a central processing unit (CPU), a graphics processing unit (GPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; one or more GPUs; or processors of different types, such as one or more CPUs, one or more GPUs, and one or more ASICs.
[0088] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0089] The program 410 may be specifically used to enable the processor 402 to execute the short signature generation method in any of the aforementioned embodiments.
[0090] The specific implementation of each step in program 410 can refer to the corresponding description of the corresponding steps and units in any of the aforementioned short signature generation method embodiments, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the aforementioned method embodiments, which will not be repeated here.
[0091] In an embodiment of the present application, a random number is generated, a signature factor is generated based on the random number, a first private key and a first public key are generated based on the signature factor, a first signature part is generated based on the first private key, the first public key and a pre-generated hash value, the random number and the first signature part are combined to obtain a short digital signature. Since the short digital signature finally generated is a combination of the random number and the first signature part, compared with the digital signature in the prior art that includes the first signature part and the second signature part, the length of the digital signature is reduced, and the amount of data transmitted or stored for the short digital signature is only half of that in the prior art. The amount of data transmitted or stored for the digital signature is low, which can increase the transmission speed or reduce the storage space required to store the digital signature.
[0092] [HZTC-HXJMJJ241005][HS2411170CCN]
[0093] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to execute operations corresponding to any one of the above-mentioned multiple method embodiments.
[0094] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0095] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a special-purpose processor or programmable or special-purpose hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the short signature generation method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the short signature generation method shown here, the execution of the code converts the general-purpose computer into a special-purpose computer for executing the short signature generation method shown here.
[0096] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0097] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.
Claims
1. A short signature generation method, characterized in that: include: Generate random numbers; Generate a signature factor according to the random number; Generate a first private key and a first public key according to the signature factor; Generate a first signature part according to the first private key, the first public key and a pre-generated hash value; The random number and the first signature part are combined to obtain a short digital signature.
2. The method according to claim 1, characterized in that Generating a signature factor according to the random number includes: Get the signature ID; Acquire a conversion parameter according to the length of the signature identifier; The signature factor is obtained by calculating through a hash algorithm according to the pre-calculated preprocessing information, the signature identifier, the conversion parameter, the information to be signed and the random number.
3. The method according to claim 1, characterized in that The generating a first private key and a first public key according to the signature factor includes: Determine N index coordinates according to the M bits included in the signature factor, where N is an integer greater than or equal to 2, M is an index range of a combination factor table, where the combination factor table includes a private key combination factor table and / or a public key combination factor table; Extracting N private key elements corresponding to the index coordinates from the private key combination factor table according to the N index coordinates; Extracting N public key elements corresponding to the index coordinates from the public key combination factor table according to the N index coordinates, wherein the public key combination factor table is generated according to the private key combination factor table; A first private key is generated according to the N private key elements, and a first public key is generated according to the N public key elements.
4. The method according to claim 3, characterized in that Generating a first private key according to the N private key elements, and generating a first public key according to the N public key elements, includes: Performing a finite field addition operation on the N private key elements to obtain the first private key; Perform an elliptic point addition operation on the N public key elements to obtain the first public key.
5. The method according to claim 4, characterized in that The method further comprises: Determine whether the first private key is equal to 0; If the first private key is equal to 0, a random number is generated to regenerate the first private key.
6. The method according to claim 1, characterized in that Generating a first signature part according to the first private key, the first public key and a pre-generated hash value includes: Calculate a second signature part according to the hash value and the abscissa in the first public key; The first signature part is generated according to the hash value, the first private key, the signature private key and the second signature part.
7. The method according to claim 6, characterized in that The method further comprises: Determine whether the first signature part and the second signature part are equal to 0; If the first signature part and / or the second signature part is equal to 0, a random number is generated to regenerate the first signature part and the second signature part.
8. A short signature generation device, characterized in that: include: A first generating unit, used for generating a random number; A second generating unit, configured to generate a signature factor according to the random number; A third generating unit, configured to generate a first private key and a first public key according to the signature factor; a fourth generating unit, configured to generate a first signature part according to the first private key, the first public key and a pre-generated hash value; A combining unit is used to combine the random number and the first signature part to obtain a short digital signature.
9. An electronic device, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the short signature generation method as described in any one of claims 1-7.
10. A computer storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the short signature generation method as described in any one of claims 1-7 is implemented.
Citation Information
Patent Citations
Digital signature method, device and system
CN112822026A
Signature implementation method, signature verification method, signature terminal, signature verification terminal and storage medium
CN113573304A
Signature method, signature verification method and electronic equipment
CN115242402A
Rapid signature generation method and device, electronic equipment and computer storage medium
CN116192396A
Encryption method and device based on elliptic curve signature, terminal and medium
CN117749382A