CN118316601A - Block chain key generation method, device, equipment, medium and product - Google Patents

Block chain key generation method, device, equipment, medium and product Download PDF

Info

Publication number
CN118316601A
CN118316601A CN202410455770.9A CN202410455770A CN118316601A CN 118316601 A CN118316601 A CN 118316601A CN 202410455770 A CN202410455770 A CN 202410455770A CN 118316601 A CN118316601 A CN 118316601A
Authority
CN
China
Prior art keywords
key
random number
sub
private
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410455770.9A
Other languages
Chinese (zh)
Inventor
周铭城
李曼潇
邹晓梦
龚开圳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Publication of CN118316601A publication Critical patent/CN118316601A/en
Pending legal-status Critical Current

Links

Abstract

The application provides a key generation method, device, equipment, medium and product of a blockchain, and relates to the field of blockchains. The method comprises the steps of obtaining current operation information of hardware, carrying out coding processing on the operation information to obtain a first random number, generating a second random number by calling a quantum random number generator, generating a target random number sequence according to the first random number and the second random number, carrying out calculation processing on the target random number sequence based on an elliptic curve algorithm to obtain a master key pair, and carrying out calculation processing on a master private key in the master key pair by using a key derivation algorithm to obtain a plurality of sub key pairs; the method not only solves the problem that the resource requirement is too high when a long random number sequence is generated by using a quantum computer, but also improves the generation efficiency of the random number sequence, thereby improving the efficiency of generating the secret key.

Description

