Method and apparatus for identifying digital signature of cryptographic algorithm in embedded system

By optimizing the digital signature process of the identifier cryptography algorithm in an embedded system, and utilizing the processor and elliptic curve operation coprocessor for linear pair pre-computation and modular exponentiation, the problem of excessive computation time of the identifier cryptography algorithm is solved, thereby improving computational efficiency and signature speed.

CN123055302APending Publication Date: 2026-11-06BEIJING HONGSI ELECTRONICS TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611344649.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-01
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

In embedded systems, the digital signature operation of the identifier cryptographic algorithm takes too long and has low computational efficiency, which cannot meet the requirements of high-efficiency computing.

Method used

By using a processor, random number generator, and elliptic curve operation coprocessor in an embedded system, linear optimization and modular exponentiation of pre-computed values ​​are performed, combined with SM3 cryptographic hashing, thus shortening computation time and improving computational efficiency.

Benefits of technology

By reusing pre-computed values ​​and optimizing the computation process, the digital signature time of the identifier cryptographic algorithm is significantly shortened, and the signature rate and computational performance are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123055302A_ABST
    Figure CN123055302A_ABST
Patent Text Reader

Abstract

The application discloses a method and device for identifying a password algorithm digital signature in an embedded system, and relates to the field of information security. The method comprises the following steps: obtaining to-be-signed data, reading a linear pair pre-computation value; checking the current linear pair pre-computation value, if the current linear pair pre-computation value is unavailable, performing linear pair pre-computation according to a preset generator and a system signature master public key, and updating the current linear pair pre-computation value; generating a first random number, calculating first signature data according to the first random number, the current linear pair pre-computation value and the to-be-signed data; calculating second signature data according to a signature private key, the first random number and the first signature data, and outputting the first signature data and the second signature data as a digital signature. The technical scheme of the application is applied to a digital signature based on an identity password algorithm, and the efficiency is improved by pre-computing key steps and reusing pre-computation values.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information security technology, and in particular to a method and apparatus for digital signature using an identifier cryptographic algorithm in an embedded system. Background Technology

[0002] Digital signatures are a technology used to ensure the integrity, authenticity, and non-repudiation of digital information. Typically, a digital signature is generated by the sender using their private key to create a specific signature value for the message, which is then sent to the recipient along with the message. The recipient can use the sender's public key to verify the signature value, thereby determining the authenticity and integrity of the message.

[0003] The concept of Identity Cryptography (IKE) was proposed in 1984. In an identity cryptographic system, a user's private key is calculated by a key generation center based on the master key and the user's identifier, and the user's public key is uniquely identified by the user's identifier. Therefore, users do not need a third party to guarantee the authenticity of their public key. Compared to public-key cryptography systems based on digital certificates, key management in identity cryptography systems can be appropriately simplified. The SM9 algorithm is a standardized identity cryptographic algorithm. However, compared to other elliptic curve cryptography algorithms (such as the SM2 algorithm), identity cryptography involves a huge amount of computation, requiring significantly more time to compute digital signatures. Therefore, reducing computation time and improving efficiency have become key issues in optimizing the performance of digital signature computation based on identity cryptographic algorithms. Summary of the Invention

[0004] The purpose of this application is to overcome the shortcomings of the prior art and provide a method and apparatus for efficiently calculating digital signatures based on identifier cryptography algorithms in embedded systems.

[0005] In a first aspect, this application provides a method for calculating digital signatures based on an identifier cryptography algorithm in an embedded system, running in an embedded system including a processor, a random number generator, a storage module, and an elliptic curve operation coprocessor. The method includes:

[0006] Step A1: The processor obtains the data to be signed and reads the pre-calculated linear pair value from the storage module;

[0007] Step A2: The processor checks the current pre-calculated value of the linear pair. If the current pre-calculated value of the linear pair is unavailable, it controls the elliptic curve operation coprocessor to perform linear pair pre-calculation based on the preset generator and the system signature master public key, and updates the current pre-calculated value of the linear pair using the calculation result.

[0008] Furthermore, after updating the current linear pair pre-calculated value using the calculation result, the method further includes: saving the current linear pair pre-calculated value to the storage module.

[0009] Step A3: The processor controls the random number generator to generate a first random number;

[0010] Furthermore, step A3 also includes: the processor checking whether the first random number is available. If the first random number is unavailable, the processor controls the random number generator to regenerate it.

[0011] Step A4: The processor uses the first random number as the exponent to perform modular exponentiation on each unit of the current linear pair pre-calculated value, and calculates the first signature data based on the result of the modular exponentiation and the data to be signed;

[0012] Furthermore, the step of calculating the first signature data based on the result of the modular exponentiation and the data to be signed includes:

[0013] Step A4-1: The processor sequentially concatenates the first preset data, the data to be signed, and the result of the modular exponentiation to obtain the first intermediate data;

[0014] Step A4-2: The processor sequentially concatenates the first intermediate data and the second preset data, and performs SM3 cryptographic hash operation on the concatenation result;

[0015] Step A4-3: The processor sequentially concatenates the first intermediate data and the third preset data, and performs SM3 cryptographic hash operation on the concatenation result;

[0016] Step A4-4: The processor sequentially concatenates the SM3 cryptographic hash operation results of steps A4-2 and A4-3, and obtains the first signature data based on the concatenation result and the fifth preset parameter.

[0017] Step A5: The processor reads the signing private key from the storage module, calculates the second signature data based on the signing private key, the first random number, and the first signature data, and outputs the first signature data and the second signature data as a digital signature, and then ends.

[0018] Further, the step of calculating the second signature data based on the signing private key, the first random number, and the first signature data includes:

[0019] Step A5-1: The processor calculates the elliptic curve dot product scalar based on the first random number and the first signature data;

[0020] Step A5-2: The processor reads the signature private key from the storage module, controls the elliptic curve operation coprocessor to perform elliptic curve multiplication by a scalar multiplication of the elliptic curve as a multiple, and obtains the second signature data. The first signature data and the second signature data are then output as a digital signature, and the process ends.

[0021] Furthermore, controlling the elliptic curve computation coprocessor to perform linear pair pre-computation based on preset generators and the system signature master public key includes:

[0022] Step B1: The processor sets the initial value of the first register according to the system signature master public key;

[0023] Step B2: The processor sets the initial value of the second register, traverses the first preset parameters, and updates the values ​​of the first register and the second register according to the current value of the first register, the preset generator, and the system signature master public key;

[0024] Furthermore, the step of traversing the first preset parameters and updating the value of the second register according to the preset generator and the system signature master public key specifically includes:

[0025] Step B2-1: The processor controls the elliptic curve operation coprocessor to perform line function point multiplication operation based on the preset generator and the current value of the first register, and stores the operation result in the third register;

[0026] Step B2-2: The processor controls the elliptic curve operation coprocessor to perform elliptic curve point multiplication operation based on the current value of the first register, and updates the value of the first register with the operation result;

[0027] Step B2-3: The processor traverses each memory cell of the second register, performs modular exponentiation based on the current value of each memory cell, and updates the value of each memory cell using the calculation result;

[0028] Step B2-4: The processor traverses each storage unit of the second register, performs a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and updates the value of each storage unit of the second register with the calculation result;

