Private key generation method, electronic device, readable storage medium and program product
By automatically generating private keys for public-key cryptography through a key generation module, and utilizing the key ladder mechanism and elliptic curve cryptography algorithm, the problem of easy leakage of private keys is solved, thereby improving the security of information security processing and the protection of private keys.
Patent Information
- Application Number
- CN202211104721.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-09
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-09-09
AI Technical Summary
In existing public-key cryptography systems, private keys are managed by users, which can easily lead to leakage and affect the security of identity authentication and digital signatures.
The private key of the public-key cryptosystem is automatically generated by the key generation module. Using the key ladder mechanism and elliptic curve cryptography algorithm, the private key is directly provided to the security processing module for information security processing, avoiding storage on the user device.
This reduces the likelihood of private key leakage, improves the security of information processing, and reduces the risk of users participating in the management of private keys.
Smart Images

Figure CN116073991B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information security, and in particular to a private key generation method, electronic device, readable storage medium, and program product. Background Technology
[0002] With the increasing demands for information security in modern society, such as identity authentication and digital signatures, cryptographic technology has developed rapidly, and public-key cryptography has become one of the cornerstones of modern information security. In public-key cryptography, the encryption key (public key) and the decryption key (private key) are different keys. The public key can be publicly released, while the private key is kept secret by the user and must not be disclosed.
[0003] Currently, in public-key cryptography, private keys are often managed by the user themselves, such as being stored as files on portable storage devices. When authentication or digital signature is required, the user provides the corresponding private key to complete information security processing. In this way, the user can access the private key and needs to carry the storage device containing the private key, such as a USB flash drive, which can easily lead to the leakage of the private key. Summary of the Invention
[0004] This application provides a private key generation method, an electronic device, a readable storage medium, and a program product.
[0005] In a first aspect, embodiments of this application provide a private key generation method for an electronic device, the method comprising:
[0006] Obtain the preset key generation information;
[0007] Input the key generation information into the key generation module and obtain the candidate private key for the public-key cryptosystem output by the key generation module;
[0008] The candidate private key is formatted, and the formatting result is determined as the private key.
[0009] The private key is input into the security processing module so that the security processing module can perform information security processing based on the public key cryptography system according to the private key.
[0010] It is understandable that in existing public-key cryptosystems, private keys are randomly generated and managed by users, which can easily lead to private key leakage and consequently reduce the security of information security processing such as identity authentication and digital signatures. However, the private key generation method in this application can realize the automated generation of private keys in public-key cryptosystems, avoid private key leakage caused by user management of private keys, and improve the security of information security processing.
[0011] The above method can automatically generate private keys for public-key cryptosystems based on preset information, and provide the generated private keys to the security processing module for information security processing. There is no need to store the private keys, avoiding user involvement in private key management and reducing the possibility of private key leakage.
[0012] In one possible implementation of the first aspect described above, the key generation module generates candidate private keys through a key ladder mechanism.
[0013] The above method enables the automated generation of private keys for public-key cryptography. Private keys are only generated when needed, avoiding the need to store them and reducing the possibility of leakage.
[0014] In one possible implementation of the first aspect described above, the key generation information includes multiple key generation sub-information and security key information.
[0015] Using the above method, a private key can be generated based on preset security key information and key generation sub-information. Users can generate private keys using different numbers of key generation sub-information according to their own needs.
[0016] In one possible implementation of the first aspect described above, the multiple key generation sub-information includes first key generation information, second key generation information, and third key generation information.
[0017] By using the above method, the optimal number of key generation sub-information can be determined, thereby avoiding the use of excessive key generation information while ensuring key security.
[0018] In one possible implementation of the first aspect described above, the security key information is stored in a one-time programmable memory and can only be accessed by the key generation module.
[0019] By using the methods described above, the security of security key information can be guaranteed to the greatest extent and the leakage of security keys can be avoided.
[0020] In one possible implementation of the first aspect above, the key generation module includes a first algorithm unit, a second algorithm unit, and a third algorithm unit, which are used to encrypt or decrypt input data according to a preset algorithm.
[0021] By using the above method, the optimal number of algorithm units in the key generation module is determined, thereby accelerating the key generation speed while ensuring key security.
[0022] In one possible implementation of the first aspect described above, the method further includes:
[0023] The first key generation information and the security key information are input into the first algorithm unit to determine the first output result;
[0024] The second key generation information and the first output result are input into the second algorithm unit to determine the second output result;
[0025] The third key generation information and the second output result are input into the third algorithm unit to determine the third output result;
[0026] Use the third output as a candidate private key.
[0027] The above method enables the generation of candidate private keys in a public-key cryptosystem using a key ladder approach, ensuring the randomness of candidate private key generation.
[0028] In one possible implementation of the first aspect described above, the security processing module performs information security processing based on the elliptic curve cryptography algorithm.
[0029] The above methods enable various types of information security processing based on elliptic curve cryptography, thereby expanding the scope of use of the generated private keys.
[0030] In one possible implementation of the first aspect above, formatting the candidate private key and determining the formatted result as the private key includes:
[0031] Perform a modulo operation on the candidate private keys;
[0032] If the modulo operation result is non-zero, the modulo operation result is used as the private key.
[0033] By using the above method, the generated candidate private key can be adjusted to conform to the elliptic curve cryptography system, making it usable in elliptic curve cryptography.
[0034] Secondly, embodiments of this application provide an electronic device, including:
[0035] Memory, used to store instructions executed by one or more processors of an electronic device, and
[0036] A processor is one of the processors in an electronic device, used to execute the first aspect described above and any of the various possible implementations of the first aspect, including the private key generation method.
[0037] Thirdly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform any of the private key generation methods described in the first aspect and various possible implementations of the first aspect.
[0038] Fourthly, embodiments of this application provide a computer program product, including a computer program / instruction, which, when executed on a computer, causes the computer to perform any of the private key generation methods described in the first aspect and various possible implementations of the first aspect. Attached Figure Description
[0039] Figure 1 According to some embodiments of this application, a scenario diagram of a private key generation method is shown.
[0040] Figure 2 According to some embodiments of this application, a hardware structure diagram of an electronic device for a private key generation method is shown.
[0041] Figure 3 According to some embodiments of this application, a flowchart of a private key generation method is shown.
[0042] Figure 4 According to some embodiments of this application, a schematic diagram of the structure of a key generation module is shown.
[0043] Figure 5 According to some embodiments of this application, a schematic diagram of the parameter relationship of an elliptic curve algorithm is shown.
[0044] Figure 6 According to some embodiments of this application, a schematic flowchart of digital signature using elliptic curve cryptography is shown.
[0045] Figure 7 According to some embodiments of this application, a schematic diagram of a chip-based identity authentication scenario is shown.
[0046] Figure 8 According to some embodiments of this application, a hardware structure diagram of another electronic device for a private key generation method is shown. Detailed Implementation
[0047] The illustrative embodiments of this application include, but are not limited to, private key generation methods, electronic devices, readable storage media, and program products.
[0048] It is understood that the private key generation method of this application is applicable to scenarios in which a private key in an elliptic curve cryptosystem is generated based on information provided by the user, and provided to the elliptic curve cryptosystem for information security processing in an automated manner.
[0049] As mentioned earlier, in existing elliptic curve cryptography systems, private keys are randomly generated and managed by users, such as storing them as files on portable storage devices. When the private key is needed, the user provides it for authentication, digital signature, and other processing. In this process, excessive user involvement and poor management can easily lead to the leakage of private keys, which in turn reduces the security of authentication, digital signature, and other processing.
[0050] To address this issue, this application provides a more secure private key generation method. Users do not need to participate in the management and use of the private key; they only need to provide the information required to generate the private key, which can be automatically generated and directly provided to the security processing module based on the elliptic curve cryptography algorithm to complete the corresponding identity authentication, digital signature, and other processing. This reduces user involvement, avoids storing the private key in storage devices, thereby reducing the possibility of private key leakage and improving the security of identity authentication, digital signature, and other processing.
[0051] Figure 1 This is a schematic diagram illustrating a scenario of the private key generation method according to an embodiment of this application. Figure 1 As shown, the scenario includes an electronic device 100, a key generation module 200, and a security processing module 300.
[0052] Here, the electronic device 100 serves as the execution subject of the private key generation method in this application embodiment. It is used to generate the private key in the public key cryptosystem and provide the generated private key to the encryption system. The encryption system then performs corresponding information security processing such as encryption, identity authentication, and digital signature based on the private key.
[0053] The key generation module 200 is used to generate private keys in public-key cryptography. It can generate corresponding private keys based on information provided by the user, such as first key generation information, second key generation information, third key generation information and security key, and provide the private keys to the security processing module 300.
[0054] It is understood that the key generation method used in the key generation module 200 can be a variety of encryption / decryption algorithms, such as key ladder-based algorithms, pseudo-random number generation algorithms, etc., and this application embodiment does not specifically limit it.
[0055] Here, the first key generation information, the second key generation information, and the third key generation information are information provided by the user, who can use any information according to their own preferences. For example, the first key generation information, the second key generation information, and the third key generation information provided by the user can be strings, sequences of numbers, or sequences composed of characters and numbers, etc.
[0056] It is understood that the first key generation information, the second key generation information, and the third key generation information can be the same type of data, such as strings or number sequences, or they can be different types of data, such as the first key generation information being a string, the second key generation information being a number sequence, and the third key generation information being a sequence of characters and numbers, etc. This application does not specifically limit this.
[0057] It is understood that the number of first key generation information, second key generation information and third key generation information provided by the user is merely exemplary and does not represent a limitation on the number of information provided by the user. The key generation module 200 may request the user or other devices to provide multiple pieces of information as required by the corresponding requirements for generating the private key. This application embodiment does not make specific limitations in this regard.
[0058] The security key is used together with information provided by the user to generate a private key. The security key is information protected by appropriate security measures, such as chip identifiers, serial numbers, etc. The security measures may include allowing only the key generation module 200 to access the security key, while preventing other devices from accessing it.
[0059] The security processing module 300 is used to receive the generated private key, encrypt the input plaintext according to the private key, and output the corresponding ciphertext.
[0060] It is understood that the public-key cryptosystem used in the security processing module 300 can use a variety of elliptic curve-based cryptographic algorithms, and this application embodiment does not specifically limit this.
[0061] This application embodiment generates a private key in a public-key cryptosystem based on information provided by the user and a corresponding encryption / decryption algorithm, and transmits the generated private key to the security processing module in real time for the security processing module to use. This avoids storing the private key on a storage device, making it impossible for the user to directly access the private key, thereby reducing the possibility of private key leakage and improving the security of the private key.
[0062] The private key generation method of this application is suitable for scenarios where information security processing is performed using public-key cryptography.
[0063] It is understood that the electronic device 100 in this application embodiment may include, but is not limited to, mobile phones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), etc. This application embodiment does not impose specific restrictions on the specific type of electronic device 100.
[0064] Figure 2 A schematic diagram of the structure of an electronic device 100 for a private key generation method is shown according to an embodiment of this application. For example... Figure 2 As shown, the electronic device 100 may include a processor 110, a power module 140, a memory 180, a camera 170, a mobile communication module 130, a wireless communication module 120, a sensor module 190, an audio module 150, an interface module 160, and a display screen 102, etc.
[0065] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0066] Processor 110 may include one or more processing units, such as processing modules or circuits of central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), microprocessors (MCUs), AI (Artificial Intelligence) processors, or field-programmable gate arrays (FPGAs). Different processing units may be independent devices or integrated within one or more processors. For example, in some embodiments of this application, processor 110 may be used to perform a key generation process based on received user information, provide the generated key to an encryption device, and then execute a corresponding public-key cryptosystem encryption algorithm based on the key to convert plaintext into ciphertext.
[0067] The memory 180 can be used to store data, software programs, and modules. It can be volatile memory, such as random-access memory (RAM); or non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); or a combination of the above types of memory; or it can be a removable storage medium, such as a secure digital storage (SD) card. Specifically, the memory 180 may include a program storage area 1801 and a data storage area 1802. The program storage area 1801 can store program code, which is used to cause the processor 110 to execute the private key generation method provided in some embodiments of this application. In some embodiments of this application, the data storage area 1802 can be used to store user-provided information, elliptic curve parameters, etc.
[0068] The power module 140 may include a power supply, a power management component, etc. The power supply may be a battery. The power management component is used to manage the charging of the power supply and the power supply to other modules. The charging management module is used to receive charging input from the charger; the power management module is used to connect to the power supply and the processor 110.
[0069] The mobile communication module 130 may include, but is not limited to, antennas, power amplifiers, filters, and low-noise amplifiers (LNAs). The mobile communication module 130 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use on the electronic device 100. The mobile communication module 130 can receive electromagnetic waves via the antenna, filter and amplify the received electromagnetic waves, and then transmit them to a modem processor for demodulation. The mobile communication module 130 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via the antenna. In some embodiments, at least some functional modules of the mobile communication module 130 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 130 and at least some modules of the processor 110 may be housed in the same device.
[0070] The wireless communication module 120 may include an antenna, which enables the transmission and reception of electromagnetic waves. The wireless communication module 120 can provide solutions for wireless communication applications on the electronic device 100, including Wireless Local Area Networks (WLANs) (such as Wireless Fidelity (Wi-Fi) networks), Bluetooth (BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), and Infrared (IR) technologies. The electronic device 100 can communicate with networks and other devices via wireless communication technologies.
[0071] In some embodiments, the mobile communication module 130 and the wireless communication module 120 of the electronic device 100 may also be located in the same module.
[0072] Camera 170 is used to capture still images or videos. An optical image of the scene, generated by the lens, is projected onto a photosensitive element. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP (Image Signal Processor) to be converted into a digital image signal. Electronic device 100 can achieve its shooting function through an ISP, camera 170, video codec, GPU (Graphics Processing Unit), display screen 102, and application processor.
[0073] The display screen 102 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini LED, a Micro LED, a Micro OLED, a quantum dot light-emitting diode (QLED), etc. For example, the display screen 102 is used to display the plaintext display interface of the electronic device 100, etc.
[0074] The sensor module 190 may include proximity sensors, pressure sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, accelerometers, distance sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, bone conduction sensors, etc.
[0075] The audio module 150 can convert digital audio information into analog audio signals for output, or convert analog audio input into digital audio signals. The audio module 150 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 150 can be located in the processor 110, or some functional modules of the audio module 150 can be located in the processor 110. In some embodiments, the audio module 150 may include a speaker, a handset, a microphone, and a headphone jack.
[0076] Interface module 160 includes an external memory interface, a Universal Serial Bus (USB) interface, and a Subscriber Identification Module (SIM) card interface. The external memory interface can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface to perform data storage. The USB interface is used for communication between the electronic device 100 and other mobile phones. The SIM card interface is used to communicate with the SIM card installed in the electronic device 100, for example, to read or write phone numbers stored in the SIM card.
[0077] In some embodiments, the electronic device 100 further includes buttons 101, a motor, and indicators. The buttons 101 may include volume buttons, a power button, etc. The motor is used to generate a vibration effect in the electronic device 100. The indicators may include laser indicators, radio frequency indicators, LED indicators, etc.
[0078] For ease of description, the following uses a mobile phone as an example to illustrate the specific process of implementing the private key generation method of this application.
[0079] The following is based on Figure 3 This paper describes in detail the private key generation method of this application embodiment, using specific scenarios as examples. The execution subject of this method is mobile phone 100. Figure 3 As shown, the private key generation method in some embodiments of this application may include the following steps:
[0080] Step S301: Obtain the preset key generation information.
[0081] Here, the mobile phone 100 may include a key generation module and a security processing module. The key generation module is used to generate a private key that can be used in a public key cryptosystem based on the key generation information. The security processing module performs information security processing based on the public key cryptosystem based on the generated private key, such as identity verification and digital signature.
[0082] It is understood that the key generation information can be various types of information provided by the user, such as strings, number sequences, mixed sequences of characters and numbers, etc., or it can be automatically generated information, such as chip identifiers, generated random data, etc., or it can be a combination of user-provided information and automatically generated information. This application embodiment does not impose specific limitations on this.
[0083] In addition, it is understood that the key generation information may include multiple pieces of information, such as the first key generation information, the second key generation information, the third key generation information, and the security key provided by the user. This application embodiment does not impose specific limitations on this.
[0084] Here, the information provided by the user can be stored on the storage device of the mobile phone 100, or it can be provided by the user when information security-related processing is required.
[0085] In some embodiments of this application, the key generation information may include information that uniquely identifies the hardware, which may include, but is not limited to, hardware devices, chips, hardware components, hardware circuits, etc.
[0086] In some embodiments of this application, the key generation information includes a security key, which can be stored in a one-time programmable (OTP) memory. This security key can only be read by the key generation module; other devices of the mobile phone 100 do not have permission to read it. The security key information may be, for example, a unique root key for the chip. In this way, the security of the security key can be maximized, avoiding leakage of the security key due to unauthorized reading.
[0087] Here, one-time programmable memory is a special type of non-volatile memory that can only be programmed once. Once programmed, the data is permanently valid and is often used to store reliable and retrievable data.
[0088] Step S302: Generate a candidate private key for the public-key cryptosystem based on the key generation information.
[0089] It is understood that various encryption / decryption mechanisms can be used to generate candidate private keys based on key generation information, such as key ladder mechanism, pseudo-random number generation mechanism, etc., and this application embodiment does not impose specific limitations on this.
[0090] In some embodiments of this application, a key ladder mechanism is used to generate candidate private keys for public-key cryptography based on key generation information. A key ladder is a method of key generation that involves multiple encryption / decryption processes during the key generation process.
[0091] Figure 4 This application embodiment illustrates a schematic diagram of the structure of a key generation module 200. For example... Figure 4 As shown, the key generation module 200 includes a first algorithm unit, a second algorithm unit, and a third algorithm unit. Each algorithm unit performs corresponding encryption / decryption operations on the input key and key generation information through a preset encryption / decryption algorithm, and outputs the information processing result.
[0092] It is understood that each algorithm unit can perform encryption or decryption operations on the key generation information, and this application embodiment does not impose specific restrictions on this.
[0093] The following explanation uses the example of each algorithm unit decrypting the input information.
[0094] Here, the key generation module 200 reads the security key from the one-time programmable memory and obtains the first key generation information (KI1), and provides both types of information to the first algorithm unit; the first algorithm unit receives the first key generation information (KI1) and the security key, uses the security key as the decryption key, uses the first key generation information as ciphertext, performs a decryption operation on the first key generation information to obtain a first output result, and then provides the first output result to the second algorithm unit; the second algorithm unit receives the first output result and the second key generation information (KI2), uses the first output result as the decryption key, performs a decryption operation on the second key generation information to obtain a second output result, and then provides the second output result to the third algorithm unit; the third algorithm unit receives the second output result and the third key generation information (KI3), uses the second output result as the decryption key, performs a decryption operation on the third key generation information to obtain a third output result, and outputs the third output result as a generated candidate private key, which can be used in a public-key cryptosystem.
[0095] Understandable. Figure 4 The key generation module 200 shown includes three algorithm units. The number of algorithm units is only an example and is not a limitation on the number of algorithm units in the key generation module 200. There can be any number of algorithm units in the key generation module, and this application embodiment does not impose any specific limitation on this.
[0096] In some embodiments of this application, the algorithm unit uses a symmetric encryption / decryption algorithm. A symmetric encryption algorithm is one that uses the same key for both encryption and decryption. The security of this encryption algorithm depends on the key; leaking the key means anyone can decrypt sent or received messages. Therefore, key confidentiality is crucial in symmetric encryption algorithms. The characteristics of this encryption algorithm are that it is publicly available, computationally inexpensive, fast, and efficient.
[0097] In some embodiments of this application, the algorithm unit uses the Advanced Encryption Standard (AES) algorithm or the national commercial cryptographic algorithm SM4. Here, AES is a block cipher algorithm that divides the plaintext into multiple blocks, each of equal length, and encrypts one block at a time until the entire plaintext is encrypted. In the AES standard specification, the block length is 128 bits, i.e., each block is 16 bytes. The key length can be 128 bits, 192 bits, or 256 bits; the recommended number of encryption rounds varies depending on the key length.
[0098] The SM4 national commercial cryptographic algorithm is a block symmetric cipher algorithm independently designed in my country, which can be used to replace international algorithms such as DES / AES. The SM4 algorithm has the same block length as the AES algorithm, which is 128 bits.
[0099] It is understood that the use of AES or SM4 algorithms in the algorithm unit in the above embodiments is merely an example and is not intended to limit the algorithms that can be used in the algorithm unit. The algorithm unit can use any symmetric encryption / decryption algorithm, and this application embodiment does not impose any specific restrictions on this.
[0100] Step S303: Format the candidate private key.
[0101] Here, the candidate private key generated in step S302 may not meet the private key requirements of the public-key cryptosystem being used. Therefore, it is necessary to format the candidate private key accordingly to meet the private key requirements of the public-key cryptosystem. Specifically, the candidate private key generated by the key generation module 200 can be provided to the security processing module 300. The security processing module 300 formats the received candidate private key to obtain the private key, and then uses the obtained private key to perform corresponding information security processing.
[0102] In some embodiments of this application, the security processing module 300 uses elliptic curve cryptography as the public-key cryptography.
[0103] Elliptic curve cryptography (ECC) is a widely used public-key cryptosystem. Its security is based on the discrete logarithm problem on an elliptic curve. Due to its computational difficulty, it can provide a higher level of security with a smaller key. Elliptic curve cryptography offers the highest encryption strength per bit among known public-key cryptosystems. It is based on an elliptic curve, which is a plane curve defined in a rectangular coordinate system using the following formula (1).
[0104] y 2 +a1xy+a3y=x 3 +a2x 2 +a4x+a6 (1)
[0105] Wherein, coefficient a i (i = 1, 2, 3, 4, 6) is defined in some rational number field, irrational number field, complex number field, or finite field GF(pr). In computer applications, the finite field GF(pr) is usually used. In addition, every point on the elliptic curve must be non-singular, or "smooth", that is, mathematically, "there exists a tangent at any point".
[0106] Figure 5 This diagram illustrates the relationship between the parameters in the elliptic curve cryptography algorithm. For example... Figure 5 As shown, the elliptic curve cryptography algorithm used in public-key cryptosystems employs parameters N and G, where G is a point on the chosen elliptic curve, serving as the base point for generating the subgroup. The coordinates of G are a pair of two very large numbers, and N is the order of the elliptic curve subgroup. The private key d in the elliptic curve cryptography algorithm is a number in the range [1, N-1], and the public key Q is (Q... x Q y ), is calculated by multiplying the parameters N and G with the private key d.
[0107] In some embodiments of this application, the candidate private key is formatted to obtain a private key that meets the requirements of the elliptic curve algorithm. The received candidate private key can be subjected to a modulo N operation, where N is the order of the elliptic curve subgroup.
[0108] Here, the candidate private key is derived_key, and the formatted private key is d. The private key d can be obtained using the following formula:
[0109] d = derived_key mod N.
[0110] Where mod is the modulo operation, and the value range of the formatted private key d is [0, N-1].
[0111] It is understandable that if the formatted private key d is 0, since 0 cannot be used as a private key for the elliptic curve algorithm, the user needs to be informed that the first, second, and third key generation information provided so that the generated private key is 0 and cannot be used as a private key for the elliptic curve algorithm. The user needs to submit the modified first, second, and third key generation information to obtain a usable private key for the elliptic curve algorithm.
[0112] It is understood that the first key generation information, the second key generation information, and the third key generation information subsequently provided by the user may be modifications of one of these pieces of information, such as modifications of the second key generation information, or modifications of two or three of these pieces of information, such as modifications of the first key generation information and the third key generation information. This application embodiment does not impose specific limitations on this.
[0113] Step S304: Perform information security processing based on the formatted private key.
[0114] In some embodiments of this application, a formatted private key is used for information security processing based on the elliptic curve algorithm. Here, the formatted private key meets the numerical range requirements for private keys in the elliptic curve algorithm and can be used as a private key for the elliptic curve algorithm. The elliptic curve algorithm has a wide range of applications, and the corresponding information security processing can include, but is not limited to, encryption, decryption, digital signatures, and authentication. The following uses a digital signature scenario as an example to illustrate the process of using a formatted private key for information security processing.
[0115] Figure 6 A flowchart illustrating digital signatures using an elliptic curve cryptography algorithm according to some embodiments of this application is shown. Figure 6 As shown, the signature generation device 600 provides digital signature services using the Elliptic Curve Digital Signature Algorithm (ECDSA). The signature generation device 600 receives four sets of data: the elliptic curve parameters N and G, the formatted private key d, the hash value e to be signed, and a random number. It then performs a digital signature based on this data and outputs the final signature (r, s). The digital signature process performed by the signature generation device 600 includes the following steps:
[0116] Step S601: Randomly generate an integer k in [1, N-1].
[0117] Based on the parameter N of the received elliptic curve, determine the range of random number generation [1, N-1], and randomly select an integer in [1, N-1], and set this integer as k.
[0118] Step S602: Calculate the points on the elliptic curve.
[0119] Based on the random integer k obtained in the previous step and the base point G of the elliptic curve, a point on the elliptic curve is determined. The formula for calculating the coordinates (x1, y1) of this point is as follows:
[0120] (x1, y1) = k × G
[0121] Step S603: Calculate the parameter r in the digital signature.
[0122] Based on the coordinates of the points obtained in the previous step and the parameter N of the elliptic curve, determine r in the digital signature. The formula for calculating r is as follows:
[0123] r = x1 mod N
[0124] Step S604: Determine whether the calculated r is 0.
[0125] If the calculated r is 0, it means there is a problem with the selected random number k. Return to step S601 to regenerate the random integer k; if r is not 0, proceed to step S605.
[0126] Step S605: Calculate s, the parameter in the digital signature.
[0127] Based on the r obtained in the previous step and related parameters: random integer k, hash value e to be signed, formatted private key d, and elliptic curve parameter N, determine s in the digital signature. The formula for calculating s is as follows:
[0128] s = k -1 *(e+r*d)mod N
[0129] Step S606: Determine whether the obtained s is 0.
[0130] If the calculated s is 0, return to step S601 to regenerate a random integer k; if s is not 0, proceed to step S607.
[0131] Step S607: Return the generated signature (r, s).
[0132] After receiving the returned signature (r, s), the signature generation device 600 outputs the signature.
[0133] The private key generation method provided in this application has a wide range of applications, including but not limited to: chip-based authentication scenarios and identity authentication-based private key storage scenarios. For example, in a chip-based authentication scenario, the chip manufacturer can configure first key generation information, second key generation information, third key generation information, and a security key in the chip. The chip uses these three key generation information to generate a private key for the elliptic curve digital signature algorithm. Then, it uses the generated private key to digitally sign the message requiring authentication. The verifier obtains the public key corresponding to the generated private key from the chip supplier and then authenticates the received verification message containing the digital signature. As another example, in an identity authentication-based private key storage scenario, the IoT device only needs to store the first key generation information, second key generation information, third key generation information, and the security key, without needing to store the private key used. Storing the private key requires the IoT device to provide larger secure storage space, resulting in higher costs. Using the private key generation method provided in this application can save a significant amount of storage space, thereby improving security while reducing storage costs.
[0134] The following example illustrates a chip-based authentication application scenario. Figure 7 The illustration shows a scenario of chip-based identity authentication according to some embodiments of this application. For example... Figure 7 As shown, the chip supplier configures key generation information KI1, KI2, KI3 and a security key onto the chip through a chip supplier server. This information can be stored on the chip, for example, through production line programming. The chip can be of various types. The chip implements the private key generation method of this application embodiment, generating a private key for the elliptic curve digital signature algorithm based on the stored key generation information. The generated private key is then used to digitally sign the verification information to obtain the corresponding digital signature. The generated digital signature and verification information are then sent to the verification user. The verification user obtains the public key corresponding to the private key from the chip supplier server and uses the public key to verify the received digital signature and verification information, confirming that the received verification information indeed comes from the chip, thereby achieving chip-based identity authentication.
[0135] Figure 8 A block diagram of another electronic device 1400 for a private key generation method according to some embodiments of this application is shown. In one embodiment, the electronic device 1400 may include one or more processors 1404, system control logic 1408 connected to at least one of the processors 1404, system memory 1412 connected to the system control logic 1408, non-volatile memory (NVM) 1416 connected to the system control logic 1408, and network interface 1420 connected to the system control logic 1408.
[0136] In some embodiments, processor 1404 may include one or more single-core or multi-core processors. In some embodiments, processor 1404 may include any combination of general-purpose processors and special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). In embodiments where electronic device 1400 employs eNB (Evolved Node B) 101 or RAN (Radio Access Network) controller 102, processor 1404 may be configured to execute various embodiments applicable to the technical solutions of this application.
[0137] In some embodiments, system control logic 1408 may include any suitable interface controller to provide any suitable interface to at least one of the processors 1404 and / or any suitable device or component communicating with system control logic 1408.
[0138] In some embodiments, system control logic 1408 may include one or more memory controllers to provide an interface to system memory 1412. System memory 1412 may be used to load and store data and / or instructions. In some embodiments, memory 1412 of electronic device 1400 may include any suitable volatile memory, such as suitable dynamic random access memory (DRAM).
[0139] NVM / memory 1416 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, NVM / memory 1416 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as at least one of HDD (Hard Disk Drive), CD (Compact Disc) drive, and DVD (Digital Versatile Disc) drive.
[0140] NVM / Storage 1416 may include a portion of the storage resources on the device on which Electronics 1400 is installed, or it may be accessible by the device, but is not necessarily part of the device. For example, NVM / Storage 1416 may be accessed over a network via Network Interface 1420.
[0141] Specifically, system memory 1412 and NVM / memory 1416 may respectively include a temporary copy and a permanent copy of instruction 1424. In some embodiments, instruction 1424, hardware, firmware and / or its software components may additionally / alternatively reside in system control logic 1408, network interface 1420 and / or processor 1404.
[0142] Network interface 1420 may include a transceiver for providing a radio interface to electronic device 1400, thereby enabling communication with any other suitable device (such as a front-end module, antenna, etc.) via one or more networks. In some embodiments, network interface 1420 may be integrated into other components of electronic device 1400. For example, network interface 1420 may be integrated into at least one of processor 1404, system memory 1412, NVM / memory 1416, and firmware device (not shown) with instructions that, when at least one of processor 1404 executes the instructions, electronic device 1400 implements as follows: Figure 3 The method for generating a private key is shown.
[0143] The network interface 1420 may further include any suitable hardware and / or firmware to provide a multiple-input multiple-output radio interface. For example, the network interface 1420 may be a network adapter, a wireless network adapter, a telephone modem, and / or a wireless modem.
[0144] In one embodiment, at least one of the processors 1404 may be packaged together with the logic of one or more controllers for system control logic 1408 to form a system-in-package (SiP). In another embodiment, at least one of the processors 1404 may be integrated on the same die with the logic of one or more controllers for system control logic 1408 to form a system-on-a-chip (SoC).
[0145] The electronic device 1400 may further include an input / output (I / O) device 1432. The I / O device 1432 may include a user interface enabling a user to interact with the electronic device 1400; the peripheral component interface is designed to allow peripheral components to also interact with the electronic device 1400. In some embodiments, the electronic device 1400 may also include sensors for determining at least one type of environmental condition and location information related to the electronic device 1400.
[0146] In some embodiments, the user interface may include, but is not limited to, a display (e.g., a liquid crystal display, a touch screen display, etc.), a speaker, a microphone, one or more cameras (e.g., a still image camera and / or a video camera), a flashlight (e.g., a light-emitting diode flash), and a keyboard.
[0147] In some embodiments, the peripheral component interface may include, but is not limited to, a non-volatile memory port, an audio jack, and a power interface.
[0148] In some embodiments, the sensor may include, but is not limited to, a gyroscope sensor, an accelerometer, a proximity sensor, an ambient light sensor, and a positioning unit. The positioning unit may also be part of or interact with the network interface 1420 to communicate with components of the positioning network, such as Global Positioning System (GPS) satellites.
[0149] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0150] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a Digital Signal Processor (DSP), a microcontroller, an Application Specific Integrated Circuit (ASIC), or a microprocessor.
[0151] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.
[0152] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media include any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.
[0153] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.
[0154] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.
[0155] It should be noted that in the examples and description of this patent, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0156] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art should understand that various changes in form and detail may be made thereto without departing from the spirit and scope of this application.
Claims
1. A private key generation method for electronic devices, characterized in that, The method includes: Obtain preset key generation information, which includes key generation sub-information and security key information. The key generation sub-information is information provided by the user, and the security key information is stored in a one-time programmable memory and can only be accessed by the key generation module. Input the key generation information into the key generation module to obtain the candidate private key for public-key cryptography output by the key generation module based on the key generation information; The candidate private key is formatted, and the formatting result is determined as the private key. The private key is input into the security processing module so that the security processing module performs information security processing based on the public key cryptography system according to the private key. The candidate private key is formatted, and the formatted result is determined as the private key, including: Perform a modulo operation on the candidate private key; If the modulo operation result is non-zero, the modulo operation result is used as the private key.
2. The method according to claim 1, characterized in that, The key generation module generates the candidate private key through a key ladder mechanism.
3. The method according to claim 1, characterized in that, The key generation sub-information includes, First key generation information, second key generation information, and third key generation information.
4. The method according to claim 3, characterized in that, The key generation module includes a first algorithm unit, a second algorithm unit, and a third algorithm unit, which are used to encrypt or decrypt input data according to a preset algorithm.
5. The method according to claim 4, characterized in that, The method also includes: The first key generation information and the security key information are input into the first algorithm unit to determine the first output result; The second key generation information and the first output result are input into the second algorithm unit to determine the second output result; The third key generation information and the second output result are input into the third algorithm unit to determine the third output result; The third output result is used as the candidate private key.
6. The method according to claim 1, characterized in that, The security processing module performs information security processing based on the elliptic curve cryptography algorithm.
7. An electronic device, characterized in that, include: Memory, used to store instructions executed by one or more processors of an electronic device, and The processor is one of the processors in an electronic device, used to execute the private key generation method according to any one of claims 1-6.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the private key generation method according to any one of claims 1-6.
9. A computer program product, comprising a computer program / instructions, characterized in that, When executed on a computer, the computer program / instruction causes the computer to perform the private key generation method according to any one of claims 1-6.
Citation Information
Patent Citations
Private key obfuscation and digital signature generation method, device, and intelligent device
CN109145644A