Block chain key generation method, device, equipment, medium and product
Technical Field
The present application relates to the field of blockchain, and in particular, to a method, apparatus, device, medium, and product for generating a blockchain key.
Background
As the usage rate of elliptic curve cryptography is higher and higher, in its application scenario, the quality of the random number has a great impact on the security of encryption, because the generation of the private key in the elliptic curve cryptography is derived from a secret random number. In practice, however, these random numbers are generated by deterministic algorithms, with extremely high insecurity. In recent years, with the continuous development of science and technology, the available computing resources and computing power of third parties also increase dramatically, which makes the existing information encryption technology easier to crack when random numbers are generated by specific algorithms.
In order to solve the problem that the quality of random numbers affects the safety of information encryption, the prior art proposes an elliptic curve encryption method using quantum random numbers, specifically, unpredictable random numbers are generated through a quantum random number generator, then the random numbers are input into an elliptic curve, and a pair of public keys and private keys are obtained through a public-private key pair generation algorithm.
However, the existing elliptic curve encryption method using the quantum random number has the following problems: the resource requirement is too high, a special quantum computer is required for generating the quantum random number, and the equipment is expensive; the time for generating the random number is longer, the efficiency is lower, the key generation efficiency is lower, and real-time application or high-throughput application cannot be met.
Disclosure of Invention
The application provides a key generation method, device, equipment, storage medium and product of a blockchain, which are used for solving the problems of high resource requirement and low key generation efficiency of the existing elliptic curve encryption method using a quantum random number.
In a first aspect, the present application provides a method for generating a key of a blockchain, including:
acquiring current operation information of hardware, and performing coding processing on the operation information to obtain a first random number;
generating a second random number by invoking the quantum random number generator;
Generating a target random number sequence according to the first random number and the second random number, wherein the target random number sequence is a random number sequence generated by a Meissen rotation algorithm;
and calculating the target random number sequence based on an elliptic curve algorithm to obtain a master key pair, and calculating a master private key in the master key pair by using a key derivation algorithm to obtain a plurality of sub key pairs.
Optionally, the generating a target random number sequence according to the first random number and the second random number includes:
combining the first random number and the second random number to obtain a third random number;
Taking the third random number as a seed of the Meisen rotation algorithm, and performing cyclic shift processing and exclusive OR operation processing on the seed to obtain a target seed;
And extracting the target seed for multiple times to generate a plurality of fourth random numbers, and combining the plurality of fourth random numbers to obtain the target random number sequence.
Optionally, the master key pair includes: the elliptic curve algorithm-based calculation processing is performed on the target random number sequence to obtain a master key pair, and the method comprises the following steps:
Carrying out hash operation processing on the target random number sequence to obtain a main private key;
Determining a target base point on the target elliptic curve according to the target elliptic curve in the elliptic curve algorithm;
and generating a main public key based on the elliptic curve algorithm according to the target base point and the main private key.
Optionally, the calculating the master key and the private key in the master key pair by using a key derivation algorithm to obtain a plurality of sub key pairs includes:
Dividing the main private key according to the preset byte size to obtain a father private key and a father chain code;
Performing operation processing on the father private key and the father chain code based on the key derivation algorithm to obtain a plurality of child private keys;
and carrying out operation processing on the plurality of sub-private keys and the target base point based on the elliptic curve algorithm to obtain a plurality of sub-public keys, wherein the sub-public keys and the sub-private keys have corresponding relations.
Optionally, the performing operation processing on the parent private key and the parent chain code based on the key derivation algorithm to obtain a plurality of child private keys includes:
Inputting the parent private key, the parent chain code and a first index value into a key derivation function to obtain a first child private key and a first child chain code which are output by the key derivation function, wherein the index value is a sequence number value corresponding to the increment sequence of the child key pair derivation;
and inputting the father-private key, the father-chain code and the second index value into the key derivation function to obtain a second child-private key and a second child-chain code output by the key derivation function.
Optionally, the method further comprises:
generating an address of each sub-public key according to the index values and the identification information corresponding to the plurality of sub-public keys;
Generating an address of each sub private key according to index values and identification information corresponding to the plurality of sub private keys;
And storing the plurality of sub-key pairs into a hierarchical deterministic wallet according to the address of each sub-private key and the address of the sub-public key.
Optionally, the method further comprises:
Calculating the plurality of child private keys based on the key derivation algorithm to generate a plurality of grandchild key pairs;
And storing the plurality of grandchild key pairs into the hierarchical deterministic wallet according to the addresses corresponding to the plurality of grandchild key pairs, wherein the addresses of the grandchild key pairs are determined according to the identification information and the index value of the grandchild key pairs.
Optionally, the calculating the plurality of child private keys based on the key derivation algorithm generates a plurality of grandchild key pairs, including:
Performing operation processing on the plurality of sub-private keys and sub-chain codes corresponding to the plurality of sub-private keys based on the key derivation algorithm to obtain a plurality of grandchild private keys;
And calculating the plurality of grandchild private keys based on the elliptic curve algorithm to obtain a plurality of grandchild public keys, wherein the grandchild public keys and the grandchild private keys have corresponding relations.
In a second aspect, the present application provides a key generation apparatus for a blockchain, comprising:
The acquisition module is used for acquiring the current operation information of the hardware;
the processing module is used for carrying out coding processing on the operation information to obtain a first random number;
the processing module is further used for generating a second random number by calling the quantum random number generator;
the processing module is further configured to generate a target random number sequence according to the first random number and the second random number, where the target random number sequence is a random number sequence generated by a meisen rotation algorithm;
The processing module is further configured to perform calculation processing on the target random number sequence based on an elliptic curve algorithm to obtain a master key pair, and perform calculation processing on a master private key in the master key pair by using a key derivation algorithm to obtain a plurality of sub-key pairs.
Optionally, the processing module is further configured to combine the first random number and the second random number to obtain a third random number;
The processing module is further configured to use the third random number as a seed of the meisen rotation algorithm, and perform cyclic shift processing and exclusive-or operation processing on the seed to obtain a target seed;
the processing module is further configured to perform multiple extraction processing on the target seed, generate a plurality of fourth random numbers, and combine the plurality of fourth random numbers to obtain the target random number sequence.
Optionally, the processing module is further configured to perform hash operation on the target random number sequence to obtain a master private key;
the processing module is further used for determining a target base point on the target elliptic curve according to the target elliptic curve in the elliptic curve algorithm;
and the processing module is also used for generating a main public key based on the elliptic curve algorithm according to the target base point and the main private key.
Optionally, the processing module is further configured to perform segmentation processing on the master private key according to a preset byte size to obtain a parent private key and a parent chain code;
The processing module is further used for carrying out operation processing on the father private key and the father chain code based on the key derivation algorithm to obtain a plurality of child private keys;
The processing module is further configured to perform operation processing on the plurality of sub-private keys and the target base point based on the elliptic curve algorithm, so as to obtain a plurality of sub-public keys, where the sub-public keys have a corresponding relationship with the sub-private keys.
Optionally, the processing module is further configured to input the parent-private key, the parent-chain code, and a first index value into a key derivation function, to obtain a first child-private key and a first child-chain code output by the key derivation function, where the index value is a sequence number value corresponding to an increasing order of the child-key pair derivation;
The processing module is further configured to input the parent private key, the parent chain code and the second index value into the key derivation function, and obtain a second child private key and a second child chain code output by the key derivation function.
Optionally, the apparatus further includes: a generating module;
the generation module is used for generating an address of each sub-public key according to the index values and the identification information corresponding to the plurality of sub-public keys;
the generating module is further configured to generate an address of each sub-private key according to the index values and the identification information corresponding to the plurality of sub-private keys;
The processing module is further configured to store the plurality of sub-key pairs into a hierarchical deterministic wallet according to the address of each sub-private key and the address of the sub-public key.
Optionally, the processing module is further configured to perform calculation processing on the plurality of child private keys based on the key derivation algorithm, and generate a plurality of grandchild key pairs;
The processing module is further configured to store the plurality of grandchild key pairs into the hierarchical deterministic wallet according to addresses corresponding to the plurality of grandchild key pairs, where the addresses of the grandchild key pairs are determined according to identification information and index values of the grandchild key pairs.
Optionally, the processing module is further configured to perform operation processing on the plurality of child private keys and the child chain codes corresponding to the plurality of child private keys based on the key derivation algorithm, so as to obtain a plurality of grandchild private keys;
The processing module is further configured to perform calculation processing on the plurality of grandchild private keys based on the elliptic curve algorithm to obtain a plurality of grandchild public keys, where the grandchild public keys have a corresponding relationship with the grandchild private keys.
In a third aspect, the present application provides a key generation apparatus of a blockchain, comprising:
A memory;
A processor;
wherein the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the blockchain key generation method as described in the first aspect and various possible implementations of the first aspect.
In a fourth aspect, the present application provides a computer storage medium having stored thereon computer-executable instructions that are executed by a processor to implement a blockchain key generation method as described in the first aspect and various possible implementations of the first aspect.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements a blockchain key generation method as described above.
According to the key generation method of the blockchain, the current operation information of hardware is obtained, the operation information is coded to obtain a first random number, a quantum random number generator is called to generate a second random number, a target random number sequence is generated according to the first random number and the second random number, calculation processing is carried out on the target random number sequence based on an elliptic curve algorithm to obtain a master key pair, and calculation processing is carried out on a master private key in the master key pair by using a key derivation algorithm to obtain a plurality of sub key pairs; the method not only solves the problem that the resource requirement is too high when a long random number sequence is generated by using a quantum computer, but also improves the generation efficiency of the random number sequence, thereby improving the efficiency of generating the secret key.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a flowchart illustrating a method for generating a key of a blockchain according to the present application;
FIG. 2 is a second flowchart of a method for generating a key of a blockchain according to the present application;
FIG. 3 is a schematic diagram of a block chain key generation device according to the present application;
Fig. 4 is a schematic structural diagram of a key generating device of a blockchain provided by the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, displayed data, etc.) related to the present application are information and data authorized by the user or fully authorized by each party, and the related data are collected, used, processed, transmitted, provided, disclosed, applied, etc. processed, all obeys the related laws and regulations and standards of the related country and region, necessary security measures are taken, no prejudice to the public order colloquial is provided, and corresponding operation entrance is provided for the user to select authorization or rejection.
It should be noted that, the method, the device, the equipment, the medium and the product for generating the key of the blockchain can be used in the field of artificial intelligence, and can also be used in any field except the field of artificial intelligence.
As the usage rate of elliptic curve cryptography is higher and higher, in its application scenario, the quality of the random number has a great impact on the security of encryption, because the generation of the private key in the elliptic curve cryptography is derived from a secret random number. In practice, however, these random numbers are generated by deterministic algorithms, with extremely high insecurity. In recent years, with the continuous development of science and technology, the available computing resources and computing power of third parties also increase dramatically, which makes the existing information encryption technology easier to crack when random numbers are generated by specific algorithms.
In order to solve the problem that the quality of random numbers affects the safety of information encryption, the prior art proposes an elliptic curve encryption method using quantum random numbers, specifically, unpredictable random numbers are generated through a quantum random number generator, then the random numbers are input into an elliptic curve, and a pair of public keys and private keys are obtained through a public-private key pair generation algorithm.
However, the existing elliptic curve encryption method using the quantum random number has the following problems: the resource requirement is too high, a special quantum computer is required for generating the quantum random number, and the equipment is expensive; the time for generating the random number is longer, the efficiency is lower, and real-time application or high throughput application cannot be satisfied.
In view of the above, the present application provides a key generation method for a blockchain.
First, an implementation scenario according to the present application will be described.
The basic process of data encryption is to process the original file or data in plaintext according to a certain algorithm to make it become an unreadable code section as cipher text, so that it can only display the original content after inputting the corresponding key, and the purpose of protecting the data from being stolen and read by illegal persons is achieved by such a way. The reverse of this process is decryption, i.e., the process of converting the encoded information into its original data. While the key is a specific parameter used in the encryption or decryption process that determines how the encryption algorithm is specifically applied. The key is one of the key elements of cryptography, and the encryption algorithm cannot work normally without the key.
In general, in order to ensure the anonymity of users in a blockchain, users often generate a plurality of private keys so as to ensure that each transaction cannot be tracked, a non-deterministic wallet method randomly generates a plurality of public and private key pairs, the private keys need to be repeatedly backed up, and the private keys are imported to be signed by using the private keys, so that the system occupies space and is inconvenient to use. Thus, a hierarchical deterministic wallet technique has emerged that uses a "seed" and one-way hash function to generate a set of private keys, which allows a series of related key pairs to be generated from a single seed, including a master account key and an unlimited number of sub-account keys, with hierarchical relationships between the different sub-accounts forming a tree structure with the master account as the root node, so that the randomness of the "seed" is self-evident to the importance of generating the keys.
The application provides a key generation method of a blockchain, which comprises the steps of obtaining operation information of hardware, carrying out coding processing on the operation information to obtain a hardware coding random number, calling a quantum random number generator to obtain a quantum random number, combining the hardware coding random number and the quantum random number to generate a new random number sequence, inputting the random number sequence into an elliptic curve as a seed to generate a master key pair, and carrying out hierarchical derivation processing on a master private key in the master key pair based on a key derivation algorithm to obtain a plurality of sub key pairs; the method not only solves the problem that the resource requirement is too high when a long random number sequence is generated by using a quantum computer, but also improves the generation efficiency of the random number sequence, thereby improving the efficiency of generating the secret key.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 is a flowchart illustrating a method for generating a key of a blockchain according to an embodiment of the present application. The execution body of the embodiment may be, for example, a technical retrofit system provided with an auxiliary retrofit function module. As shown in fig. 1, the method for generating a key of a blockchain provided in this embodiment includes:
S101, acquiring current operation information of hardware, and performing coding processing on the operation information to obtain a first random number.
The operation information is used for indicating an operation state in the hardware device, and the operation information can be, for example, temperature information, voltage information, fan rotation speed information and the like.
For example, an instruction for acquiring operation information may be sent to a hardware sensor on a computer, so that the state and data of the corresponding hardware may be acquired by the hardware sensor, where the data includes information such as a temperature, a voltage, or a fan rotation speed of the CPU, and the acquired operation information may be encoded by using a hardware encoding manner to obtain the first random number.
S102, generating a second random number by calling a quantum random number generator.
Among these, a quantum random number generator is a device that generates random numbers based on the probabilistic nature of quantum mechanics rather than a computer program. Quantum random number generators can count microscopic phenomena of random "noise" signals, such as thermal noise, photoelectric effects involving beam splitters, and other quantum phenomena.
For example, the quantum random number generator can be called, so that a measuring device in the quantum random number generator measures an isentropic source of ambient noise to obtain initial data, the initial data is influenced by factors such as ambient noise, nonideal entropy source, measuring noise and the like, so that the initial data has certain bias and correlation, entropy estimation needs to be carried out on the initial data, then the randomness is extracted through a post-processing algorithm, and finally the complete quantum random number, namely the second random number, is obtained.
S103, generating a target random number sequence according to the first random number and the second random number.
The target random number sequence is a random number sequence generated through a Mersen rotation algorithm, wherein the Mersen rotation algorithm is an algorithm for initializing and iteratively updating random number seeds, extracting and converting the random number seeds into random numbers in a required range from updated data.
For example, the first random number and the second random number may be used as initial seeds of a meisen rotation algorithm, the initial seeds are input into the meisen rotation algorithm, the state initialization processing is performed on the seed value by the meisen rotation algorithm, for example, an array formed by the first random number and the second random number is initially transformed by a linear congruence method, after an initialized state array is obtained, a cyclic iteration processing is performed by the meisen rotation algorithm to generate a new state array, a target random number is extracted and output from the updated state array, and a random number sequence formed by the obtained target random number is a target random number sequence, where the iterative processing includes: and carrying out shifting and rotating treatment on the state elements in the state array, carrying out mixing treatment on the rotated state elements and other elements, backfilling the mixed state elements to the same position in the state array, and covering the original values.
The method aims at solving the problem of the rate of generating the long random sequence by the quantum random number by generating the target random number sequence according to the combination of the first random number and the second random number so as to meet the application requirement of needing the longer random number sequence.
S104, calculating the target random number sequence based on an elliptic curve algorithm to obtain a master key pair, and calculating a master private key in the master key pair by using a key derivation algorithm to obtain a plurality of sub key pairs.
The master key pair comprises a master public key and a master private key, a corresponding relation exists between the master public key and the master private key, the sub key pair comprises a sub private key and a sub public key, and a corresponding relation also exists between the sub public key and the sub private key.
Elliptic curve algorithm refers to a public key encryption algorithm based on elliptic curve mathematics, which utilizes mathematical characteristics on elliptic curves to protect transaction and data security, and the security of the elliptic curve algorithm depends on the difficulty of solving the discrete logarithm problem of the elliptic curve, such as point addition and scalar multiplication.
For example, a secp k1 elliptic curve may be used, the target random number sequence is taken as a private key d, a base point P on the secp k1 elliptic curve is selected, a product Q of the base point P and the target random number sequence is calculated, and the obtained Q is taken as a public key corresponding to the private key d, where the private key d and the public key Q are corresponding, i.e. a master key pair.
The key derivation algorithm is an algorithm for deriving a key through a key derivation function to obtain a plurality of keys, and the master key recursively generates other keys in the tree through the key derivation function and specific derivation path information. Each level of derivative may introduce new input parameters (e.g., index, label, context information, etc.) to ensure that the derived key is closely associated with the level and location at which it is located. Also, hierarchical key derivation algorithms utilize strong cryptographic hash functions like PBKDF2, HKDF, scrypt, etc., which have unipolarity and irreversibility, i.e., the key derived from cannot be easily derived back to the original master key or intermediate key, thus protecting the security of the key. The key derivation function may be, for example, an HMAC-SHA512 function, and the main private key is calculated according to the key derivation algorithm, so that a plurality of sub-private keys corresponding to the main private key may be obtained, and each sub-private key may also calculate its corresponding sub-public key, because of the mathematical relationship between the sub-private key and the sub-public key.
It will be appreciated that the master private key may be used to encrypt and decrypt data, the master public key is used to verify signatures and encrypt data, the master key pair may be used for the management of the master account of the blockchain-based wallet account, whereas in a practical application scenario, one user may have multiple accounts, and thus the sub-key pair may be used for the management of the sub-accounts of the blockchain-based wallet account.
According to the key generation method of the blockchain, the current operation information of hardware is obtained, the operation information is coded to obtain a first random number, a quantum random number generator is called to generate a second random number, a target random number sequence is generated according to the first random number and the second random number, calculation processing is conducted on the target random number sequence based on an elliptic curve algorithm to obtain a master key pair, and calculation processing is conducted on a master private key in the master key pair by using a key derivation algorithm to obtain a plurality of sub key pairs; the method not only solves the problem that the resource requirement is too high when a long random number sequence is generated by using a quantum computer, but also improves the generation efficiency of the random number sequence, thereby improving the efficiency of generating the secret key.
Fig. 2 is a flowchart illustrating a method for generating a blockchain key according to an embodiment of the present application. As shown in fig. 2, the present embodiment describes in detail a key generation method of a blockchain on the basis of the embodiment of fig. 1, and the key generation method of a blockchain shown in the present embodiment includes:
s201, acquiring current operation information of hardware, and performing coding processing on the operation information to obtain a first random number.
Step S201 is similar to step S101 described above, and will not be described again.
S202, generating a second random number by calling a quantum random number generator.
Step S202 is similar to step S2102 described above, and will not be described again.
S203, combining the first random number and the second random number to obtain a third random number.
The purpose of combining the first random number and the second random number to obtain the third random number is to increase the length of the random number so as to improve the quality of the random number, and compared with the existing method for generating the long-sequence random number by a quantum computer, the method for generating the long-sequence random number by the quantum computer has higher efficiency and lower resource requirement.
S204, taking the third random number as a seed of the Meissen rotation algorithm, and performing cyclic shift processing and exclusive OR operation processing on the seed to obtain a target seed.
Before performing cyclic displacement processing on the third random number, state initialization processing may be performed on the third random number to obtain a state vector corresponding to the third random number, elements in the state vector are rotated rightward through cyclic right-shift processing, an exclusive-or operation is performed on a rotated result and a fixed constant matrix, a value obtained through the exclusive-or operation is backfilled to a position in the state vector where the element is located so as to cover an original element, after performing multiple shifting processing and exclusive-or operation on seeds, a plurality of random numbers are obtained, the random numbers are used as target seeds, the exclusive-or operation processing refers to a logic operation method in which two inputs are compared, and a new binary bit is returned as output according to a comparison result.
S205, extracting the target seeds for a plurality of times to generate a plurality of fourth random numbers, and combining the fourth random numbers to obtain the target random number sequence.
The method comprises the steps of performing cyclic shift processing and exclusive-or operation on a third random number to obtain a plurality of random numbers, namely target seeds, wherein the random numbers are not necessarily in a value interval required by a user, so that the target seeds are required to be extracted for multiple times, the proposed elements are truncated, namely only a part of bits of the elements are taken, the numerical value after the truncated is mapped into a value range required by the user, a plurality of fourth random numbers are obtained, and the fourth random numbers are spliced and combined to obtain a target random number sequence.
S206, carrying out hash operation processing on the target random number sequence to obtain a main private key.
The hash operation refers to inputting the target random number sequence into a hash function to obtain a hash value output by the hash function, and taking the hash value as a main private key, and the hash function can be, for example, functions of SHA-224, SHA-256, SHA-384, SHA-512 and the like.
S207, determining a target base point on the target elliptic curve according to the target elliptic curve in the elliptic curve algorithm.
The elliptic curve used by the elliptic curve algorithm is a target elliptic curve, a target elliptic curve equation can be determined according to the type and domain parameters of the elliptic curve, a fixed point is taken as a target base point on the target elliptic curve equation, and the target base point is used for generating all non-infinite points on the elliptic curve, namely, each point on the target elliptic curve can be expressed as integer multiples of the target base point.
S208, generating a main public key based on the elliptic curve algorithm according to the target base point and the main private key.
For example, the target base point and the master private key are added to obtain the master public key corresponding to the master private key.
S209, dividing the main private key according to the preset byte size to obtain a father private key and a father chain code.
The preset byte may be, for example, 32 bytes, and since the master private key is a random number sequence, the master private key may be divided into two 32 byte sequences, and the left sequence is used as a parent private key, and the right sequence is used as a parent chain for encoding.
S210, carrying out operation processing on the father private key and the father chain code based on the key derivation algorithm to obtain a plurality of child private keys.
The key derivation algorithm is a hierarchical key derivation algorithm based on a key derivation function in the BIP32 protocol. For example, the parent private key, the parent chain code and a first index value may be input into a key derivation function, so as to obtain a first child private key and a first child chain code output by the key derivation function, where the index value is a sequence number value corresponding to an increasing order of the child key pair derivation, for example, the first index value corresponding to the first child private key may be 0.
And inputting the father-private key, the father-chain code and a second index value into the key derivation function to obtain a second child-private key and a second child-chain code output by the key derivation function, wherein the second index value can be 1.
S211, carrying out operation processing on the plurality of sub-private keys and the target base point based on the elliptic curve algorithm to obtain a plurality of sub-public keys.
For example, according to the mathematical relationship between the sub-private key and the sub-public key in the elliptic curve algorithm, the point corresponding to the sub-private key on the elliptic curve is multiplied by the target base point, and the coordinates of the obtained result point can form the sub-public key.
S212, generating an address of each sub-public key according to index values and identification information corresponding to the plurality of sub-public keys, and generating the address of each sub-private key according to the index values and the identification information corresponding to the plurality of sub-private keys.
For example, if the identification information of the first sub-private key is M and the first index value is 0, the address of the first sub-private key is M/0, the identification information of the first sub-public key is M, and if the first index value is 0, the address corresponding to the first sub-public key is M/0.
S213, storing the plurality of sub-key pairs into a hierarchical deterministic wallet according to the address of each sub-private key and the address of the sub-public key.
It will be appreciated that the digital assets in the blockchain account are stored in wallet addresses derived from private keys and placed on the blockchain network. Only the private key corresponding to the address is owned, and the operation authority is possessed. Thus, the hierarchical deterministic wallet is effectively a tool to generate and store key pairs that does not hold assets, all of which are in a chain. The sub-key pair may be used for management of sub-accounts of the blockchain-based wallet account.
The combination has the advantages that a large number of sub-key pairs can be easily managed and backed up by using a key derivation algorithm, each sub-key pair does not need to be independently backed up, and meanwhile, stronger encryption and signature functions can be realized in the hierarchical deterministic wallet by using the security and efficiency provided by an elliptic curve algorithm.
Optionally, after generating the plurality of sub-key pairs, the computing process may be further performed on the plurality of sub-private keys based on the key derivation algorithm, to generate a plurality of grandchild key pairs, and the plurality of grandchild key pairs are stored in the hierarchical deterministic wallet according to addresses corresponding to the plurality of grandchild key pairs, where the addresses of the grandchild key pairs are determined according to identification information and index values of the grandchild key pairs.
By way of example, a possible implementation manner of generating a plurality of grandchild key pairs by performing calculation processing on the plurality of child private keys based on the key derivation algorithm is presented herein: performing operation processing on the plurality of sub-private keys and sub-chain codes corresponding to the plurality of sub-private keys based on the key derivation algorithm to obtain a plurality of grandchild private keys;
And calculating the plurality of grandchild private keys based on the elliptic curve algorithm to obtain a plurality of grandchild public keys, wherein the grandchild public keys and the grandchild private keys have corresponding relations.
According to the key generation method of the blockchain, the current operation information of hardware is obtained, the operation information is coded to obtain a first random number, a quantum random number generator is called to generate a second random number, the first random number and the second random number are combined to obtain a third random number, the third random number is used as a seed of the mersen rotation algorithm, the seed is circularly shifted and subjected to exclusive-or operation to obtain a target seed, the target seed is subjected to multiple extraction processing to generate a plurality of fourth random numbers, the fourth random numbers are combined to obtain a target random number sequence, the target random number sequence is subjected to hash operation processing to obtain a master private key, a target base point on the target elliptic curve is determined according to a target elliptic curve in the elliptic curve algorithm, a master public key is generated based on the father private curve algorithm, the master private key is processed according to a preset byte size, the multiple keys are obtained by performing the public key and the public key, the multiple keys are obtained by corresponding to each private key, the multiple keys are obtained by the public key and the multiple keys, the multiple keys are obtained by the multiple keys and the multiple keys are calculated according to the private key index and the multiple keys, the multiple keys are obtained by the multiple keys and the multiple keys are calculated by the multiple keys and the multiple keys are obtained by the corresponding to the private key index and the multiple keys, storing the plurality of sub-key pairs in a hierarchical deterministic wallet; the method not only solves the problem that the resource requirement is too high when a long random number sequence is generated by using a quantum computer, but also improves the generation efficiency of the random number sequence, thereby improving the efficiency of generating the secret key.
Fig. 3 is a schematic diagram of a key generating device of a blockchain according to the present application. As shown in fig. 3, the present application provides a key generation apparatus of a blockchain, the key generation apparatus 300 of the blockchain including:
An obtaining module 301, configured to obtain current operation information of hardware;
The processing module 302 is configured to perform encoding processing on the operation information to obtain a first random number;
The processing module 302 is further configured to generate a second random number by invoking a quantum random number generator;
The processing module 302 is further configured to generate a target random number sequence according to the first random number and the second random number, where the target random number sequence is a random number sequence generated by a meisen rotation algorithm;
the processing module 302 is further configured to perform calculation processing on the target random number sequence based on an elliptic curve algorithm to obtain a master key pair, and perform calculation processing on a master private key in the master key pair by using a key derivation algorithm to obtain a plurality of sub-key pairs.
Optionally, the processing module 302 is further configured to combine the first random number and the second random number to obtain a third random number;
the processing module 302 is further configured to use the third random number as a seed of the meisen rotation algorithm, and perform cyclic shift processing and exclusive-or operation processing on the seed to obtain a target seed;
The processing module 302 is further configured to perform multiple extraction processing on the target seed, generate a plurality of fourth random numbers, and combine the plurality of fourth random numbers to obtain the target random number sequence.
Optionally, the processing module 302 is further configured to perform hash operation on the target random number sequence to obtain a master private key;
the processing module 302 is further configured to determine a target base point on the target elliptic curve according to a target elliptic curve in the elliptic curve algorithm;
The processing module 302 is further configured to generate a master public key based on the elliptic curve algorithm according to the target base point and the master private key.
Optionally, the processing module 302 is further configured to perform segmentation processing on the master private key according to a preset byte size to obtain a parent private key and a parent chain code;
The processing module 302 is further configured to perform an operation process on the parent private key and the parent chain code based on the key derivation algorithm, so as to obtain a plurality of child private keys;
The processing module 302 is further configured to perform an operation process on the plurality of sub-private keys and the target base point based on the elliptic curve algorithm, so as to obtain a plurality of sub-public keys, where the sub-public keys have a corresponding relationship with the sub-private keys.
Optionally, the processing module 302 is further configured to input the parent-private key, the parent-chain code, and a first index value into a key derivation function, to obtain a first child-private key and a first child-chain code output by the key derivation function, where the index value is a sequence number value corresponding to an increasing order of the child-key pair derivation;
The processing module 302 is further configured to input the parent private key, the parent chain code, and the second index value into the key derivation function, and obtain a second child private key and a second child chain code output by the key derivation function.
Optionally, the apparatus further includes: a generation module 303;
the generating module 303 is configured to generate an address of each sub-public key according to the index values and the identification information corresponding to the plurality of sub-public keys;
the generating module 303 is further configured to generate an address of each sub-private key according to the index values and the identification information corresponding to the plurality of sub-private keys;
The processing module 302 is further configured to store the plurality of subkey pairs into a hierarchical deterministic wallet according to the address of each subprivate key and the address of the subpublic key.
Optionally, the processing module 302 is further configured to perform a calculation process on the plurality of child private keys based on the key derivation algorithm, to generate a plurality of grandchild key pairs;
the processing module 302 is further configured to store the plurality of grandchild key pairs into the hierarchical deterministic wallet according to addresses corresponding to the plurality of grandchild key pairs, where the addresses of the grandchild key pairs are determined according to identification information and index values of the grandchild key pairs.
Optionally, the processing module 302 is further configured to perform an operation process on the plurality of child private keys and the child chain codes corresponding to the plurality of child private keys based on the key derivation algorithm, so as to obtain a plurality of grandchild private keys;
The processing module 302 is further configured to perform a calculation process on the plurality of grandchild private keys based on the elliptic curve algorithm to obtain a plurality of grandchild public keys, where the grandchild public keys have a corresponding relationship with the grandchild private keys.
Fig. 4 is a schematic structural diagram of a key generating device of a blockchain provided by the present application. As shown in fig. 4, the present application provides a key generation apparatus of a blockchain, a key generation apparatus 400 of the blockchain including: a receiver 401, a transmitter 402, a processor 403 and a memory 404.
A receiver 401 for receiving instructions and data;
a transmitter 402 for transmitting instructions and data;
Memory 404 for storing computer-executable instructions;
processor 403 is configured to execute computer-executable instructions stored in memory 404 to implement the steps performed by the block chain key generation method in the above embodiment. Reference may be made in particular to the description of the key generation method embodiment of the blockchain described above.
Alternatively, the memory 404 may be separate or integrated with the processor 403.
When the memory 404 is provided separately, the electronic device further comprises a bus for connecting the memory 404 and the processor 403.
The application also provides a computer readable storage medium, wherein the computer readable storage medium stores computer execution instructions, and when the processor executes the computer execution instructions, the method for generating the key of the blockchain executed by the key generating device of the blockchain is realized.
The present application also provides a computer program product comprising a computer program which, when executed by a processor, implements a blockchain key generation method as described above.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are alternative embodiments, and that the acts and modules referred to are not necessarily required for the present application.
It should be further noted that, although the steps in the flowchart are sequentially shown as indicated by arrows, the steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps in the flowcharts may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order in which the sub-steps or stages are performed is not necessarily sequential, and may be performed in turn or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
It will be appreciated that the device embodiments described above are merely illustrative and that the device of the application may be implemented in other ways. For example, the division of the units/modules in the above embodiments is merely a logic function division, and there may be another division manner in actual implementation. For example, multiple units, modules, or components may be combined, or may be integrated into another system, or some features may be omitted or not performed.
In addition, each functional unit/module in each embodiment of the present application may be integrated into one unit/module, or each unit/module may exist alone physically, or two or more units/modules may be integrated together, unless otherwise specified. The integrated units/modules described above may be implemented either in hardware or in software program modules.
The integrated units/modules, if implemented in hardware, may be digital circuits, analog circuits, etc. Physical implementations of hardware structures include, but are not limited to, transistors, memristors, and the like. The processor may be any suitable hardware processor, such as CPU, GPU, FPGA, DSP and an ASIC, etc., unless otherwise specified. Unless otherwise indicated, the storage elements may be any suitable magnetic or magneto-optical storage medium, such as resistive Random Access Memory RRAM (Resistive Random Access Memory), dynamic Random Access Memory DRAM (Dynamic Random Access Memory), static Random Access Memory SRAM (Static Random-Access Memory), enhanced dynamic Random Access Memory EDRAM (ENHANCED DYNAMIC Random Access Memory), high-Bandwidth Memory HBM (High-Bandwidth Memory), hybrid storage cube HMC (Hybrid Memory Cube), etc.
The integrated units/modules may be stored in a computer readable memory if implemented in the form of software program modules and sold or used as a stand-alone product. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in whole or in part in the form of a software product stored in a memory, comprising several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method of the various embodiments of the present application. And the aforementioned memory includes: a usb disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments. The technical features of the above embodiments may be combined in any way, and for brevity, all of the possible combinations of the technical features of the above embodiments are not described, but should be considered as the scope of the description
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (12)