[0029] Step B2-5: The processor determines whether the bit currently traversed in the first preset parameter is 1. If yes, it executes step B2-6; otherwise, it executes step B2-9.

[0030] Step B2-6: The processor controls the elliptic curve operation coprocessor to perform a line function point addition operation based on the current value of the first register, the system signature master public key, and the preset generator, and stores the operation result in the third register;

[0031] Step B2-7: The processor controls the elliptic curve arithmetic coprocessor to perform elliptic curve point addition operation with the system signature master public key based on the current value of the first register, and updates the value of the first register with the operation result;

[0032] Step B2-8: The processor traverses each storage unit of the second register, performs a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and updates the value of each storage unit of the second register with the calculation result;

[0033] Step B2-9: The processor determines whether the traversal of the first preset parameters is complete. If yes, it executes step B3; otherwise, it returns to step B2-1.

[0034] Step B3: The processor performs modular exponentiation on each component of the system signature master public key according to the second preset parameters, and saves the result in the fourth register;

[0035] Step B4: The processor performs a modular multiplication operation based on the third preset parameter and the current value of the fourth register, and updates the value of the fourth register using the operation result;

[0036] Step B5: The processor performs modular multiplication on each component of the system signature master public key according to the third preset parameter, and stores the result in the fifth register;

[0037] Step B6: The processor controls the elliptic curve arithmetic coprocessor to perform a second extended-domain point addition operation based on the current value of the first register and the current value of the fourth register, and updates the value of the first register based on the operation result;

[0038] Step B7: The processor controls the elliptic curve operation coprocessor to perform a line function point addition operation based on the current value of the first register, the current value of the fourth register, and the preset generator, and stores the operation result in the third register;

[0039] Step B8: The processor traverses each storage unit of the second register, performs a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and updates the value of each storage unit of the second register with the calculation result;

[0040] Step B9: The processor controls the elliptic curve arithmetic coprocessor to perform a second extended-domain point addition operation based on the current value of the first register and the current value of the fifth register, and updates the value of the first register based on the operation result;

[0041] Step B10: The processor controls the elliptic curve operation coprocessor to perform a point addition operation of the line function based on the current value of the first register, the current value of the fifth register, and the preset generator, and stores the operation result in the third register;

[0042] Step B11: The processor traverses each storage unit of the second register, performs a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and updates the value of each storage unit of the second register with the calculation result;

[0043] Step B12: The processor traverses each storage unit of the second register and performs modular exponentiation based on the current value of each storage unit and the fourth preset parameter to obtain the pre-calculated value of the linear pair.

[0044] Secondly, based on the technical solution of the digital signature method using an identifier cryptographic algorithm in an embedded system provided in this application, a corresponding implementation device for a digital signature using an identifier cryptographic algorithm in an embedded system is provided. This device operates in an embedded system comprising a processor, a random number generator, a storage module, and an elliptic curve operation coprocessor. The device is disposed within the processor and includes:

[0045] The first processing module is used to obtain the data to be signed and read the current linear pair pre-calculated value from the storage module;

[0046] The second processing module is used to check the current pre-calculated value of the linear pair. If the current pre-calculated value of the linear pair is unavailable, it reads the preset generator and the system signature master public key from the storage module, controls the elliptic curve operation coprocessor to perform linear pair pre-calculation according to the preset generator and the system signature master public key, and updates the current pre-calculated value of the linear pair using the calculation result.

[0047] The third processing module is used to control the random number generator to generate the first random number.

[0048] Furthermore, the third processing module also includes a first judgment unit, used to determine whether the first random number generated by the random number generator is available.

[0049] The fourth processing module is used to perform a modular exponentiation operation on the current linear pair pre-calculated value using the first random number, and calculate the first signature data based on the result of the modular exponentiation operation and the data to be signed;

[0050] The fifth processing module is used to read the signing private key from the storage module, calculate the second signature data using the signing private key, the first random number and the first signature data, and output the first signature data and the second signature data as a digital signature.

[0051] Furthermore, the second processing module also includes a linear pair pre-computation submodule, used to perform linear pair pre-computation based on a preset generator and the system signature master public key, including:

[0052] The first processing unit is configured to set the initial value of the first register according to the system signature master public key;

[0053] The second processing unit is used to set the initial value of the second register, traverse the first preset parameters, and control the elliptic curve operation coprocessor to update the values ​​of the first register and the second register according to the current value of the first register, the preset generator, and the system signature master public key;

[0054] The third processing unit is used to perform modular exponentiation on each component of the system signature master public key according to the second preset parameters, and save the result in the fourth register.

[0055] The fourth processing unit is used to perform modular multiplication based on the third preset parameter and the current value of the fourth register, and update the value of the fourth register using the result of the operation;

[0056] The fifth processing unit is used to perform modular multiplication on each component of the system signature master public key according to the third preset parameters, and store the operation result in the fifth register.

[0057] The sixth processing unit is used to control the elliptic curve operation coprocessor to perform a second extended field point addition operation based on the current value of the first register and the current value of the fourth register, and to update the value of the first register based on the operation result;

[0058] The seventh processing unit is used to control the elliptic curve operation coprocessor to perform line function point addition operation based on the current value of the first register, the current value of the fourth register and the preset generator, and store the operation result in the third register;

[0059] The eighth processing unit is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register using the calculation result;

[0060] The ninth processing unit is used to control the elliptic curve operation coprocessor to perform a second expansion field point addition operation based on the current value of the first register and the current value of the fifth register, and to update the value of the first register based on the operation result;

[0061] The tenth processing unit is used to control the elliptic curve operation coprocessor to perform line function point addition operation based on the current value of the first register, the current value of the fifth register and the preset generator, and store the operation result in the third register;

[0062] The eleventh processing unit is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register using the calculation result.

[0063] The twelfth processing unit is used to traverse each storage unit of the second register, perform modular exponentiation based on the current value of each storage unit and the fourth preset parameter, and obtain the linear pair pre-calculated value.

[0064] Further, the second processing unit includes:

[0065] The first processing subunit is used to control the elliptic curve operation coprocessor to perform line function point multiplication operation based on the preset generator and the current value of the first register, and store the operation result in the third register;

[0066] The second processing subunit is used to control the elliptic curve operation coprocessor to perform elliptic curve point multiplication operation based on the current value of the first register, and update the value of the first register with the operation result.

[0067] The third processing subunit is used to traverse each storage unit of the second register, perform modular exponentiation based on the current value of each storage unit, and update the value of each storage unit using the calculation result;

[0068] The fourth processing subunit is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register using the calculation result;

[0069] The fifth processing subunit is used to determine whether the bit currently being traversed by the first preset parameter is 1;

[0070] The sixth processing subunit is used to control the elliptic curve operation coprocessor to perform line function point addition operation based on the current value of the first register, the system signature master public key, and the preset generator, and store the operation result in the third register;

[0071] The seventh processing subunit is used to control the elliptic curve operation coprocessor to perform elliptic curve point addition operation with the system signature master public key based on the current value of the first register, and update the value of the first register with the operation result;

[0072] The eighth processing subunit is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register using the calculation result;

[0073] The ninth processing subunit is used to determine whether the traversal of the first preset parameter is complete.

[0074] Furthermore, the fourth processing module includes:

