An elliptic curve-based fast digital signature method and device and storage medium
By preprocessing the SM2 elliptic curve digital signature algorithm to generate a preprocessed data pool, the signature process is simplified, the signature efficiency is improved, the problem of insufficient performance of traditional equipment is solved, and the network service requirements are met.
Patent Information
- Application Number
- CN202311655182.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-05
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-12-05
AI Technical Summary
Traditional digital signature devices are insufficient in performance for network services and cannot meet the needs of speed and resource saving, especially in the SM2 elliptic curve digital signature algorithm, which suffers from computational time and resource consumption.
By preprocessing the SM2 elliptic curve digital signature algorithm, a preprocessed data pool is generated, which includes the calculation process key and pre-calculated elliptic curve points. This preprocessed data pool simplifies the signature calculation process and improves efficiency.
It achieves an over 80% improvement in digital signature computation efficiency, solves the performance bottleneck of traditional equipment, adapts to the large-volume signature requirements of network services, and maintains the verifiability of signature results.
Smart Images

Figure CN117896072B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of digital signature, and more particularly, to an elliptic curve-based fast digital signature method, device and storage medium. BACKGROUND
[0002] With the promotion of online business towards automation, intelligence, unattended, and paperless direction, the security of data elements is also paid more and more attention. More and more online businesses need to use identity authentication, communication security, data resistance, data tamper-proof, data traceability and other security technologies to ensure the security of network business data elements. However, the use of these security technologies cannot be separated from a bottom core technology, that is, digital signature. Since the digital signature process involves a signature private key, a password special device is usually used in engineering to realize it to ensure the security of the signature private key. With the rapid development of network business and the increase of user quantity, the demand for digital signature of business is increasing, and the performance of traditional digital signature special password device has become "tight-lipped", which has become a bottleneck for the development of massive network business security.
[0003] In China, the digital signature on the network business mostly uses the SM2 elliptic curve digital signature algorithm stipulated by the State Cryptography Administration, which can be referred to in "SM2 Elliptic Curve Public Key Cryptography Algorithm" (GM / T 0003-2012). In the algorithm, the time-consuming and resource-consuming calculations include random number generation, elliptic curve point multiplication operation, and key transformation in the signature calculation process.
[0004] Therefore, there is an urgent need for a fast and resource-saving digital signature scheme. SUMMARY
[0005] In order to solve at least one problem described in the background, the present application provides an elliptic curve-based fast digital signature method, device and storage medium.
[0006] According to one aspect of the present application, an elliptic curve-based fast digital signature method is provided, comprising:
[0007] After completing the system initialization of the password device, the size of the pre-processing data pool is set according to the digital signature business processing amount, and the pre-processing data pool is generated;
[0008] After the password device is started, it is judged whether the pre-processing data amount in the pre-processing data pool is lower than a preset percentage; if it is lower than the preset percentage, the preset process is repeatedly executed until the pre-processing data amount in the pre-processing data pool is greater than or equal to the preset percentage;
[0009] When the digital signature service invokes the digital signature calculation of the cryptographic device, the fast digital signature is started, a set of preprocessed data is selected from the preprocessed data pool, a corresponding digital signature value is calculated according to the input compressed message, and the digital signature value is output.
[0010] Optionally, before setting the size of the preprocessed data pool according to the digital signature service processing amount, the cryptographic device is system initialized through the following steps:
[0011] According to the signature key d of the cryptographic device, a first process key d1 and a second process key d2 are calculated; wherein, the calculation method of d1 and d2 is as follows:
[0012] d1 = ((1 + d) -1 ) mod n;
[0013] d2 = (d1 - 1) mod n;
[0014] The first process key d1 and the second process key d2 are stored.
[0015] Optionally, the setting of the size of the preprocessed data pool according to the digital signature service processing amount, and the generation of the preprocessed data pool, comprises:
[0016] The size of the preprocessed data pool is set to m according to the digital signature service processing amount, and the preprocessed data pool [(w1, x1), (w2, x2), …, (w i , x i ), …, (w m , x m )] is generated.
[0017] Optionally, if the preprocessed data amount in the preprocessed data pool is less than the preset percentage, the preset process is repeatedly executed until the preprocessed data amount in the preprocessed data pool is greater than or equal to the preset percentage, comprising:
[0018] If the preprocessed data amount in the preprocessed data pool is less than the preset percentage, the following process is repeatedly executed until the preprocessed data amount in the preprocessed data pool is greater than or equal to the preset percentage:
[0019] A random number k i is generated by using a random number generator;
[0020] A random elliptic curve point (x i , y i ) is calculated, wherein (x i , y i ) = [k i ]G, G is the base point of the elliptic curve;
[0021] A digital signature intermediate value w i is calculated, wherein w i = (d1·ki + d2 · x i ) mod n;
[0022] storing (w i , x i ) into the corresponding positions in the pre-processing data pool.
[0023] Optionally, when the digital signature service invokes the digital signature calculation of the cryptographic device, the fast digital signature is started, a set of pre-processing data is selected from the pre-processing data pool, the corresponding digital signature value is calculated according to the input compressed message, and the digital signature value is output, comprising:
[0024] When the digital signature service invokes the digital signature calculation of the cryptographic device, the fast digital signature is started, a set of pre-processing data (w i , x i ) is selected from the pre-processing data pool;
[0025] According to the input compressed message e, the corresponding digital signature value (r, s) is calculated, wherein the calculation of r and s is as follows:
[0026] r = (e + x i ) mod n;
[0027] s = (w i + d2 · e) mod n;
[0028] The digital signature value (r, s) is output;
[0029] The pre-processing data (w i , x i ) selected from the pre-processing data pool is cleaned up.
[0030] According to another aspect of the present application, a fast digital signature device based on an elliptic curve is provided, comprising:
[0031] A pre-processing data pool generation module is configured to set the size of the pre-processing data pool according to the digital signature service processing capacity after the system initialization of the cryptographic device is completed, and generate the pre-processing data pool;
[0032] A pre-processing data pool processing module is configured to judge whether the pre-processing data amount in the pre-processing data pool is lower than a preset percentage after the cryptographic device is started; if the pre-processing data amount is lower than the preset percentage, a preset process is repeatedly executed until the pre-processing data amount in the pre-processing data pool is greater than or equal to the preset percentage;
[0033] A digital signature calculation module is configured to start the fast digital signature when the digital signature service invokes the digital signature calculation of the cryptographic device, select a set of pre-processing data from the pre-processing data pool, calculate the corresponding digital signature value according to the input compressed message, and output the digital signature value.
[0034] Optionally, the apparatus further comprises a system initialization module configured to:
[0035] calculating a first process key d1 and a second process key d2 according to a signature key d of the cryptographic device; wherein the calculation of d1 and d2 is as follows:
[0036] d1 = ((1+d) -1 )mod n;
[0037] d2 = (d1-1)mod n;
[0038] storing the first process key d1 and the second process key d2.
[0039] Optionally, the pre-processing data pool generation module is configured to:
[0040] setting the size of the pre-processing data pool as m according to the processing amount of the digital signature service, and generating the pre-processing data pool [(w1, x1), (w2, x2), …, (w i , x i ), …, (w m , x m )].
[0041] According to still another aspect of the present application, there is provided a computer readable storage medium storing a computer program for executing the method according to any one of the above aspects of the present application.
[0042] According to still another aspect of the present application, there is provided an electronic device comprising: a processor; a memory for storing executable instructions for the processor; and the processor configured to read the executable instructions from the memory and execute the instructions to implement the method according to any one of the above aspects of the present application.
[0043] The present application simplifies the processing flow of the network service calling the digital signature algorithm and improves the efficiency of the digital signature service by pre-transforming the key form in the SM2 elliptic curve digital signature algorithm and pre-processing some intermediate data in the SM2 elliptic curve digital signature algorithm to form a pre-processing data pool for the final digital signature calculation. Meanwhile, the digital signature result can still be verified by using the original standard digital signature verification algorithm, which does not affect the logical relationship of the upper layer calling of the network service, and realizes transparent transformation and replacement. BRIEF DESCRIPTION OF DRAWINGS
[0044] The exemplary embodiments of the present application can be more completely understood in reference to the following drawings:
[0045] Figure 1is a flowchart of a fast digital signature method based on an elliptic curve provided by an exemplary embodiment of the present application;
[0046] Figure 2 is a flowchart of a fast digital signature method based on an elliptic curve provided by an exemplary embodiment of the present application;
[0047] Figure 3 is a flowchart of a fast digital signature method based on an elliptic curve provided by an exemplary embodiment of the present application;
[0048] Figure 4 is a structure of an electronic device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0049] Hereinafter, exemplary embodiments according to the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part but not all of the embodiments of the present application, and the present application can be implemented in many different ways. Therefore, the contents described herein should be considered as illustrative rather than limiting the present application.
[0050] It should be noted that: unless otherwise specified, the relative arrangement, numerical expression and value of the components and steps set forth in these embodiments do not limit the scope of the present application.
[0051] The purpose of the present application is to provide a more convenient method, summarize the commonly used external interface implementation, integrate the external interface of each function into the same system, and unify the calling mode. In the process of implementing the interface function, after configuring the related information of the interface in the integrated interface system, the developer does not need to care about the calling mode of each interface, only needs to care about the implementation of the business function other than the interface function, decouples the interface implementation part into a separate function system, which is beneficial to the later maintenance of the project.
[0052] The present application optimizes the existing digital signature algorithm by using pre-computation, pre-storage and multi-flow, etc. The processing bottleneck caused by traditional single-flow processing is solved, and the calculation processing efficiency can be improved by more than 80%.
[0053] Figure 1 A flowchart of a fast digital signature method based on an elliptic curve provided by the present application is shown. As shown in Figure 1 The fast digital signature method based on an elliptic curve includes:
[0054] Step S101: After completing the system initialization of the cryptographic device, the size of the pre-processing data pool is set according to the digital signature business processing amount, and the pre-processing data pool is generated;
[0055] Optionally, before setting the size of the pre-processing data pool according to the digital signature service processing amount, the cryptographic device is system initialized by the following steps: when the cryptographic device is powered on, a first process key d1 and a second process key d2 are calculated according to a signature key d of the cryptographic device; wherein d1 and d2 are calculated as follows:
[0056] d1 = ((1 + d) -1 ) mod n;
[0057] d2 = (d1 - 1) mod n;
[0058] The first process key d1 and the second process key d2 are stored.
[0059] Optionally, the setting of the size of the pre-processing data pool according to the digital signature service processing amount and the generation of the pre-processing data pool include: setting the size of the pre-processing data pool to m according to the digital signature service processing amount, and generating the pre-processing data pool [(w1, x1), (w2, x2), …, (w i , x i ), …, (w m , x m )].
[0060] In the embodiment of the application, the fast digital signature method includes three processes: system initialization, pre-processing data generation, and fast digital signature. The system initialization process is only executed once when the cryptographic device is powered on; the pre-processing data generation process is executed by a separate program flow at the idle time of the device after the cryptographic device is started, or a separate calculation processing unit is used to maintain a pre-processing data pool, and the data in the pre-processing data pool needs to be kept in a full pool state of more than 80% at all times; and the fast digital signature process is triggered to be executed according to the use requirement of the service to generate a digital signature result value required by the service.
[0061] The digital signature algorithm in the application adopts the SM2 elliptic curve digital signature algorithm specified by the State Cryptography Administration, and can refer to the standard “SM2 Elliptic Curve Public Key Cryptography Algorithm” (GM / T 0003-2012) for details. Let the elliptic curve be E(F q ), the base point be G = (x G , y G ), and the order be n. The private key of the signature calculator is d, and the public key is P = [d]G.
[0062] According to the “SM2 Elliptic Curve Public Key Cryptography Algorithm” standard, the input value of the digital signature is the compressed message e, and the output is the digital signature value (r, s). Wherein:
[0063] r = (e + x) mod n
[0064] (x, y) = [k]G k e [1, n-1] is a random number generated by a random number generator.
[0065] s = ((1 + d) -1 · (k - r · d)) mod n
[0066] The calculation of the above s can be transformed as follows:
[0067] s = ((1 + d) -1 · (k + r) - r) mod n
[0068] Let d1 = ((1 + d) -1 ) mod n, then
[0069] s = (d1 · (k + r) - r) mod n
[0070] = (d1 · (k + e + x) - e - x) mod n
[0071] = (d1 · k + (d1 - 1) · e + (d1 - 1) · x) mod n
[0072] Let d2 = (d1 - 1) mod n, then
[0073] s = (d1 · k + d2 · x + d2 · e) mod n
[0074] According to the above calculation rule, when the cryptographic device is powered on, the system initialization process is as follows:
[0075] 1) According to the signature key d, the process keys d1 and d2 are calculated. The calculation method is as follows:
[0076] d1 = ((1 + d) -1 ) mod n, d2 = (d1 - 1) mod n
[0077] 2) Save the process keys d1 and d2.
[0078] According to the digital signature business processing amount, set the size of the pre-processing data pool to m, and generate the pre-processing data pool
[0079] [(w1, x1), (w2, x2), …, (w i , x i ), …, (w m , x m )]
[0080] Step S102: After the cryptographic device is started, it is judged whether the pre-processing data amount in the pre-processing data pool is lower than the preset percentage; if it is lower than the preset percentage, the preset process is repeatedly executed until the pre-processing data amount in the pre-processing data pool is greater than or equal to the preset percentage;
[0081] Optionally, the repeatedly performing the preset procedure until the amount of pre-processing data in the pre-processing data pool is greater than or equal to the preset percentage if the amount of pre-processing data is less than the preset percentage comprises: repeatedly performing the following procedure until the amount of pre-processing data in the pre-processing data pool is greater than or equal to the preset percentage if the amount of pre-processing data is less than the preset percentage: generating a random number k using a random number generator i ; calculating a random elliptic curve point (x i , y i ), where (x i , y i ) = [k i ]G, G is a base point of the elliptic curve; calculating a digital signature intermediate value w i , where w i = (d1·k i +d2·x i ) mod n; and storing (w i , x i ) in a corresponding position in the pre-processing data pool.
[0082] In the embodiment of the present application, the pre-processing data generation process needs to determine whether the amount of data in the pre-processing data pool is less than 80%. If it is less than 80%, the following procedure needs to be repeatedly performed to fill the pre-processing data pool.
[0083] 1) generating a random number k i using a random number generator, where k i ∈[1, n-1].
[0084] 2) calculating a random elliptic curve point (x i , y i ) = [k i ]G.
[0085] 3) calculating a digital signature intermediate value w i = (d1·k i +d2·x i ) mod n.
[0086] 4) storing (w i , x i ) in a corresponding position in the pre-processing data pool.
[0087] Step S103: when the digital signature service calls the digital signature calculation of the cryptographic device, starting the fast digital signature, selecting a set of pre-processing data from the pre-processing data pool, calculating the corresponding digital signature value according to the input compressed message, and outputting the digital signature value.
[0088] Optionally, when the digital signature service calls the digital signature calculation of the cryptographic device, the fast digital signature is started, a set of preprocessed data is selected from the preprocessed data pool, the corresponding digital signature value is calculated according to the input compressed message, and the digital signature value is output, comprising: when the digital signature service calls the digital signature calculation of the cryptographic device, the fast digital signature is started, a set of preprocessed data (w i , x i ) is selected from the preprocessed data pool; the corresponding digital signature value (r, s) is calculated according to the input compressed message e, wherein the calculation method of r and s is as follows:
[0089] r = (e + x i ) mod n;
[0090] s = (w i + d2·e) mod n;
[0091] The digital signature value (r, s) is output; and the preprocessed data (w i , x i ) selected from the preprocessed data pool is cleaned up.
[0092] In the embodiment of the application, when the network service calls the digital signature calculation, the fast digital signature is started, and the specific process is as follows:
[0093] 1) a set of preprocessed data (w i , x i ) is selected from the preprocessed data pool.
[0094] 2) the signature value is calculated according to the input compressed message e, and the calculation method is as follows:
[0095] r = (e + x i ) mod n
[0096] s = (w i + d2·e) mod n
[0097] 3) the digital signature value (r, s) is output.
[0098] Based on the above principle, the method of the application will be specifically described below in combination with specific embodiments and Figure 2 .
[0099] 1. System initialization
[0100] 1.1 When the device is powered on, the process keys d1 and d2 are calculated according to the signature key d, and the calculation method is as follows:
[0101] d1 = ((1 + d) -1 ) mod n, d2 = (d1 - 1) mod n
[0102] 1.2 Save the process keys d1 and d2.
[0103] 2. Pre-process data generation
[0104] 2.1. Detect if the amount of data in the pre-process data pool exceeds 80%. If not, proceed to the next step, otherwise continue to detect after a set time period.
[0105] 2.2. Generate a random number k using a random number generator i , k i ∈[1, n-1].
[0106] 2.3. Calculate the random elliptic curve point (x i , y i ) = [k i ]G.
[0107] 2.4. Calculate the digital signature intermediate value w i = (d1·k i +d2·x i ) mod n.
[0108] 2.5. Store (w i , x i ) in the pre-process data pool in the corresponding position.
[0109] 2.6. Return to step 2.1.
[0110] 3. Digital signature
[0111] 3.1. Wait for a service call for digital signature. If there is a call, proceed to the next step.
[0112] 3.2. Select a set of pre-process data (w i , x i ) from the pre-process data pool.
[0113] 3.3. Calculate the signature value according to the input compressed message e, the calculation method is as follows:
[0114] r = (e + x i ) mod n
[0115] s = (w i +d2·e) mod n
[0116] 3.4. Output the digital signature value (r, s).
[0117] 3.5. Clean up the data (w i , x i ) in the pre-process data pool.
[0118] 3.6. Return to 3.1.
[0119] Through the above process, the digital signature preprocessing when the device is powered on can be completed, and the digital signature preprocessing data is generated, so that the business can achieve fast digital signature execution when calling the digital signature, save the business digital signature processing time, and improve the business digital signature processing efficiency.
[0120] In summary, the present application simplifies the processing flow of the network service calling the digital signature algorithm and improves the efficiency of the digital signature service by pre-transforming the key form in the SM2 elliptic curve digital signature algorithm and pre-processing some intermediate data in the SM2 elliptic curve digital signature algorithm to form a preprocessing data pool for the final digital signature calculation. At the same time, the digital signature result can still be verified by the original standard digital signature verification algorithm, which does not affect the logical relationship of the upper layer calling of the network service, and realizes transparent transformation and replacement.
[0121] The implementation of the above technical solution can achieve the beneficial effects of the present application: by using the elliptic curve fast digital signature method of the present application, the traditional SM2 elliptic curve-based digital signature method can be simplified from generating one random number, one elliptic curve point multiplication operation, one multiplication inverse operation, two multiplication operations, and three addition operations to one multiplication operation and two addition operations, and the digital signature calculation efficiency can be improved by more than 80%, which can effectively solve the performance processing bottleneck problem of the existing digital signature device and meet the demand of the network service mass digital signature application scenario. At the same time, the present application can keep the digital signature output result and structure unchanged, and still use the original standard digital signature verification method for verification, and use the method without changing the upper layer business logic.
[0122] Exemplary apparatus
[0123] Figure 3 is a structural schematic diagram of an elliptic curve-based fast digital signature device provided by an exemplary embodiment of the present application. As shown in Figure 3 The device 300 includes:
[0124] The preprocessing data pool generation module 310 is configured to set the size of the preprocessing data pool according to the digital signature business processing amount after completing the system initialization of the cryptographic device, and generate the preprocessing data pool.
[0125] The preprocessing data pool processing module 320 is configured to judge whether the amount of preprocessing data in the preprocessing data pool is lower than a preset percentage after the cryptographic device is started, and if the amount of preprocessing data is lower than the preset percentage, repeatedly execute the preset process until the amount of preprocessing data in the preprocessing data pool is greater than or equal to the preset percentage.
[0126] The digital signature calculation module 330 is configured to start the fast digital signature when the digital signature service calls the digital signature calculation of the cryptographic device, select a set of preprocessed data from the preprocessed data pool, calculate the corresponding digital signature value according to the input compressed message, and output the digital signature value.
[0127] Optionally, the apparatus further comprises a system initialization module configured to:
[0128] When the cryptographic device is powered on, a first process key d1 and a second process key d2 are calculated according to a signature key d of the cryptographic device; wherein the calculation method of d1 and d2 is as follows:
[0129] d1=((1+d) -1 )modn;
[0130] d2=(d1-1)modn;
[0131] The first process key d1 and the second process key d2 are stored.
[0132] Optionally, the preprocessed data pool generation module is specifically configured to:
[0133] The size of the preprocessed data pool is set to m according to the digital signature service processing capacity, and the preprocessed data pool [(w1, x1), (w2, x2), …, (w i , x i ), …, (w m , x m )] is generated.
[0134] The fast digital signature device based on an elliptic curve of the embodiment of the application corresponds to the fast digital signature method based on an elliptic curve of another embodiment of the application, and will not be described here.
[0135] Exemplary electronic device
[0136] Figure 4 is the structure of an electronic device provided by an exemplary embodiment of the application. As shown in Figure 4 , the electronic device 40 includes one or more processors 41 and a memory 42.
[0137] The processor 41 can be a central processing unit (CPU) or other forms of processing units with data processing capability and / or instruction execution capability, and can control other components in the electronic device to perform desired functions.
[0138] The memory 42 can include one or more computer program products that can include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory, for example, can include random access memory (RAM), cache memory, and / or the like. The non-volatile memory, for example, can include read only memory (ROM), hard disk, flash memory, and / or the like. One or more computer program instructions can be stored on the computer-readable storage media, and the processor 41 can execute the program instructions to implement the method of information mining on the history change record of the software program of the various embodiments of the present application and / or other desired functions described above. In one example, the electronic device can further include an input device 43 and an output device 44, which are interconnected through a bus system and / or other forms of connection mechanism (not shown).
[0139] In addition, the input device 43 can further include, for example, a keyboard, a mouse, and / or the like.
[0140] The output device 44 can output various information to the outside. The output device 44 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and / or the like.
[0141] Of course, in order to simplify, Figure 4 Only some of the components of the electronic device related to the present application are shown in FIG. 1, and components such as a bus, an input / output interface, and / or the like are omitted. In addition, the electronic device can further include any other appropriate components according to a specific application.
[0142] Exemplary computer program product and computer readable storage medium
[0143] In addition to the above-mentioned method and device, embodiments of the present application can also be a computer program product including computer program instructions that, when executed by a processor, cause the processor to perform the steps of the method according to various embodiments of the present application described in the above "Exemplary Method" section of the specification.
[0144] The computer program product can be written in any combination of one or more programming languages, including an object-oriented programming language such as Java, C++, and / or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0145] In addition, an embodiment of the present application can also be a computer-readable storage medium, having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the method described in the above “Exemplary Method” section of the specification for information mining on historical change records according to various embodiments of the present application.
[0146] The computer-readable storage medium can take the form of one or more combinations of any type of computer-readable media. The computer-readable media can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, system, or device, or any suitable combination of the above. More specific examples (a non-exhaustive list) of the computer-readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0147] The above describes the basic principles of the present application in combination with specific embodiments, but it should be noted that the advantages, benefits, effects, etc. mentioned in the present application are only examples and are not limiting, and these advantages, benefits, effects, etc. cannot be considered as necessary for each embodiment of the present application. In addition, the above specific details are only for the purpose of example and for the purpose of understanding, and the above details do not limit the present application to the above specific details.
[0148] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts of each embodiment can be understood by mutual reference. For system embodiments, since they basically correspond to method embodiments, the description is relatively simple, and the relevant parts can be understood by referring to the part of the method embodiment.
[0149] The block diagrams of the devices, systems, apparatuses, systems involved in the present application are only illustrative examples and are not intended to require or imply that the connections, arrangements, configurations must be as shown in the block diagrams. As those skilled in the art will recognize, these devices, systems, apparatuses, systems can be connected, arranged, configured in any manner. Words such as “include”, “contain”, “have” are open-ended words, mean “include but not limited to”, and can be used interchangeably. The words “or” and “and” used herein mean the word “and / or”, and can be used interchangeably unless the context clearly indicates otherwise. The word “such as” used herein means the phrase “such as but not limited to”, and can be used interchangeably.
[0150] The methods and systems of the present application can be implemented in a number of ways. For example, the methods and systems of the present application can be implemented via software, hardware, firmware, or any combination of software, hardware, and firmware. The above described order of steps for the methods is merely illustrative, and the steps of the methods of the present application are not limited to the order specifically described above unless otherwise specifically stated. Furthermore, in some embodiments, the present application can also be implemented as a program recorded on a recording medium, which includes machine readable instructions for implementing the methods according to the present application. Thus, the present application also covers recording media storing programs for executing the methods according to the present application.
[0151] It is also important to note that the systems, devices and methods of the present application can be embodied in a variety of forms without departing from the spirit or essential characteristics thereof. Thus, the above description is intended to be illustrative, but not restrictive. Further, the intention is not to limit the application to the aspects disclosed, but to cover all modifications and equivalents falling within the scope of the application. Changes can be made to the application in light of the above description. The scope of the application should, therefore, be determined not with reference to the above description, but should instead be determined with reference to the appended claims, along with their full scope of equivalents.
[0152] The above description is intended to be illustrative, and not restrictive. For the purpose of illustration, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be practiced without these specific details. In other instances, well-known methods, procedures, components, and networks have not been described in detail as not to unnecessarily obscure aspects of the present application.
Claims
1. A fast digital signature method based on elliptic curves, characterized in that, include: After completing the system initialization of the cryptographic device, the size of the preprocessing data pool is set according to the digital signature business processing volume, and the preprocessing data pool is generated. After the cryptographic device is started, it is determined whether the amount of preprocessed data in the preprocessed data pool is lower than a preset percentage; If the amount of preprocessed data in the preprocessed data pool is less than or equal to the preset percentage, the preset process will be executed repeatedly until the amount of preprocessed data in the preprocessed data pool is greater than or equal to the preset percentage. When the digital signature service calls the cryptographic device to calculate the digital signature, it initiates fast digital signature, selects a set of preprocessed data from the preprocessed data pool, calculates the corresponding digital signature value based on the input compressed message, and outputs the digital signature value. Before setting the size of the preprocessing data pool according to the digital signature business volume, the cryptographic device should be initialized by following these steps: Calculate the first process key d1 and the second process key d2 based on the signature key d of the cryptographic device; The calculation methods for d1 and d2 are as follows: d1=((1+d) -1 )modern; d2 = (d1-1) mod n; Store the first process key d1 and the second process key d2, where n is the order; The step of setting the size of the preprocessing data pool according to the digital signature business processing volume and generating the preprocessing data pool includes: Based on the digital signature business processing volume, the size of the preprocessing data pool is set to m, and a preprocessing data pool [(w1,x1),(w2,x2),…,(w...] is generated. i ,x i ),…,(w m ,x m )]; If the amount of preprocessed data in the preprocessed data pool is less than or equal to a preset percentage, the preset process is repeatedly executed until the amount of preprocessed data in the preprocessed data pool is greater than or equal to the preset percentage, including: If the amount of preprocessed data in the preprocessed data pool is lower than or equal to the preset percentage, repeat the following process until the amount of preprocessed data in the preprocessed data pool is greater than or equal to the preset percentage: Use a random number generator to generate a random number k. i ; Calculate random elliptic curve points (x i ,y i ), where (x i ,y i )=[k i G, where G is the base point of the elliptic curve; Calculate the intermediate value w of the digital signature i , where w i =(d1·k i +d2·x i )modn; Storage (w) i ,x i ) to the corresponding location in the preprocessed data pool.
2. The method according to claim 1, characterized in that, When the digital signature service calls the cryptographic device to perform digital signature calculation, it initiates fast digital signature, selects a set of preprocessed data from the preprocessed data pool, calculates the corresponding digital signature value based on the input compressed message, and outputs the digital signature value, including: When the digital signature service calls the cryptographic device for digital signature calculation, it initiates fast digital signature and selects a set of preprocessed data (w) from the preprocessed data pool. i ,x i ); Based on the input compressed message e, calculate the corresponding digital signature value (r, s), where r and s are calculated as follows: r=(e+x i )modern; s=(w i +d2·e)modn; Output the digital signature value (r, s); Clean the preprocessed data selected from the preprocessed data pool (w i ,x i ).
3. A fast digital signature device based on elliptic curves, characterized in that, include: The preprocessing data pool generation module is used to generate the preprocessing data pool after the system initialization of the cryptographic device is completed, based on the digital signature business processing volume. The preprocessing data pool processing module is used to determine whether the amount of preprocessed data in the preprocessing data pool is lower than a preset percentage after the cryptographic device is started. If the amount of preprocessed data in the preprocessed data pool is less than or equal to the preset percentage, the preset process will be executed repeatedly until the amount of preprocessed data in the preprocessed data pool is greater than or equal to the preset percentage. The digital signature calculation module is used to initiate fast digital signature calculation when the digital signature service calls the cryptographic device to calculate the digital signature value. It selects a set of preprocessed data from the preprocessed data pool, calculates the corresponding digital signature value based on the input compressed message, and outputs the digital signature value. It also includes a system initialization module, used for: Calculate the first process key d1 and the second process key d2 based on the signature key d of the cryptographic device; The calculation methods for d1 and d2 are as follows: d1=((1+d) -1 )modern; d2 = (d1-1) mod n; Store the first process key d1 and the second process key d2, where n is the order; The preprocessed data pool generation module is specifically used for: Based on the digital signature business processing volume, the size of the preprocessing data pool is set to m, and a preprocessing data pool [(w1,x1),(w2,x2),…,(w...] is generated. i ,x i ),…,(w m ,x m )]; If the amount of preprocessed data in the preprocessed data pool is less than or equal to a preset percentage, the preset process is repeatedly executed until the amount of preprocessed data in the preprocessed data pool is greater than or equal to the preset percentage, including: If the amount of preprocessed data in the preprocessed data pool is lower than or equal to the preset percentage, repeat the following process until the amount of preprocessed data in the preprocessed data pool is greater than or equal to the preset percentage: Use a random number generator to generate a random number k. i ; Calculate random elliptic curve points (x i ,y i ), where (x i ,y i )=[k i G, where G is the base point of the elliptic curve; Calculate the intermediate value w of the digital signature i , where w i =(d1·k i +d2·x i )modn; Storage (w) i ,x i ) to the corresponding location in the preprocessed data pool.
4. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for performing the method described in any one of claims 1-2.
5. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1-2.
Citation Information
Patent Citations
Digital signature quick generation method of SM2 public key cryptography
CN109660351A
Digital signature method and device, storage medium and electronic equipment
CN116996233A