1. A method of key generation for a blockchain, the method comprising:
acquiring current operation information of hardware, and performing coding processing on the operation information to obtain a first random number;
generating a second random number by invoking the quantum random number generator;
Generating a target random number sequence according to the first random number and the second random number, wherein the target random number sequence is a random number sequence generated by a Meissen rotation algorithm;
and calculating the target random number sequence based on an elliptic curve algorithm to obtain a master key pair, and calculating a master private key in the master key pair by using a key derivation algorithm to obtain a plurality of sub key pairs.
2. The method of claim 1, wherein the generating a target random number sequence from the first random number and the second random number comprises:
combining the first random number and the second random number to obtain a third random number;
Taking the third random number as a seed of the Meisen rotation algorithm, and performing cyclic shift processing and exclusive OR operation processing on the seed to obtain a target seed;
And extracting the target seed for multiple times to generate a plurality of fourth random numbers, and combining the plurality of fourth random numbers to obtain the target random number sequence.
3. The method of claim 1, wherein the master key pair comprises: the elliptic curve algorithm-based calculation processing is performed on the target random number sequence to obtain a master key pair, and the method comprises the following steps:
Carrying out hash operation processing on the target random number sequence to obtain a main private key;
Determining a target base point on the target elliptic curve according to the target elliptic curve in the elliptic curve algorithm;
and generating a main public key based on the elliptic curve algorithm according to the target base point and the main private key.
4. A method according to claim 3, wherein said computing the master private key of said master key pair using a key derivation algorithm to obtain a plurality of sub-key pairs, comprising:
Dividing the main private key according to the preset byte size to obtain a father private key and a father chain code;
Performing operation processing on the father private key and the father chain code based on the key derivation algorithm to obtain a plurality of child private keys;
and carrying out operation processing on the plurality of sub-private keys and the target base point based on the elliptic curve algorithm to obtain a plurality of sub-public keys, wherein the sub-public keys and the sub-private keys have corresponding relations.
5. The method of claim 4, wherein the performing an operation on the parent private key and the parent chain code based on the key derivation algorithm to obtain a plurality of child private keys comprises:
Inputting the parent private key, the parent chain code and a first index value into a key derivation function to obtain a first child private key and a first child chain code which are output by the key derivation function, wherein the index value is a sequence number value corresponding to the increment sequence of the child key pair derivation;
and inputting the father-private key, the father-chain code and the second index value into the key derivation function to obtain a second child-private key and a second child-chain code output by the key derivation function.
6. The method of claim 5, wherein the method further comprises:
generating an address of each sub-public key according to the index values and the identification information corresponding to the plurality of sub-public keys;
Generating an address of each sub private key according to index values and identification information corresponding to the plurality of sub private keys;
And storing the plurality of sub-key pairs into a hierarchical deterministic wallet according to the address of each sub-private key and the address of the sub-public key.
7. The method of claim 6, wherein the method further comprises:
Calculating the plurality of child private keys based on the key derivation algorithm to generate a plurality of grandchild key pairs;
And storing the plurality of grandchild key pairs into the hierarchical deterministic wallet according to the addresses corresponding to the plurality of grandchild key pairs, wherein the addresses of the grandchild key pairs are determined according to the identification information and the index value of the grandchild key pairs.
8. The method of claim 7, wherein the computing the plurality of child private keys based on the key derivation algorithm to generate a plurality of grandchild key pairs comprises:
Performing operation processing on the plurality of sub-private keys and sub-chain codes corresponding to the plurality of sub-private keys based on the key derivation algorithm to obtain a plurality of grandchild private keys;
And calculating the plurality of grandchild private keys based on the elliptic curve algorithm to obtain a plurality of grandchild public keys, wherein the grandchild public keys and the grandchild private keys have corresponding relations.
9. A key generation apparatus for a blockchain, the apparatus comprising:
The acquisition module is used for acquiring the current operation information of the hardware;
the processing module is used for carrying out coding processing on the operation information to obtain a first random number;
the processing module is further used for generating a second random number by calling the quantum random number generator;
the processing module is further configured to generate a target random number sequence according to the first random number and the second random number, where the target random number sequence is a random number sequence generated by a meisen rotation algorithm;
The processing module is further configured to perform calculation processing on the target random number sequence based on an elliptic curve algorithm to obtain a master key pair, and perform calculation processing on a master private key in the master key pair by using a key derivation algorithm to obtain a plurality of sub-key pairs.
10. An electronic device, the electronic device comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the blockchain key generation method of any of claims 1-8.
11. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are for implementing a blockchain key generation method as claimed in any of claims 1-8.
12. A computer program product, characterized in that it comprises a computer program which, when executed by a processor, implements the method of generating a key of a blockchain as defined in any of claims 1-8.
CN202410455770.9A 2024-04-16 Block chain key generation method, device, equipment, medium and product Pending CN118316601A (en)