[0075] First processing unit: used to perform modular exponentiation on each unit of the current linear pair pre-calculated value using the first random number as the exponent;

[0076] The second processing unit is used to sequentially concatenate the first preset data, the data to be signed, and the result of the modular exponentiation to obtain the first intermediate data;

[0077] The third processing unit is used to sequentially concatenate the first intermediate data and the second preset data, and perform SM3 cryptographic hash operation on the concatenation result.

[0078] The fourth processing unit is used to concatenate the first intermediate data and the third preset data, and perform SM3 cryptographic hash operation on the concatenation result;

[0079] The fifth processing unit is used to sequentially concatenate the calculation results of the third processing unit and the calculation results of the fourth processing unit, and obtain the first signature data based on the concatenation result and the fifth preset parameter;

[0080] Furthermore, the fifth processing module includes:

[0081] The first processing unit is used to calculate the elliptic curve dot product scalar based on the first random number and the first signature data.

[0082] The second processing unit is used to read the signature private key from the storage module, control the elliptic curve operation coprocessor to perform elliptic curve multiplication by a scalar multiplication of the elliptic curve as a multiple, and obtain the second signature data based on the signature private key.

[0083] By employing the above-described technical solution, the technical solution provided in this application has at least the following advantages:

[0084] In this application, by using linear pair pre-computed values ​​(which can be reused in multiple digital signature processes), the computation time for calculating digital signatures based on the identifier cryptography algorithm is shortened, effectively improving the digital signature rate based on the identifier cryptography algorithm and optimizing performance. Attached Figure Description

[0085] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings.

[0086] Figure 1 is a flowchart of a method for linear pair pre-calculation based on a preset generator and the system signature master public key in a method for calculating digital signatures based on an identifier cryptography algorithm in an embedded system, according to Embodiment 1 of the present invention.

[0087] Figure 2 is a flowchart of the method provided in Embodiment 1 of the present invention, which involves traversing the first preset parameters and updating the values ​​of the first register and the second register according to the current value of the first register, the preset generator and the system signature master public key;

[0088] Figure 3 is a flowchart of a method for calculating digital signatures based on an identifier cryptography algorithm in an embedded system according to Embodiment 2 of the present invention;

[0089] Figure 4 is a schematic diagram of the structure of an implementation device for digital signature of an identifier cryptographic algorithm in an embedded system provided in Embodiment 3 of the present invention.

[0090] Figure 5 is a schematic diagram of the linear pair pre-computation submodule structure in the device provided in Embodiment 3 of the present invention. Detailed Implementation

[0091] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings. The same or similar reference numerals are used throughout to denote the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.

[0092] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.

[0093] Those skilled in the art will understand that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0094] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0095] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention.

[0096] Example 1

[0097] This embodiment provides a method for calculating digital signatures based on an identifier cryptography algorithm in an embedded system, specifically a method for linear pair pre-calculation based on a preset generator and the system signature master public key, running in an embedded system that includes a processor, a random number generator, a storage module, and an elliptic curve operation coprocessor. Figure 1 As shown.

[0098] The cryptographic industry standard GM / T 0080 describes the principle of preprocessing operation 'e', ​​using a public key and... , Two public points and Able to calculate bilinear pairs and . and Both involve 12 expansions. Multiplication cyclic group (denoted as) The elements in ). Among them, For applications such as digital signatures, the required input for calculation is generator And the system signature master public key.

[0099] Preset generators are composed of coordinates Confirmed. The coordinates of the preset generators are given by the SM9 algorithm standard, and the components are as follows:

[0100] X P1 :

[0101] 93DE051D62BF718FF5ED0704487D01D6E1E4086909DC3280E8C4E4817C66DDDD

[0102] Y P1 :

[0103] 21FE8DDA4F21E607631065125C395BBC1C1C00CBFA6024350C464CD70A3EA616

[0104] Preferably, in this embodiment, the preset generator is implemented as a bit string. , where X P1 and Y P1 Both are 256 bits.

[0105] The system signature master public key is determined by coordinates. Confirmed. Specifically, in this embodiment, the components of the system signature master public key are:

[0106] X1:

[0107] 692988EECA57534A1959DA0CCB338BD225300ABEAD59CB90D35883706C86E975

[0108] X2:

[0109] 0AEF09E5566B3E0E7DCF49B8A01A2811F6BE4F3FD65F749283E9612BBCCDE665

[0110] Y1:

[0111] 98B1344454FA8E7D0056917CECF1CFCED642A773D17D18CBC059F82BCEAFF091

[0112] Y2:

[0113] 60D6B91238EE250C689DCE9A4294FF64C477080F4285D6A8AC4D945603FC20DA

[0114] Preferably, in this embodiment, the system signature master public key is implemented as a bit string. X1, Y1, X2, and Y2 are all 256 bits.

[0115] The method provided in this embodiment includes:

[0116] Step 101: The processor sets the initial value of the first register according to the system signature master public key;

[0117] Preferably, in this embodiment, the first register includes four 256-bit storage units and one 512-bit storage unit.

[0118] Specifically, in this embodiment, each component of the system signature master public key is set to the initial value of the four 256-bit storage units. The initial value of the 512-bit storage unit is set to 1.

[0119] Step 102: The processor sets the initial value of the second register, traverses the first preset parameters, and controls the elliptic curve operation coprocessor to update the values ​​of the first register and the second register according to the current value of the first register, the preset generator, and the system signature master public key;

[0120] Specifically, in this embodiment, the second register consists of 12 256-bit storage units, denoted as a0, a1, ... a 11 . Store unit a 11 The value of is set to 1, and all other storage units are set to 0.

[0121] The first preset parameter is given by the SM9 algorithm standard, and its value (in hexadecimal) is 00000002 400000000215D93E. Preferably, in this embodiment, the first preset parameter is implemented as a 64-byte bit string, traversed from the most significant bit to the least significant bit.

[0122] Specifically, in this embodiment, such as Figure 2 As shown, the process iterates through the first preset parameters and updates the values ​​of the first and second registers based on the current value of the first register, the preset generator, and the system signature master public key, including:

[0123] Step 102-1: The processor controls the elliptic curve operation coprocessor to perform line function point multiplication operation based on the preset generator and the current value of the first register, and stores the operation result in the third register;

[0124] Specifically, in this embodiment, the third register consists of 12 256-bit storage units, denoted as b0, b1, ... b 11 .

[0125] The calculation results for this step are as follows: 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

[0128] 53135DDE4F3B8E0AC995BE02CB1232F41479DDE083F963CC414E84620FB06D09

[0129] 96FAFBB3DB420A1E7B110A6B2AE69E8031CDAB484F57C1B63E6966D0236A8489 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

[0134] 8D5A716F68821FAE7F60F0FA9666AB45B4BFFB8C9C4882FB6CB4FD76B3C6776D

[0135] 7B14302D7BC5DA6D15707F362360C6F845730806379256E87B419F93A9A97A9B

[0136] 7AB32C5C107C565451847FABE9DF7FF07569D128EE2F0A55F293C2F17D131949

[0137] 35C231BC654E180FA479FF06F30F0E24903A4E26A979D482884D34CDEF37D88B

[0138] Step 102-2: The processor controls the elliptic curve operation coprocessor to perform elliptic curve point multiplication operations in multiples of 2 based on the current value of the first register, and updates the value of the first register with the operation result;

[0139] In this embodiment, the calculation result of this step is as follows:

[0140] A355C8EEE26AC2DC4201BE27DD264F99F311968EFD7AEAED83AE10AF472461E3

[0141] A49CA3A12BB7812FB6976A66FE1776F8F94798B0205C3A212A3E002C22248D68

[0142] 6134C681DD77E0187DE00AB503496574094B7D812E604F76054DE8955F7476CB

[0143] E1383A478ABBBF6630613E562D9E9B7E504671810B72070AB9A1A7613BEA319E

[0144] 4E11230BC48581D3E632341CB7F10C50B6F687A2CCF686477E104965E71FE123 C1AD722471DC4A18D13B9D348529FEC888EE101E850BAD51589B28AC07F841B5

[0145] Step 102-3: The processor traverses each memory cell of the second register, performs a modular exponentiation operation (exponent is 2) based on the current value of each memory cell, and updates the value of each memory cell using the calculation result;

[0146] Step 102-4: The processor traverses each memory cell of the second register, performs a modular multiplication operation between the current value of each memory cell and the current value of the corresponding memory cell in the third register, and updates the value of each memory cell in the second register with the calculation result;

[0147] Specifically, in this embodiment, a0 is modularly multiplied by b0, a1 is modularly multiplied by b1, and so on.

[0148] Step 102-5: The processor determines whether the bit currently being traversed by the first preset parameter is 1. If yes, it executes step 102-6; otherwise, it executes step 102-9.

[0149] Step 102-6: The processor controls the elliptic curve arithmetic coprocessor to perform point addition of line functions based on the current value of the first register, the system signature master public key, and the preset generator, and stores the result in the third register.

[0150] In this embodiment, the calculation result of this step is as follows: 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

[0153] 4120368EB292D6EB9A84A8CAA08C32EF2514CE13956E7EC1C57933AE01FC484B

[0154] 4B4C5B780693C4221BD99993ED0C616C22F26E1D5586DC8D51C4A3DC20B9E4F3 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

[0159] 07D9838DF75FA01EDBD45CAB3F1D896D67312FE788E199FFAB30B3480253B4BC

[0160] 00DE83FBF1F836B47424771F12EADFE4CF15E5A422DA124EC5CD41B8CDBBE44A

[0161] 6DF9928F225AD5749E517820C5108F4CBA650800BF56AC4010BA0CBAD0DA0229

[0162] E427C792C351DEC5627C362515F647E47979EADD47188C2876621E221D85B97B

[0163] Step 102-7: The processor controls the elliptic curve arithmetic coprocessor to perform elliptic curve point addition operations based on the current value of the first register and the system signature master public key, and updates the value of the first register with the operation result;

[0164] In this embodiment, the calculation result of this step is as follows:

[0165] D0852A864135806CB8D2563CBD030B463A3054D8ED900D2ADE730C889D225B7C

[0166] C8390A5D0DCAD1B02F46B7B457ADF6B37D7FC5D3FD2A734E7B061A78184C4196

[0167] 7788C20A4C412A5823FE5F92EA9E176DC5E0EE9346C43FC57FC277BC62756D72

[0168] 3A333CFC4A109AF42AB13ECA83CF60893D0161A6827D4B9783D45A847ABEB212

[0169] 35374BE6C16120A5CDF9FE2BFC2B886F026AC3CFE19F9C33D3F55DF12E262F71 DB5E280817A7606C8D296A627B8650F96871B23DD4797F1177B44291881D24C9

[0170] Step 102-8: The processor traverses each memory cell of the second register, performs a modular multiplication operation between the current value of each memory cell and the current value of the corresponding memory cell in the third register, and updates the value of each memory cell in the second register with the calculation result;

[0171] The specific method is the same as step 102-4, and will not be repeated here.

[0172] Step 102-9: The processor determines whether the traversal of the first preset parameters is complete. If yes, it executes step 103; otherwise, it returns to step 102-1.

[0173] Step 103: The processor performs modular exponentiation on each component of the system signature master public key, with the exponent being the second preset parameter, and stores the result in the fourth register.

[0174] Specifically, in this embodiment, the system signature master public key is... Components and The components are each subjected to modular exponentiation. The second preset parameter is the order of the base domain in which the elliptic curve is located.

[0175] The fourth register consists of two 512-bit storage units, denoted as follows: and . The result of the modular exponentiation of the components is stored in , The result of the modular exponentiation of the components is stored in .

[0176] In this embodiment, the calculation result of this step is as follows:

[0177] Saved in :

[0178] 229A4E7BD0DAE0065BEF92CE8684F037B0AE447900CD4BD218F1B6054CDAF0B07694FB084C9A9244554D30D81EA9D124D98836701F4820DDC3685E611849785C

[0179] Saved in :

[0180] 5936CF9645AC581612FF1F340FA4985841B379F48F1CFFF294291AFEB701965714F779B9E6B3B85B7AC798D29B84D84377175DF9E51EB23C369B8474B39E6438

[0181] Step 104: The processor performs a modular multiplication operation based on the third preset parameter and the current value of the fourth register, and updates the value of the fourth register with the result of the operation;

[0182] Specifically, in this embodiment, the third preset parameter is defined by the SM9 algorithm standard, and its value (in hexadecimal representation) is:

[0183] 88FF5C730C0B73A064E54BB6A38B7F78CA1B1AA1217BA25198DAFEA840A7DEF7

[0184] Will The current value is multiplied by the second modular exponentiation of the third preset parameter, and the inverse is then multiplied modularly. The result is then stored in [the specified location]. ;Will The current value is multiplied modularly by the result of the third preset parameter raised to the power of 3 and then inverted. The result is then stored in [the specified location]. .

[0185] In this embodiment, stored in The result of the calculation is:

[0186] 3ADEB3912FAD02FFBFAC70DCF22CAA8C153F3F51FDE03F3D18FD146DB31E25DA32487C1DC10E8A860C73C4D7C274CFA9CDE775BAF4F002EA44C64B18C7FB91F7

[0187] Saved in The result of the calculation is:

[0188] B55FEEC76F8AF355E5DBA2A0CAFF3C82E0B3E02EFB796D7BBDB65139186FF09160D6B91238EE250C689DCE9A4294FF64C477080F4285D6A8AC4D945603FC20DA

[0189] Step 105: The processor performs modular multiplication on each component of the system signature master public key according to the third preset parameter, and stores the result in the fifth register.

[0190] Specifically, in this embodiment, the fifth register consists of two 512-bit storage units, denoted as follows: and For the system's signature master public key Components and Perform modular multiplication on each component. Perform a modular multiplication on the result of the fourth modular exponentiation of the third preset parameter and its inverse, and save the result in [location]. ;Will Perform modular multiplication on the result of the 6th modular exponentiation of the third preset parameter and the inverse of the result, then invert the result modularly and store it. .

[0191] Step 106: The processor controls the elliptic curve arithmetic coprocessor to perform a second expansion field point addition operation based on the current values ​​of the first register and the fourth register, and updates the value of the first register based on the operation result;