Publications (1)

Publication Number Publication Date
CN118316601A true CN118316601A (en) 2024-07-09

Family

ID=

Similar Documents

Publication Publication Date Title
US11159305B2 (en) Homomorphic data decryption method and apparatus for implementing privacy protection
WO2020253234A1 (en) Data homomorphic encryption and decryption method and apparatus for implementing privacy protection
Martins et al. A survey on fully homomorphic encryption: An engineering perspective
Janakiraman et al. Lightweight chaotic image encryption algorithm for real-time embedded system: Implementation and analysis on 32-bit microcontroller
Smart et al. Fully homomorphic SIMD operations
Al-Ghamdi et al. Security enhancement of shares generation process for multimedia counting-based secret-sharing technique
CN104270247B (en) Suitable for the efficient general Hash functions authentication method of quantum cryptography system
CN1677917B (en) Method and system for circulated storage unit for stream cipher
CN106941407B (en) Method and device for dynamically encrypting platform data
CN104429019A (en) Secret sharing system, data distribution device, distributed data conversion device, secret sharing method, and program
Jayapandian et al. Secure and efficient online data storage and sharing over cloud environment using probabilistic with homomorphic encryption
CN105027180A (en) Secure-computation system, computing device, secure-computation method, and program
Thangavel et al. Enhanced DNA and ElGamal cryptosystem for secure data storage and retrieval in cloud
JP2011164607A (en) Method and system for privacy-preserving computation of edit distance of symbol sequence
Abdeldaym et al. Modified RSA algorithm using two public key and Chinese remainder theorem
JP2008513811A (en) Calculation conversion method and system
CN104919754A (en) Tampering detection device, tampering detection method, and program
EP2991264B1 (en) Encrypted text matching system, method and program
Wang et al. A faster fully homomorphic encryption scheme in big data
Zheng et al. An image encryption algorithm based on multichaotic system and DNA coding
Ahmad et al. A secure network communication protocol based on text to barcode encryption algorithm
Moon et al. An Efficient Encrypted Floating‐Point Representation Using HEAAN and TFHE
AVAROĞLU et al. A novel S-box-based postprocessing method for true random number generation
EP2991265B1 (en) Encrypted text matching system, method and program
Pandit et al. Lwr-based quantum-safe pseudo-random number generator

Legal Events

Date Code Title Description
PB01 Publication