[0192] Step 107: The processor controls the elliptic curve arithmetic coprocessor to perform point addition of line functions based on the current values ​​of the first register, the fourth register, and the preset generator, and stores the result in the third register.

[0193] Specifically, in this embodiment, the fourth register... The current value is used as the X component of the elliptic curve point. The current value is used as the Y component of the elliptic curve point to participate in the point addition operation of the line function.

[0194] In this embodiment, the result of this step is: 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

[0197] 6B9916825C0BC402EFBC04E9E33FE25ABDF8F809A72E8C5D0CA7CED51B444350

[0198] BBE10E7402332CD5280DEB8F3ED039EBE3E70B57DB71D60E03F3F565AF88D25E 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

[0203] 97C6958F578CDF925AC16293A0C91FEA618347A1BEB3DA545504C0C49C31989E

[0204] 06BC711B5236E8881826C18B2FAD0B898B4EE0A86F40480B21681AED8B3E4D2C

[0205] 9881AB07A0A8C128A35C62B28113236F7E85ABC9BE4F4F98EB7A55D03BC0B957

[0206] F65A4130EC4C550995DE09E7E8BB9BE1C5D8FB5CFD7763B74F036287B7E60E02

[0207] Step 108: The processor traverses each memory cell of the second register, performs a modular multiplication operation between the current value of each memory cell and the current value of the corresponding memory cell in the third register, and updates the value of each memory cell in the second register with the calculation result;

[0208] The specific method is the same as step 102-4, and will not be repeated here.

[0209] In this embodiment, the result of this step is:

[0210] 1ADC9256605A32B7506DEFA0A645E0151F6968103EB624684E6903CB3F4AD027

[0211] 20B03A16D9068B5D3DDE39F7092A6492051F53E9E1F2AE6C3196AA4C16C95137

[0212] F366037A76CAC3D5EA8A7904438C764ABF87040CCF1BB188A62D2648531609DC

[0213] 15F835FCD77E1A12FC74470C545652B69F62353D8CFA57396D6A96426DB92965

[0214] DB0306EAF6ED61E1C8DA1C7DE06301D58DB888C203C7264D2E8D61ACA9C28DE3

[0215] 0042C1B03630457D3CEB92FC1838B215665C5B14009ACF7C3CBB37E848E6CAC5

[0216] EFF20265952F81399F263A2A38C0F51B004EDA5EE1FBA276023A8A374BCF00A6

[0217] 9253AB76D363B283B42A66BB7FF1596EA7BC113A197FB8BDA3A045CF56E8CC4C

[0218] 724AB23936280DD09AB8B6A7F85F57619F07AA476ABDAEDA286C6D138A6F7BB4

[0219] 4CC015E233A86D4F6A550E37DDE94855535950DEAD0A9FD766CD7B3C762EEB00

[0220] 4A17254386EE0FC16D36B92C2AC99948946E4B2CD71B772547F0F825BAAAFCD1

[0221] 49BC470F8187EE4560BBA935232CAC1FB06034C86B62C89B12C28DA97D69023C

[0222] Step 109: The processor controls the elliptic curve arithmetic coprocessor to perform a second expansion field point addition operation based on the current values ​​of the first register and the fifth register, and updates the value of the first register based on the operation result;

[0223] Step 110: The processor controls the elliptic curve arithmetic coprocessor to perform point addition of line functions based on the current values ​​of the first register, the fifth register, and the preset generator, and stores the result in the third register.

[0224] Specifically, in this embodiment, the fifth register... The current value is used as the X component of the elliptic curve point. The current value is used as the Y component of the elliptic curve point to participate in the point addition operation of the line function.

[0225] In this embodiment, the result of this step is: 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

[0228] 0B06B2D1619BF6864FC64FAD402F0D353B8A865E13A7ED0FC8875A7940A5B9A5

[0229] EACD7FF588A4559A10F231E8C07E75E426F12853BF140F0FDABF5D5014DB16BC 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

[0234] 73889D2916F5AB6A3A2870D3A32B2C61607C799173883061CE3FB414007FAA69

[0235] 7A59F58A12C555B80C7F0F5292054B4D34C25C6E402C36B99AC80482637BE180

[0236] 17F536935700B1EF205CAA80516AFF539B44ACC16154249635E09230FA857DCB

[0237] C6CE530D7EB687C2C5815486686AB869CA83ECEC3049D8BC0422830F89A05A4C

[0238] Step 111: The processor traverses each memory cell of the second register, performs a modular multiplication operation between the current value of each memory cell and the current value of the corresponding memory cell in the third register, and updates the value of each memory cell in the second register with the calculation result.

[0239] The specific method is the same as step 102-4, and will not be repeated here.

[0240] Step 112: The processor traverses each memory cell of the second register, performs modular exponentiation based on the current value of each memory cell and the fourth preset parameter, obtains the linear pair pre-calculated value, and ends.

[0241] Specifically, in this embodiment, the current values ​​of each storage unit in the second register are exponentially multiplied using a fourth preset parameter as the exponent. The fourth preset parameter is determined by the elliptic curve parameters of the SM9 algorithm. Elliptic curve base domain. Let q be the order of the group, r be the order of the group, and N be the modulus of the group. Then the fourth preset parameter is determined by... Sure.

[0242] Using this method, linear pair pre-computation can be performed after the system signature master public key is set into the embedded system, before digital signing (when the data to be signed has not yet been obtained), or during any digital signing process. After the linear pair pre-computation value is stored, it can be directly used in multiple subsequent digital signing processes (especially multiple digital signing processes involving different data to be signed), thereby shortening the computation time of digital signing.

[0243] Example 2

[0244] This embodiment discloses a method for calculating digital signatures based on an identifier cryptography algorithm in an embedded system, running on an embedded system including a processor, a random number generator, a storage module, and an elliptic curve operation coprocessor. Figure 3 As shown.

[0245] The method includes:

[0246] Step 201: The processor obtains the data to be signed and reads the pre-calculated value of the linear pair consisting of 12 units from the storage module;

[0247] Specifically, in this embodiment, the pre-calculated value of the linear pair is divided into 12 256-bit units. As described in Embodiment 1, the storage module storing the pre-calculated value consists of 12 256-bit storage units, denoted as a0, a1, ... a 11 The values ​​of each element in the linear pre-calculated value are a0, a1, ... a 11 The values ​​stored in it.

[0248] Step 202: The processor checks the current pre-calculated value of the linear pair. If the current pre-calculated value of the linear pair is unavailable (e.g., all zeros), it controls the elliptic curve operation coprocessor to perform linear pair pre-calculation based on the preset generator and the system signature master public key, and uses the calculation result to update the current pre-calculated value of the linear pair.

[0249] Preferably, in this embodiment, after updating the current linear pair pre-calculated value using the calculation result, the method further includes: storing the current linear pair pre-calculated value in the storage module. Specifically, each cell value of the linear pair pre-calculated value is stored in the corresponding storage cell of the linear pair pre-calculated value storage submodule.

[0250] The pre-computed value of the linear pair can be calculated and stored after the system's signature master public key is set into the embedded system and before the digital signature is performed, or it can be calculated and stored when the digital signature is performed for the first time. See Example 1 for details, which will not be repeated here.

[0251] Step 203: The processor controls the random number generator to generate the first random number;

[0252] Preferably, in this embodiment, step 203 further includes: the processor checking whether the first random number is available. If the first random number is unavailable (its value is all 0 or greater than a preset threshold), the processor controls the random number generator to regenerate it.

[0253] Specifically, the preset threshold is N-1, where N is the elliptic curve base domain. The model.

[0254] Step 204: The processor uses the first random number as the exponent to perform modular exponentiation on each unit of the pre-calculated value of the linear pair, and calculates the first signature data based on the result of the modular exponentiation and the data to be signed;

[0255] Specifically, in this embodiment, calculating the first signature data based on the result of the modular exponentiation and the data to be signed specifically includes:

[0256] Step 204-1: The processor sequentially concatenates the first preset data (8 bits, value 0x02), the data to be signed, and the result of the modular exponentiation to obtain the first intermediate data;

[0257] Step 204-2: The processor sequentially concatenates the first intermediate data and the second preset data (8 bits, value 0x01), and performs SM3 cryptographic hash operation on the concatenation result;

[0258] Step 204-3: The processor sequentially concatenates the first intermediate data and the third preset data (8 bits, value 0x02), and performs SM3 cryptographic hash operation on the concatenation result;

[0259] Step 204-4: The processor sequentially concatenates the SM3 cryptographic hash operation results from steps 204-2 and 204-3, and obtains the first signature data based on the concatenation result and the fifth preset parameter;

[0260] Specifically, in this embodiment, the first signature data is obtained by taking the modulus of the splicing result modulo the fifth preset parameter and adding 1.

[0261] The fifth preset parameter is determined by the eigenvalues ​​of the elliptic curve basis domain. Let the eigenvalue be q(t), then the fifth eigenvalue is q(t)⁻¹. The eigenvalues ​​given in the SM9 algorithm standard are...

[0262] B640000002A3A6F1D603AB4FF58EC74449F2934B18EA8BEEE56EE19CD69ECF25

[0263] Step 205: The processor reads the signing private key from the storage module, calculates the second signature data based on the signing private key, the first random number, and the first signature data, and outputs the first signature data and the second signature data as a digital signature, then ends.

[0264] Specifically, in this embodiment, step 205 includes:

[0265] Step 205-1: The processor calculates the elliptic curve dot product scalar based on the first random number and the first signature data;

[0266] Specifically, in this embodiment, the first random number is denoted as a, the first signature data is denoted as b, the first preset parameter is denoted as c, and the elliptic curve dot product scalar is denoted as c. Sure.

[0267] Step 205-2: The processor reads the signature private key from the storage module, controls the elliptic curve operation coprocessor to perform elliptic curve point multiplication with the scalar as the multiple, and obtains the second signature data based on the signature private key. The first signature data and the second signature data are output as digital signatures, and the process ends.

[0268] In this application, by pre-compiling reusable key steps in the digital signature process based on identifier cryptography, and using the pre-computed values ​​during digital signature operations, the computation time is shortened. The pre-compiling does not involve the data to be signed and can be repeatedly used in the process of calculating digital signatures for different messages, thereby improving the overall efficiency of digital signatures.

[0269] Example 3

[0270] Based on the technical solution of the method for digital signature using an identifier cryptographic algorithm in an embedded system provided in this application, this embodiment provides a corresponding implementation device for digital signature using an identifier cryptographic algorithm in an embedded system, which runs in an embedded system including a processor, a random number generator, a storage module, and an elliptic curve operation coprocessor. The device is installed in the processor, and its structural schematic diagram is shown below. Figure 4 As shown.

[0271] The implementation device 30 provided in this embodiment includes:

[0272] The first processing module 301 is used to obtain the data to be signed and read the current linear pair pre-calculated value from the storage module;

[0273] The second processing module 302 is used to check the current pre-calculated value of the linear pair. If the current pre-calculated value of the linear pair is unavailable, it reads the preset generator and the system signature master public key from the storage module, controls the elliptic curve operation coprocessor to perform linear pair pre-calculation according to the preset generator and the system signature master public key, and uses the calculation result to update the current pre-calculated value of the linear pair.

[0274] The third processing module 303 is used to control the random number generator to generate the first random number;

[0275] Preferably, in this embodiment, the third processing module 303 further includes a first judgment unit, used to judge whether the first random number generated by the random number generator is available.

[0276] The fourth processing module 304 is used to perform a modular exponentiation operation on the current linear pair pre-calculated value using the first random number, and to calculate the first signature data based on the result of the modular exponentiation operation and the data to be signed.

[0277] The fifth processing module 305 is used to read the signing private key from the storage module, calculate the second signature data based on the signing private key, the first random number and the first signature data, and output the first signature data and the second signature data as a digital signature.

[0278] Specifically, in this embodiment, such as Figure 5 As shown, the second processing module 302 further includes a linear pair pre-computation submodule, used to perform linear pair pre-computation based on the preset generator and the system signature master public key, including:

[0279] The first processing unit 302-1 is used to set the initial value of the first register according to the system signature master public key;

[0280] The second processing unit 302-2 is used to set the initial value of the second register, traverse the first preset parameters, and control the elliptic curve operation coprocessor to update the values ​​of the first register and the second register according to the current value of the first register, the preset generator, and the system signature master public key.

[0281] The third processing unit 302-3 is used to perform modular exponentiation on each component of the system signature master public key, with the exponent of the exponent being the second preset parameter, and to store the result in the fourth register.

[0282] The fourth processing unit 302-4 is used to perform modular multiplication based on the third preset parameter and the current value of the fourth register, and update the value of the fourth register using the result of the operation;

[0283] The fifth processing unit 302-5 is used to perform modular multiplication on each component of the system signature master public key according to the third preset parameters, and store the operation result in the fifth register.

[0284] The sixth processing unit 302-6 is used to control the elliptic curve operation coprocessor to perform a second expansion field point addition operation based on the current value of the first register and the current value of the fourth register, and update the value of the first register based on the operation result;

[0285] The seventh processing unit 302-7 is used to control the elliptic curve operation coprocessor to perform point addition operations on line functions based on the current values ​​of the first register and the fourth register and the preset generator, and to store the operation result in the third register;

[0286] The eighth processing unit 302-8 is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register using the calculation result;

[0287] The ninth processing unit 302-9 is used to control the elliptic curve operation coprocessor to perform a second expansion field point addition operation based on the current value of the first register and the current value of the fifth register, and update the value of the first register based on the operation result;

[0288] The tenth processing unit 302-10 is used to control the elliptic curve operation coprocessor to perform line function point addition operation based on the current value of the first register, the current value of the fifth register and the preset generator, and store the operation result in the third register;

[0289] The eleventh processing unit 302-11 is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register with the calculation result.

[0290] The twelfth processing unit 302-12 is used to traverse each storage unit of the second register, perform modular exponentiation based on the current value of each storage unit and the fourth preset parameter, and obtain the linear pair pre-calculated value.

[0291] Specifically, in this embodiment, the second processing unit 302-2 includes:

[0292] The first processing subunit 302-2-1 is used to control the elliptic curve operation coprocessor to perform line function point multiplication operation based on the preset generator and the current value of the first register, and store the operation result in the third register.

[0293] The second processing subunit 302-2-2 is used to control the elliptic curve operation coprocessor to perform elliptic curve point multiplication operations in multiples of 2 according to the current value of the first register, and update the value of the first register with the operation result;

[0294] The third processing subunit 302-2-3 is used to traverse each memory cell of the second register, perform modular exponentiation (exponent is 2) based on the current value of each memory cell, and update the value of each memory cell using the calculation result;

[0295] The fourth processing subunit 302-2-4 is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register with the calculation result.

[0296] The fifth processing subunit 302-2-5 is used to determine whether the bit currently being traversed by the first preset parameter is 1;

[0297] The sixth processing subunit 302-2-6 is used to control the elliptic curve operation coprocessor to perform line function point addition operation based on the current value of the first register, the system signature master public key, and the preset generator, and store the operation result in the third register;

[0298] The seventh processing subunit 302-2-7 is used to control the elliptic curve operation coprocessor to perform elliptic curve point addition operation based on the current value of the first register and the system signature master public key, and update the value of the first register with the operation result;

[0299] The eighth processing subunit 302-2-8 is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register with the calculation result.

[0300] The ninth processing subunit 302-2-9 is used to determine whether the traversal of the first preset parameter is complete.

[0301] Specifically, in this embodiment, the fourth processing module 304 includes:

[0302] First processing unit 304-1: used to perform modular exponentiation on each unit of the current linear pair pre-calculated value using the first random number as the exponent;

[0303] The second processing unit 304-2 is used to sequentially concatenate the first preset data, the data to be signed, and the result of the modular exponentiation operation to obtain the first intermediate data;

[0304] The third processing unit 304-3 is used to sequentially concatenate the first intermediate data and the second preset data, and perform SM3 cryptographic hash operation on the concatenation result.

[0305] The fourth processing unit 304-4 is used to concatenate the first intermediate data and the third preset data, and perform SM3 cryptographic hash operation on the concatenation result;

[0306] The fifth processing unit 304-5 is used to sequentially splice the operation results of the third processing unit 304-3 and the operation results of the fourth processing unit 304-4, and obtain the first signature data based on the splicing result and the fifth preset parameter;

[0307] Specifically, in this embodiment, the fifth processing module 305 includes:

[0308] The first processing unit 305-1 is used to calculate the elliptic curve dot product scalar based on the first random number and the first signature data.

[0309] The second processing unit 305-2 is used to read the signature private key from the storage module, control the elliptic curve operation coprocessor to perform elliptic curve multiplication by a scalar multiplication using the elliptic curve dot product as a multiple, and obtain the second signature data based on the signature private key.

[0310] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for digital signature using an identifier cryptographic algorithm in an embedded system, running in an embedded system comprising a processor, a random number generator, a storage module, and an elliptic curve operation coprocessor, characterized in that, The method includes: The processor acquires the data to be signed and reads the current linear pair pre-calculated value from the storage module; The processor checks the current pre-calculated value of the linear pair. If the current pre-calculated value of the linear pair is unavailable, it controls the elliptic curve operation coprocessor to perform linear pair pre-calculation based on the preset generator and the system signature master public key, and uses the calculation result to update the current pre-calculated value of the linear pair. The processor controls the random number generator to generate a first random number; The processor uses the first random number to perform a modular exponentiation operation on the current linear pair pre-calculated value, and calculates the first signature data based on the result of the modular exponentiation operation and the data to be signed. The processor reads the signing private key from the storage module, calculates the second signature data based on the signing private key, the first random number, and the first signature data, and outputs the first signature data and the second signature data as a digital signature.

2. The method as described in claim 1, characterized in that, Before the processor obtains the data to be signed, it also includes: The processor performs linear pair pre-computation based on the preset generator and the system signature master public key, obtains the linear pair pre-computation value, and stores it in the storage module.

3. The method as described in claim 1 or 2, characterized in that, The control of the elliptic curve computation coprocessor to perform linear pair pre-computation based on preset generators and the system signature master public key includes: Step 1: The processor sets the initial value of the first register according to the system signature master public key; Step 2: The processor sets the initial value of the second register, traverses the first preset parameters, and updates the values ​​of the first register and the second register according to the current value of the first register, the preset generator, and the system signature master public key; Step 3: The processor performs modular exponentiation on each component of the system signature master public key according to the second preset parameters, and saves the result in the fourth register; Step 4: The processor performs a modular multiplication operation based on the third preset parameter and the current value of the fourth register, and updates the value of the fourth register using the operation result; Step 5: The processor performs modular multiplication on each component of the system signature master public key according to the third preset parameter, and stores the result in the fifth register; Step 6: The processor controls the elliptic curve arithmetic coprocessor to perform a second expansion field point addition operation based on the current value of the first register and the current value of the fourth register, and updates the value of the first register based on the operation result; Step 7: The processor controls the elliptic curve operation coprocessor to perform a point addition operation of the line function based on the current value of the first register, the current value of the fourth register, and the preset generator, and stores the operation result in the third register; Step 8: The processor traverses each storage unit of the second register, performs a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and updates the value of each storage unit of the second register with the calculation result; Step 9: The processor controls the elliptic curve arithmetic coprocessor to perform a second extended-domain point addition operation based on the current value of the first register and the current value of the fifth register, and updates the value of the first register based on the operation result; Step 10: The processor controls the elliptic curve operation coprocessor to perform a point addition operation of the line function based on the current value of the first register, the current value of the fifth register, and the preset generator, and stores the operation result in the third register; Step 11: The processor traverses each storage unit of the second register, performs a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and updates the value of each storage unit of the second register with the calculation result; Step 12: The processor traverses each storage unit of the second register and performs modular exponentiation based on the current value of each storage unit and the fourth preset parameter to obtain the pre-calculated value of the linear pair.

4. The method as described in claim 1, characterized in that, After generating the first random number, the process also includes: Determine if the first generated random number is usable; if not, regenerate it.

5. The method according to claim 1, characterized in that, The step of calculating the first signature data based on the result of the modular exponentiation and the data to be signed includes: Step D1: The processor sequentially concatenates the first preset data, the data to be signed, and the result of the modular exponentiation to obtain the first intermediate data; Step D2: The processor sequentially concatenates the first intermediate data and the second preset data, and performs SM3 cryptographic hash operation on the concatenation result; Step D3: The processor sequentially concatenates the first intermediate data and the third preset data, and performs SM3 cryptographic hash operation on the concatenation result; Step D4: The processor sequentially concatenates the SM3 cryptographic hash operation results obtained in steps D2 and D3, and obtains the first signature data based on the concatenation result and the fifth preset parameter.

6. The method as described in claim 1, characterized in that, The step of calculating the second signature data based on the signature private key, the first random number, and the first signature data includes: Step E1: The processor calculates the elliptic curve dot product scalar based on the first random number and the first signature data; Step E2: The processor reads the signature private key from the storage module and controls the elliptic curve operation coprocessor to perform elliptic curve multiplication by multiplying the elliptic curve by a scalar as a multiple, based on the signature private key, to obtain the second signature data.

7. The method as described in claim 1, characterized in that, The step of performing linear pair pre-computation based on the preset generator and the system signature master public key, and updating the current linear pair pre-computation value using the calculation result, further includes: Save the current linear pair pre-calculated value to the storage module.

8. The method as described in claim 3, characterized in that, The step of traversing the first preset parameters and updating the values ​​of the first register and the second register according to the current value of the first register, the preset generator, and the system signature master public key includes: Step 2-1: The processor controls the elliptic curve operation coprocessor to perform line function point multiplication operation based on the preset generator and the current value of the first register, and stores the operation result in the third register; Step 2-2: The processor controls the elliptic curve operation coprocessor to perform elliptic curve point multiplication operation based on the current value of the first register, and updates the value of the first register with the operation result; Steps 2-3: The processor traverses each storage unit of the second register, performs modular exponentiation based on the current value of each storage unit, and updates the value of each storage unit using the calculation result; Steps 2-4: The processor traverses each storage unit of the second register, performs a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and updates the value of each storage unit of the second register with the calculation result; Step 2-5: The processor determines whether the bit currently traversed in the first preset parameter is 1. If yes, it executes step 2-6; otherwise, it executes step 2-9. Steps 2-6: The processor controls the elliptic curve arithmetic coprocessor to perform a line function point addition operation based on the current value of the first register, the system signature master public key, and the preset generator, and stores the operation result in the third register; Steps 2-7: The processor controls the elliptic curve arithmetic coprocessor to perform elliptic curve point addition operation with the current value of the first register and the system signature master public key, and updates the value of the first register with the operation result; Steps 2-8: The processor traverses each storage unit of the second register, performs a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and updates the value of each storage unit of the second register with the calculation result; Step 2-9: The processor determines whether the traversal of the first preset parameters is complete. If yes, it executes step 3; otherwise, it returns to step 2-1.

9. An implementation device for digital signatures using an identifier cryptographic algorithm in an embedded system, running in an embedded system comprising a processor, a random number generator, a storage module, and an elliptic curve operation coprocessor, characterized in that, The device is disposed in the processor and includes: The first processing module is used to obtain the data to be signed and read the current linear pair pre-calculated value from the storage module; The second processing module is used to check the current pre-calculated value of the linear pair. If the current pre-calculated value of the linear pair is unavailable, it reads the preset generator and the system signature master public key from the storage module, controls the elliptic curve operation coprocessor to perform linear pair pre-calculation according to the preset generator and the system signature master public key, and updates the current pre-calculated value of the linear pair using the calculation result. The third processing module is used to control the random number generator to generate the first random number. The fourth processing module is used to perform a modular exponentiation operation on the current linear pair pre-calculated value using the first random number, and calculate the first signature data based on the result of the modular exponentiation operation and the data to be signed; The fifth processing module is used to read the signing private key from the storage module, calculate the second signature data using the signing private key, the first random number and the first signature data, and output the first signature data and the second signature data as a digital signature.

10. The apparatus as claimed in claim 9, characterized in that, The second processing module includes a linear pair pre-computation submodule, used to perform linear pair pre-computation based on a preset generator and the system signature master public key, including: The first processing unit is configured to set the initial value of the first register according to the system signature master public key; The second processing unit is used to set the initial value of the second register, traverse the first preset parameters, and control the elliptic curve operation coprocessor to update the values ​​of the first register and the second register according to the current value of the first register, the preset generator, and the system signature master public key; The third processing unit is used to perform modular exponentiation on each component of the system signature master public key according to the second preset parameters, and save the result in the fourth register. The fourth processing unit is used to perform modular multiplication based on the third preset parameter and the current value of the fourth register, and update the value of the fourth register using the result of the operation; The fifth processing unit is used to perform modular multiplication on each component of the system signature master public key according to the third preset parameters, and store the operation result in the fifth register. The sixth processing unit is used to control the elliptic curve operation coprocessor to perform a second extended field point addition operation based on the current value of the first register and the current value of the fourth register, and to update the value of the first register based on the operation result; The seventh processing unit is used to control the elliptic curve operation coprocessor to perform line function point addition operation based on the current value of the first register, the current value of the fourth register and the preset generator, and store the operation result in the third register; The eighth processing unit is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register using the calculation result; The ninth processing unit is used to control the elliptic curve operation coprocessor to perform a second expansion field point addition operation based on the current value of the first register and the current value of the fifth register, and to update the value of the first register based on the operation result; The tenth processing unit is used to control the elliptic curve operation coprocessor to perform line function point addition operation based on the current value of the first register, the current value of the fifth register and the preset generator, and store the operation result in the third register; The eleventh processing unit is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register using the calculation result. The twelfth processing unit is used to traverse each storage unit of the second register, perform modular exponentiation based on the current value of each storage unit and the fourth preset parameter, and obtain the linear pair pre-calculated value.

11. The apparatus as claimed in claim 10, characterized in that, The second processing unit includes: The first processing subunit is used to control the elliptic curve operation coprocessor to perform line function point multiplication operation based on the preset generator and the current value of the first register, and store the operation result in the third register; The second processing subunit is used to control the elliptic curve operation coprocessor to perform elliptic curve point multiplication operation based on the current value of the first register, and update the value of the first register with the operation result. The third processing subunit is used to traverse each storage unit of the second register, perform modular exponentiation based on the current value of each storage unit, and update the value of each storage unit using the calculation result; The fourth processing subunit is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register using the calculation result; The fifth processing subunit is used to determine whether the bit currently being traversed by the first preset parameter is 1; The sixth processing subunit is used to control the elliptic curve operation coprocessor to perform line function point addition operation based on the current value of the first register, the system signature master public key, and the preset generator, and store the operation result in the third register; The seventh processing subunit is used to control the elliptic curve operation coprocessor to perform elliptic curve point addition operation with the system signature master public key based on the current value of the first register, and update the value of the first register with the operation result; The eighth processing subunit is used to traverse each storage unit of the second register, perform a modular multiplication operation between the current value of each storage unit and the current value of the corresponding storage unit of the third register, and update the value of each storage unit of the second register using the calculation result; The ninth processing subunit is used to determine whether the traversal of the first preset parameter is complete.

12. The apparatus as claimed in claim 9, characterized in that, The fourth processing module includes: First processing unit: used to perform modular exponentiation on each unit of the current linear pair pre-calculated value using the first random number as the exponent; The second processing unit is used to sequentially concatenate the first preset data, the data to be signed, and the result of the modular exponentiation to obtain the first intermediate data; The third processing unit is used to sequentially concatenate the first intermediate data and the second preset data, and perform a cryptographic hash operation on the concatenation result. The fourth processing unit is used to concatenate the first intermediate data and the third preset data, and perform a cryptographic hash operation on the concatenation result; The fifth processing unit is used to sequentially concatenate the operation results of the third processing unit and the operation results of the fourth processing unit, and obtain the first signature data based on the concatenation result and the fifth preset parameter.

13. The apparatus as claimed in claim 9, characterized in that, The fifth processing module includes: The first processing unit is used to calculate the elliptic curve dot product scalar based on the first random number and the first signature data. The second processing unit is used to read the signature private key from the storage module, control the elliptic curve operation coprocessor to perform elliptic curve multiplication by a scalar multiplication of the elliptic curve as a multiple, and obtain the second signature data based on the signature private key.

14. The apparatus as claimed in claim 9, characterized in that, The third processing module further includes a first judgment unit, used to determine whether the first random number generated by the random number generator is available.