CN109818751B - Key processing and using method, device, equipment and storage medium - Google Patents

Key processing and using method, device, equipment and storage medium Download PDF

Info

Publication number
CN109818751B
CN109818751B CN201910107557.8A CN201910107557A CN109818751B CN 109818751 B CN109818751 B CN 109818751B CN 201910107557 A CN201910107557 A CN 201910107557A CN 109818751 B CN109818751 B CN 109818751B
Authority
CN
China
Prior art keywords
key
character string
local
block chain
string
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.)
Active
Application number
CN201910107557.8A
Other languages
Chinese (zh)
Other versions
CN109818751A (en
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.)
Baidu Online Network Technology Beijing Co Ltd
Original Assignee
Baidu Online Network Technology Beijing Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Baidu Online Network Technology Beijing Co Ltd filed Critical Baidu Online Network Technology Beijing Co Ltd
Priority to CN201910107557.8A priority Critical patent/CN109818751B/en
Publication of CN109818751A publication Critical patent/CN109818751A/en
Application granted granted Critical
Publication of CN109818751B publication Critical patent/CN109818751B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the invention discloses a method, a device, equipment and a storage medium for processing and using a secret key. The key processing method is applied to user terminal equipment and comprises the following steps: determining a key of a local blockchain account by using an encryption algorithm; determining a key character string of the local blockchain account according to the characteristics of the encryption algorithm and the characteristics of the key; and processing the key character string of the local block chain account according to the transaction password of the local user to obtain a key character string ciphertext, wherein the key character string ciphertext is used for being recorded in user terminal equipment. By the technical scheme provided by the embodiment of the invention, the key of the local block chain account is converted into the key character string ciphertext to be recorded in the user terminal equipment, so that the key plaintext can be prevented from being stolen by other people, and the safety and the usability are higher. In addition, the user does not need to memorize the key of the local blockchain account.

Description

Key processing and using method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of block chains, in particular to a method, a device, equipment and a storage medium for processing and using a secret key.
Background
The local account of the user's blockchain can be stored on the terminal device, and the user can use his own key to issue a transaction and use his own assets at the client.
However, this process has the following problems: 1) the key of the asymmetric encryption technology commonly used in the block chain network is randomly generated and is hundreds of bits long, so that the user can hardly memorize the key; 2) if the plain text of the user's key is stored on the terminal device, there is a risk of theft and assets are easily lost. Therefore, it is necessary to provide a new key processing method.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for processing and using a secret key, which can prevent the secret key plaintext from being stolen by other people and have higher safety and usability.
In a first aspect, an embodiment of the present invention provides a key processing method, which is applied to a user terminal device, and the method includes:
determining a key of a local blockchain account by using an encryption algorithm;
determining a key character string of the local blockchain account according to the characteristics of the encryption algorithm and the characteristics of the key;
and processing the key character string of the local block chain account according to the transaction password of the local user to obtain a key character string ciphertext, wherein the key character string ciphertext is used for being recorded in user terminal equipment.
In a second aspect, an embodiment of the present invention provides a key using method, which is applied to a user terminal device, and the method includes:
acquiring a transaction password input by a local user;
acquiring a key character string ciphertext of a local block chain account stored in the user terminal equipment;
decrypting the cipher key character string ciphertext by adopting the transaction password to obtain a cipher key character string of the local block chain account;
reconstructing an encryption algorithm and a key of the local blockchain account according to the key character string of the local blockchain account;
the blockchain transaction request of the local blockchain account is signed using the reconstructed encryption algorithm and key.
In a third aspect, an embodiment of the present invention provides a key processing apparatus, configured in a user terminal device, where the apparatus includes:
the key determining module is used for determining a key of the local block chain account by using an encryption algorithm;
the key character string determining module is used for determining a key character string of the local block chain account according to the characteristics of the encryption algorithm and the characteristics of the key;
and the cipher text determining module is used for processing the key character string of the local area chain account according to the transaction password of the local user to obtain a key character string cipher text, and the key character string cipher text is used for being recorded in the user terminal equipment.
In a fourth aspect, an embodiment of the present invention provides a key using apparatus, configured in a user terminal device, where the apparatus includes:
the transaction password acquisition module is used for acquiring a transaction password input by a local user;
a ciphertext acquisition module, configured to acquire a key string ciphertext of a local blockchain account stored in the user terminal device;
the cipher text decryption module is used for decrypting the cipher text of the key character string by adopting the transaction password to obtain the key character string of the local block chain account;
the algorithm key reconstruction module is used for reconstructing an encryption algorithm and a key of the local blockchain account according to the key character string of the local blockchain account;
and the signature module is used for signing the block chain transaction request of the local block chain account by using the reconstructed encryption algorithm and the key.
In a fifth aspect, an embodiment of the present invention further provides an apparatus, where the apparatus includes:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the key processing method of any of the first aspects, or the key using method of any of the second aspects.
In a sixth aspect, an embodiment of the present invention further provides a storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the key processing method described in any of the first aspects, or implements the key using method described in any of the second aspects.
According to the key processing and using method, the key processing and using device, the key processing and using equipment and the storage medium, after the key of the local block chain account is determined by using the encryption algorithm, the key character string of the local block chain account can be determined according to the characteristics of the encryption algorithm and the characteristics of the key; and then processing the key character string of the local block chain account by adopting the transaction key of the local user to obtain a key character string ciphertext, and recording the key character string ciphertext in user terminal equipment. Compared with the prior art, the key of the local block chain account is converted into the key character string ciphertext through layer-by-layer processing and is recorded in the user terminal equipment, so that the key plaintext can be prevented from being stolen by other people, and the method has high safety and usability. In addition, the user does not need to memorize the key of the local blockchain account.
Drawings
Fig. 1 is a flowchart of a key processing method according to an embodiment of the present invention;
fig. 2 is a flowchart of a key processing method according to a second embodiment of the present invention;
fig. 3 is a flowchart of a key processing method according to a third embodiment of the present invention;
fig. 4 is a flowchart of a key processing method according to a fourth embodiment of the present invention;
fig. 5 is a flowchart of a key using method according to a fifth embodiment of the present invention;
fig. 6 is a flowchart of a key using method according to a sixth embodiment of the present invention;
fig. 7 is a flowchart of a key using method according to a seventh embodiment of the present invention;
fig. 8 is a flowchart of a key using method according to an eighth embodiment of the present invention;
fig. 9 is a block diagram of a key processing apparatus according to a ninth embodiment of the present invention;
fig. 10 is a block diagram illustrating a configuration of a key using apparatus according to a tenth embodiment of the present invention;
fig. 11 is a schematic structural diagram of an apparatus provided in the eleventh embodiment of the present invention.
Detailed Description
The embodiments of the present invention will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the embodiments of the invention and that no limitation of the invention is intended. It should be further noted that, for convenience of description, only some structures, not all structures, relating to the embodiments of the present invention are shown in the drawings.
Example one
Fig. 1 is a flowchart of a key processing method according to an embodiment of the present invention, which is applicable to a key processing situation, and is particularly applicable to key processing on a blockchain account, so as to solve the problem that a key plaintext in the prior art is stored on a user terminal device and is easily stolen. The user terminal device may be, for example, a mobile terminal, a personal computer, or the like. The scheme of the embodiment of the invention can be executed by the user terminal equipment, and further can be executed by a block chain lightweight node in the user terminal equipment or an application program interacting with the lightweight node. The lightweight node refers to deployment data deployed with a blockchain, such as an intelligent contract, a consensus mechanism, and the like, but a blockchain network node which does not store or store part of blockchain data and transaction data may participate in a transaction request interaction process of the blockchain. The lightweight node may be generally deployed in the user terminal device, for example, may be loaded in an operating system of the user terminal device, may also be installed in the user terminal device as an independent third-party application program, may also be loaded in a certain application program (i.e., an application program interacting with the lightweight node) of the user terminal device, and the like.
The method can be executed by the key processing device provided by the embodiment of the invention, and the device can be realized in a hardware and/or software mode, and can be integrated in user terminal equipment, a block chain lightweight node in the user terminal equipment, or an application program interacting with the lightweight node, and the like. Referring to fig. 1, the method may specifically include:
s110, the key of the local block chain account is determined by using an encryption algorithm.
In this embodiment, the encryption algorithm may include a symmetric encryption algorithm, an asymmetric encryption algorithm, and the like. Since the symmetric encryption algorithm is suitable for encrypting a large amount of data and the amount of data of the blockchain account is small, the asymmetric encryption algorithm is preferably used to determine the key of the local blockchain account in the present embodiment. The asymmetric encryption algorithm may include an RSA encryption algorithm, an Elliptic curve encryption algorithm (ECC), and the like.
Optionally, different encryption algorithms correspond to different encryption rules, so that the data of the local blockchain account is encrypted according to the corresponding encryption rules, and an encryption result is used as a key of the local blockchain account. The local blockchain account data may include, but is not limited to, a local blockchain account name, a password, and the like. The key of the local blockchain account can comprise a public key and a private key of the local blockchain account, wherein the private key is an important certificate for indicating identity when a user conducts transactions related to assets.
And S120, determining a key character string of the local block chain account according to the characteristics of the encryption algorithm and the characteristics of the key.
In this embodiment, the characteristics of the encryption algorithm refer to characteristics for characterizing the essence of the encryption algorithm, and further, the characteristics of the encryption algorithm may be embodied by parameters, values, and the like of an encryption function or an analysis function associated with the encryption algorithm. Correspondingly, the characteristics of the key are the characteristics for representing the essence of the key, and can be obtained by performing multi-layer hash operation on the key by adopting a hash algorithm; the hash operation may be performed on the key, the blockchain address, and the like. Alternatively, the key may be characterized in a string format, and the length of the string may be smaller than the length of the key itself, etc.
The key string may be determined based on characteristics of the encryption algorithm and characteristics of the key. Specifically, the characteristics of the encryption algorithm and the characteristics of the key may be converted into the same representation format, such as a character string format, and then the characters are connected by using a set connection method, so as to obtain the key character string of the local blockchain account. The set connection mode may be that the feature of the encryption algorithm is before or after the feature of the key, that the feature of the encryption algorithm is added to a fixed position in the feature of the key, such as a middle position, or that the feature of the key is added to a fixed position in the feature of the encryption algorithm.
For example, if the encryption algorithm is an elliptic curve encryption algorithm, determining the key string of the local blockchain account according to the characteristics of the encryption algorithm and the characteristics of the key may include the following steps:
A. extracting parameters of an elliptic curve and parameters of a secret key used in the encryption process;
in this embodiment, the parameter of the elliptic curve may include a key parameter in an analytic expression corresponding to the elliptic curve, where the key parameter is used to determine a trajectory of the elliptic curve, and is a necessary parameter for determining a key of the local blockchain account; the parameters of the elliptic curve may also comprise other parameters, etc. that directly or indirectly influence the key parameters. The parameter of the key is a parameter for determining the uniqueness of the key, and the key can be determined by using the parameter of the key.
Specifically, after the key of the local blockchain account is determined by using an elliptic curve encryption algorithm, the parameters of the elliptic curve and the parameters of the key can be extracted from the used elliptic curve and the key respectively, and then the key character string of the local blockchain account is determined according to the parameters of the elliptic curve and the parameters of the key, namely B is executed.
B. And converting the parameters of the elliptic curve and the parameters of the key into character strings to obtain the key character strings of the local block chain account.
Specifically, according to a set conversion rule, the extracted parameters of the elliptic curve and the extracted parameters of the key are respectively converted into character strings, and then the character strings are connected in a set connection mode, so that the key character string of the local block chain account can be obtained. The set conversion rule may include a format of the converted character string, such as a character string expressed in JSON (JSON Object Notation) format.
S130, processing the key character string of the local block chain account according to the transaction password of the local user to obtain a key character string ciphertext, wherein the key character string ciphertext is used for being recorded in user terminal equipment.
In this embodiment, the transaction password is a payment password preset by the user, and the user can set the transaction password according to actual conditions. Optionally, the transaction password is a natural semantic character string input by the user, and the format of the transaction password may be multiple digits such as 6 digits or letters, or a combination of digits and letters.
Optionally, the complexity or the level of processing the key string of the local blockchain account by using the transaction key of the local user determines the complexity of breaking the cipher text of the key string, and the processing can be performed according to the security level of the cipher text of the key string actually selected by the user. Specifically, the key string of the local blockchain account may be encrypted according to the transaction password of the local user, so as to obtain a key string ciphertext, and the key string ciphertext is recorded in the user terminal device. In order to increase the complexity of breaking the cipher text of the key string, the transaction password of the local user may be processed to obtain a derivative key, and then the derivative key is used to encrypt the key string of the local block chain account, so as to obtain the cipher text of the key string.
In addition, it should be noted that the user does not need to memorize the key of the local blockchain account, and since the key string ciphertext is recorded in the user terminal device, when the user needs to use the key of the local blockchain account, the user terminal device may adopt the embodiment to provide a backward-forwarding process for determining the key string ciphertext, determine the key of the local blockchain account and provide the key to the user, thereby further increasing the user experience.
According to the technical scheme provided by the embodiment of the invention, after the key of the local blockchain account is determined by using the encryption algorithm, the key character string of the local blockchain account can be determined according to the characteristics of the encryption algorithm and the characteristics of the key; and then processing the key character string of the local block chain account by adopting the transaction key of the local user to obtain a key character string ciphertext, and recording the key character string ciphertext in user terminal equipment. Compared with the prior art, the key of the local block chain account is converted into the key character string ciphertext through layer-by-layer processing and is recorded in the user terminal equipment, so that the key plaintext can be prevented from being stolen by other people, and the method has high safety and usability. In addition, the user does not need to memorize the key of the local blockchain account.
Example two
Fig. 2 is a flowchart of a key processing method according to a second embodiment of the present invention, where this embodiment further processes a key string of a local blockchain account according to a transaction password of a local user on the basis of the above embodiment, and obtains a key string ciphertext for explaining the key string ciphertext. Referring to fig. 2, the method specifically includes:
s210, determining a key of the local block chain account by using an encryption algorithm.
And S220, determining a key character string of the local block chain account according to the characteristics of the encryption algorithm and the characteristics of the key.
And S230, performing key derivation on the transaction password of the local user by using an encryption function to obtain a derived key.
In this embodiment, the encryption function refers to a preset fixed function, and is used to increase the complexity of the transaction password of the local user. Furthermore, the complexity of the transaction password of the local user can be increased by increasing the length of the transaction password. Optionally, the encryption function may be one or more encryption functions in the prior art that can make the length of the transaction password of the local user longer, which is not limited in this embodiment. For example, it may be at least one of DES (Data Encryption Standard), AES (Advanced Encryption Standard), hash function, and the like. In addition, if both encryption functions can increase the length of the transaction password of the local user, the encryption strength is preferably stronger.
The derived key is obtained by performing key derivation on the transaction password of the local user by using an encryption function, and the length of the derived key is determined by the encryption function and can be fixed; and the length of the transaction password is larger than that of the local user. For example, the transaction cipher for the local user may be 16 bytes (i.e., 128 bits) in length, and the derivative key may be 32 bytes (i.e., 256 bits) in length.
Specifically, in order to further increase the complexity of breaking the cipher text of the key string, a fixed encryption function may be used to derive the key derivation from the transaction password of the local user, so as to obtain the derived key.
S240, processing the key character string of the local block chain account according to the derived key to obtain a key character string ciphertext.
Specifically, after the key string of the local blockchain account is determined in S220, the key derivation may be performed on the transaction password of the local user by using the encryption function to obtain a derived key, and then the key string of the local blockchain account may be processed, such as encrypted, by using the derived key to obtain a key string ciphertext. The embodiment is equivalent to performing two-stage encryption on the key string of the local block chain account to obtain the key string ciphertext, and further increases the complexity of breaking the key string ciphertext.
Optionally, after the derivative key is obtained in S230, the derivative key may be used to encrypt the key string of the local blockchain account, and then the encryption result is encrypted by using another encryption algorithm; other more advanced encryption schemes are possible and the following embodiments will be described in detail and will not be described here.
According to the technical scheme provided by the embodiment of the invention, after the key of the local blockchain account is determined by using the encryption algorithm, the key character string of the local blockchain account can be determined according to the characteristics of the encryption algorithm and the characteristics of the key; and then, carrying out key derivation on the transaction password of the local user by using an encryption function to obtain a derived key, processing the key character string of the local block chain account by using the derived key to obtain a key character string ciphertext, and recording the key character string ciphertext in user terminal equipment. Compared with the prior art, the key of the local block chain account is processed layer by layer, namely the key character string of the local block chain account is determined firstly, and then the key character string of the local block chain account is processed in two stages to be converted into the key character string ciphertext, so that the complexity of breaking the key character string ciphertext is further increased, the key plaintext can be prevented from being stolen by other people, and the method has higher safety and usability. In addition, the user does not need to memorize the key of the local blockchain account.
EXAMPLE III
Fig. 3 is a flowchart of a key processing method according to a third embodiment of the present invention, and this embodiment further processes a key string of a local blockchain account according to a transaction password of a local user on the basis of the foregoing embodiment, so as to obtain a key string ciphertext for explaining. Referring to fig. 3, the method specifically includes:
s310, the key of the local block chain account is determined by using an encryption algorithm.
And S320, determining a key character string of the local block chain account according to the characteristics of the encryption algorithm and the characteristics of the key.
S330, key derivation is carried out on the transaction password of the local user by using an encryption function to obtain a derived key.
S340, determining an auxiliary character string according to the derived key and the key character string of the local block chain account.
In this embodiment, the auxiliary character string is used to assist in increasing the complexity of the key character string of the local blockchain account, and may be determined according to the derived key and the key character string of the local blockchain account.
Specifically, the byte length of the derived key and the byte length of the key character string of the local blockchain account may be unified, then the two are subjected to an exclusive-or operation, the number of the derived key and the byte length of the key character string of the local blockchain account are counted to be 1 from the exclusive-or result, and if the number of the derived key and the key character string of the local blockchain account is one digit such as 3, 3 digits 3 can be directly used as auxiliary character strings; if the number of the numeric value 1 is at least two, for example, 48, then 8, for example, 8, can be selected from the numeric value, and then 8 can be directly used as the auxiliary character string, etc.
The hash operation may be performed in multiple layers based on the derived key and the key string of the local blockchain account to obtain a fixed-length string, and the fixed-length string may be used as an auxiliary string.
And S350, adding an auxiliary character string at a fixed position of the key character string of the local block chain account to obtain a new key character string.
In this embodiment, the fixed position may be a preset position where the auxiliary character string is filled in the key character string of the local blockchain account, for example, the fixed position may be the front part and/or the tail part of the key character string of the local blockchain account, or may be another position in the key character string of the local blockchain account, such as a fixed middle part.
Specifically, after the auxiliary character string is determined according to the derived key and the key character string of the local blockchain account, the auxiliary character string may be added to a fixed position of the key character string of the local blockchain account, such as a tail, so as to obtain a new key character string.
And S360, encrypting the new key character string by adopting the derived key to obtain a key character string ciphertext.
Specifically, after the key character string of the local blockchain account is determined in S320, a key derivation may be performed on the transaction password of the local user by using an encryption function to obtain a derived key; and then executing S340 and S350 to obtain a new key character string by the derived key and the key character string of the local block chain account, and further encrypting the new key character string by using the derived key to obtain a key character string ciphertext. In this embodiment, the key string ciphertext is obtained by performing three-stage encryption on the key string of the local blockchain account, and the complexity of breaking the key string ciphertext is further increased.
According to the technical scheme provided by the embodiment of the invention, after the key of the local blockchain account is determined by using the encryption algorithm, the key character string of the local blockchain account can be determined according to the characteristics of the encryption algorithm and the characteristics of the key; and then, carrying out key derivation on the transaction password of the local user by using an encryption function to obtain a derived key, obtaining a new key character string according to the derived key and the key character string of the local block chain account, further processing the new key character string by using the derived key to obtain a key character string ciphertext, and recording the key character string ciphertext in user terminal equipment. Compared with the prior art, the key of the local block chain account is processed layer by layer, namely the key character string of the local block chain account is determined firstly, and then the key character string of the local block chain account is subjected to three-stage processing to be converted into the key character string ciphertext, so that the complexity of breaking the key character string ciphertext is further increased, the key plaintext can be prevented from being stolen by other people, and the method has higher safety and usability. In addition, the user does not need to memorize the key of the local blockchain account.
Example four
Fig. 4 is a flowchart of a key processing method according to a fourth embodiment of the present invention, and this embodiment further processes a key string of a local blockchain account according to a transaction password of a local user on the basis of the foregoing embodiment to obtain a key string ciphertext for explaining the key string ciphertext. Referring to fig. 4, the method specifically includes:
and S410, determining the key of the local block chain account by using an encryption algorithm.
And S420, determining a key character string of the local block chain account according to the characteristics of the encryption algorithm and the characteristics of the key.
S430, performing key derivation on the transaction password of the local user by using an encryption function to obtain a derived key.
S440, conducting modulus processing on the byte length of the derived key by the byte length of the key character string of the local block chain account to obtain an intermediate characteristic value.
Specifically, if the byte length of the key string of the local blockchain account is greater than the byte length of the derivative key, dividing the byte length of the key string of the local blockchain account by the character length of the derivative key, and taking the remainder as an intermediate characteristic value; otherwise, dividing the character length of the derived key by the byte length of the key string of the local blockchain account, and taking the remainder as the intermediate characteristic value. Typically, the byte length of the key string is greater than the byte length of the derivative key.
S450, the byte length of the key character string of the local block chain account is subtracted by the difference value of the middle characteristic value to serve as an auxiliary characteristic value.
In this embodiment, the byte length of the key string of the local blockchain account may be directly subtracted by the difference between the intermediate characteristic values to serve as the auxiliary characteristic value. For example, if the byte length of the key string of the local blockchain account is 16, and the intermediate characteristic value is 7, the auxiliary characteristic value is 9.
Optionally, when the difference result is two or more numbers, the larger number of the difference results may also be used as an auxiliary feature value, and the like. For example, if the byte length of the key string of the local blockchain account is 32, the byte length of the derived key is 31, and the intermediate characteristic value is 1, the assist characteristic value is 31, and thus 31 can be used as the assist characteristic value; 3 may also be used as an assist feature value.
And S460, taking the characters with the auxiliary characteristic values as auxiliary character strings.
Specifically, the characters with the assistant feature values as the assistant feature values may be used as the assistant character strings. For example, if the assist feature is 6, a character string composed of 6 characters may be used as the assist character string.
And S470, adding an auxiliary character string at a fixed position of the key character string of the local block chain account to obtain a new key character string.
And S480, encrypting the new key character string by adopting the derived key to obtain a key character string ciphertext.
The technical scheme provided by the embodiment of the invention provides a mode for determining the auxiliary character string according to the derived key and the key character string of the local blockchain account, then the auxiliary character string is added to the fixed position of the key character string of the local blockchain account to obtain a new key character string, then the derived key is adopted to process the new key character string to obtain a key character string ciphertext, and the key character string ciphertext is recorded in the user terminal equipment. Compared with the prior art, the key of the local block chain account is converted into the key string ciphertext through layer-by-layer processing, the complexity of breaking the key string ciphertext is increased, the key plaintext can be prevented from being stolen by other people, and the method has high safety and usability. In addition, the user does not need to memorize the key of the local blockchain account.
EXAMPLE five
Fig. 5 is a flowchart of a key using method according to a fifth embodiment of the present invention, where the present embodiment is applicable to a case of using a blockchain account key. The key of the blockchain account can be processed by using the key processing method provided in the above embodiment. The scheme of the embodiment of the invention can be executed by the user terminal equipment, and further can be executed by a block chain lightweight node in the user terminal equipment or an application program interacting with the lightweight node. The method can be executed by the key using device provided by the embodiment of the invention, and the device can be realized in a hardware and/or software mode and can be integrated in user terminal equipment or an application program interacting with a lightweight node. Referring to fig. 5, the method specifically includes:
and S510, acquiring the transaction password input by the local user.
In this embodiment, the transaction password is a payment password preset by the user, and the user can set the transaction password according to actual conditions. Optionally, the transaction password is a natural semantic character string input by the user, and the format of the transaction password may be multiple digits such as 6 digits or letters, or a combination of digits and letters.
Specifically, when it is detected that the local user needs to use the asset under the local blockchain account to perform an operation matter, such as a transaction, the blockchain lightweight node in the user terminal device or the application program interacting with the lightweight node may display a transaction password input interface to prompt the user to input the transaction password, so as to obtain the transaction password input by the local user.
Before acquiring the transaction password input by the local user, the method may further include: acquiring a block chain transaction request initiated by a user; if the block chain transaction request contains the operation affair of the local block chain account, a reminding notice is initiated to inform the user of inputting the transaction password.
In this embodiment, the blockchain transaction request refers to a request initiated by a user when the blockchain is required to process a transaction request, such as a transaction request. Optionally, the user may initiate a block chain transaction request and the like by interacting with a block chain lightweight node in the user terminal device, or by interacting with an application program interacting with the lightweight node. Operational matters of the local blockchain account may include operations such as asset class transactions, transfers, etc. involving the local blockchain account. The reminding notification can be in the form of text display or short message, and the like, and can also be in the form of displaying an interface for inputting the transaction key, and the like.
Specifically, a block chain transaction request initiated by a user is obtained, whether the block chain transaction request contains an operation event of a local block chain account is detected, if yes, a reminding notification is initiated to notify the user to input a transaction password, and then the transaction password input by the local user is obtained. If not, but the acquired block chain transaction request is a block chain lightweight node in the user terminal equipment, directly transmitting the block chain transaction request to a block chain network; if the acquired blockchain transaction request is an application program interacting with the lightweight node, the blockchain transaction request can be transmitted to the blockchain network through the lightweight node.
S520, obtaining a key character string ciphertext of the local block chain account stored in the user terminal equipment.
In this embodiment, the key string of the local blockchain account may be recorded at a location designated by the user in the user terminal device.
Specifically, after the transaction password input by the local user is obtained, the key string ciphertext of the local blockchain account may be obtained from a location specified by the local user in the user terminal device.
S530, decrypting the cipher key character string ciphertext by adopting the transaction password to obtain the cipher key character string of the local block chain account.
In this embodiment, in the key processing process, the key string ciphertext of the local blockchain account may be obtained by processing, such as encrypting, the key string of the local blockchain account through the transaction password of the local user. Therefore, in the key using process, the transaction password can be used for decrypting the key string ciphertext, and further the key string of the local block chain account is obtained. That is, the process of decrypting the cipher key string ciphertext by using the transaction password is the reverse process of encrypting the cipher key string of the local blockchain account by using the transaction password.
And S540, reconstructing an encryption algorithm and a key of the local blockchain account according to the key character string of the local blockchain account.
In this embodiment, the encryption algorithm refers to an algorithm used for determining a key of the local blockchain account.
Specifically, in the key processing process, the key character string of the local blockchain account is determined according to the characteristics of the encryption algorithm and the characteristics of the key. Therefore, in the key using process, after the key character string of the local blockchain account is obtained, the characteristics of the encryption algorithm and the characteristics of the key can be read from the key character string of the local blockchain account; then, the encryption algorithm can be reconstructed according to the characteristics of the encryption algorithm, and the key of the local blockchain account is reconstructed according to the reconstructed encryption algorithm and the characteristics of the key. For example, the encryption algorithm is characterized by parameters, values and the like of an encryption function associated with the encryption algorithm, so that an analytical expression corresponding to the encryption function can be determined according to the parameters, the values and the like of the encryption function, and the encryption algorithm is further determined; after the encryption algorithm is reconstructed, the encryption algorithm can be reversely solved according to the parameters of the key, and the key of the local blockchain account can be reconstructed.
And S550, signing the block chain transaction request of the local block chain account by using the reconstructed encryption algorithm and the key.
Specifically, after the encryption algorithm and the key of the local blockchain account are reconstructed in S540, the reconstructed encryption algorithm and the key may be used to sign the blockchain transaction request of the local blockchain account, or the key may be used only to sign the blockchain transaction request of the local blockchain account, so as to indicate the local user identity.
According to the technical scheme provided by the embodiment of the invention, when the fact that a user needs to sign the block chain transaction request of the local block chain account by using the secret key is determined, the transaction password input by the local user and the secret key character string ciphertext of the local block chain account stored in the user terminal equipment can be obtained; and decrypting the cipher key character string ciphertext by adopting the transaction password to obtain the cipher key character string of the local blockchain account, reconstructing an encryption algorithm and a cipher key according to the cipher key character string, and further signing the blockchain transaction request of the local blockchain account by using the reconstructed encryption algorithm and the reconstructed cipher key. According to the scheme, a user does not need to memorize the key of the local blockchain account, and can complete the signature of the blockchain transaction request of the local blockchain account only by inputting the transaction password, so that the user experience is improved. In addition, the cipher key character string ciphertext is recorded in the user terminal equipment, so that the cipher key plaintext can be prevented from being stolen by other people, and the method has high safety and usability.
EXAMPLE six
Fig. 6 is a flowchart of a key using method according to a sixth embodiment of the present invention, and this embodiment further explains a key string obtained by decrypting a key string ciphertext by using a transaction password to obtain a local blockchain account on the basis of the foregoing embodiment. Referring to fig. 6, the method specifically includes:
s610, acquiring the transaction password input by the local user.
S620, obtaining the cipher key character string cipher text of the local block chain account stored in the user terminal equipment.
S630, the encryption function is used for carrying out key derivation on the transaction password input by the local user to obtain a derived key.
In this embodiment, the encryption function refers to a preset fixed function, and is used to increase the complexity of the transaction password of the local user. Furthermore, the complexity of the transaction password of the local user can be increased by increasing the length of the transaction password. Optionally, the encryption function may be one or more encryption functions in the prior art that can make the length of the transaction password of the local user longer, which is not limited in this embodiment. For example, it may be at least one of DES (Data Encryption Standard), AES (Advanced Encryption Standard), hash function, and the like. In addition, if both encryption functions can increase the length of the transaction password of the local user, the encryption strength is preferably stronger.
The derived key is obtained by performing key derivation on the transaction password of the local user by using an encryption function, and the length of the derived key is determined by the encryption function and can be fixed; and the length of the transaction password is larger than that of the local user. For example, the transaction cipher for the local user may be 16 bytes (i.e., 128 bits) in length, and the derivative key may be 32 bytes (i.e., 256 bits) in length. Specifically, a fixed encryption function may be used to derive a key derivative from the transaction password of the local user, so as to obtain a derivative key.
And S640, decrypting the key character string ciphertext according to the derived key to obtain the key character string of the local block chain account.
In this embodiment, in the key processing process, the key string ciphertext of the local blockchain account may be obtained by deriving the key and processing, such as encrypting, the key string of the local blockchain account. Therefore, in the key using process, the derived key can be used for decrypting the key string ciphertext, and further the key string of the local block chain account can be obtained. That is, the process of decrypting the key string ciphertext by using the derived key is the reverse process of encrypting the key string of the local blockchain account by using the derived key.
S650, reconstructing an encryption algorithm and a key of the local blockchain account according to the key character string of the local blockchain account.
And S660, signing the block chain transaction request of the local block chain account by using the reconstructed encryption algorithm and the key.
According to the technical scheme provided by the embodiment of the invention, when the fact that a user needs to sign the block chain transaction request of the local block chain account by using the secret key is determined, the transaction password input by the local user and the secret key character string ciphertext of the local block chain account stored in the user terminal equipment can be obtained; performing key derivation on the transaction password of the local user by using an encryption function to obtain a derived key, and decrypting a key string ciphertext according to the derived key to obtain a key string of the local block chain account; and then, an encryption algorithm and a key can be reconstructed according to the key character string, and the block chain transaction request of the local block chain account can be signed by using the reconstructed encryption algorithm and key. According to the scheme, a user does not need to memorize the key of the local blockchain account, and can complete the signature of the blockchain transaction request of the local blockchain account only by inputting the transaction password, so that the user experience is improved. In addition, the key character string of the local block chain account is processed layer by layer and converted into the key character string ciphertext which is recorded in the user terminal equipment, so that the complexity of breaking the key character string ciphertext is further increased, the key plaintext can be prevented from being stolen by other people, and the method has higher safety and usability.
EXAMPLE seven
Fig. 7 is a flowchart of a key using method according to a seventh embodiment of the present invention, and this embodiment further explains a key string obtained by decrypting a key string ciphertext with a transaction password to obtain a local blockchain account on the basis of the foregoing embodiment. Referring to fig. 7, the method specifically includes:
and S710, acquiring the transaction password input by the local user.
S720, obtaining the key character string ciphertext of the local block chain account stored in the user terminal equipment.
And S730, performing key derivation on the transaction password input by the local user by using an encryption function to obtain a derived key.
And S740, decrypting the cipher text of the key character string according to the derived key to obtain a new key character string.
In this embodiment, in the key processing process, the key string ciphertext is obtained by encrypting a new key string according to the derived key, and the new key string is obtained by adding an auxiliary string to a fixed position of the key string of the local blockchain account. Therefore, in the key using process, in order to obtain the key character string of the local blockchain account, the reverse process of the above operation process can be performed. Specifically, the key string ciphertext may be decrypted according to the derived key to obtain a new key string, and then the auxiliary string is removed from the fixed position of the new key string, so as to obtain the key string of the local block chain account, i.e., S750 is performed.
And S750, removing the auxiliary character string from the new key character string to obtain the key character string of the local block chain account.
Illustratively, the removing of the helper string from the new key string may include: reading an auxiliary characteristic character value in a new key character string; and eliminating the auxiliary characteristic character value characters at the fixed position of the new key character string.
In this embodiment, in the key processing process, the new key string is obtained by adding an auxiliary string to a fixed position of the key string of the local blockchain account. Therefore, in the key using process, the auxiliary character string is removed from the fixed position of the new key character string, and the key character string of the local block chain account can be obtained. The fixed position corresponds to a position where the auxiliary string is filled in the key string of the local blockchain account, for example, the fixed position may be a front part and/or a tail part of the new key string, or may be other positions in the new key string, such as a middle part.
The assistant feature character value refers to a character value at a fixed position in a new key character string, such as a tail or head character value.
For example, the tail character value in the new key string may be read, and the tail character value character at the tail of the new key string may be eliminated, so as to obtain the key string of the local blockchain account. If the tail character value is 6, 6 tail parts of the new key character string can be removed, and the key character string of the local block chain account can be obtained.
And S760, reconstructing an encryption algorithm and a key of the local blockchain account according to the key character string of the local blockchain account.
And S770, signing the block chain transaction request of the local block chain account by using the reconstructed encryption algorithm and the key.
According to the technical scheme provided by the embodiment of the invention, when the fact that a user needs to sign the block chain transaction request of the local block chain account by using the secret key is determined, the transaction password input by the local user and the secret key character string ciphertext of the local block chain account stored in the user terminal equipment can be obtained; key derivation is carried out on the transaction password of the local user by using an encryption function to obtain a derived key, a key character string ciphertext is decrypted according to the derived key to obtain a new key character string, and an auxiliary character string is removed from the new key character string to obtain a key character string of the local block chain account; and then, an encryption algorithm and a key can be reconstructed according to the key character string, and the block chain transaction request of the local block chain account can be signed by using the reconstructed encryption algorithm and key. According to the scheme, a user does not need to memorize the key of the local blockchain account, and can complete the signature of the blockchain transaction request of the local blockchain account only by inputting the transaction password, so that the user experience is improved. In addition, the key character string of the local block chain account is processed layer by layer and converted into the key character string ciphertext which is recorded in the user terminal equipment, so that the complexity of breaking the key character string ciphertext is further increased, the key plaintext can be prevented from being stolen by other people, and the method has higher safety and usability.
Example eight
Fig. 8 is a flowchart of a key using method according to an eighth embodiment of the present invention, and this embodiment further explains, on the basis of the foregoing embodiment, reconstructing an encryption algorithm and a key of a local blockchain account according to a key string of the local blockchain account when an encryption algorithm is an elliptic curve encryption algorithm. Referring to fig. 8, the method specifically includes:
and S810, acquiring the transaction password input by the local user.
S820, obtaining the cipher key character string cryptograph of the local block chain account stored in the user terminal equipment.
And S830, decrypting the cipher key string ciphertext by using the transaction password to obtain the cipher key string of the local block chain account.
And S840, determining parameters of an elliptic curve and parameters of a key used in the encryption process according to the key character string of the local blockchain account.
In the case that the encryption algorithm is an elliptic curve encryption algorithm, in the key processing process, the key character string of the local blockchain account is obtained according to the character string converted from the parameters of the elliptic curve and the parameters of the key. Therefore, in the key using process, after the key character string of the local blockchain account is obtained, the inverse process of the cryptographic process can be adopted, namely the elliptic curve used in the encryption process and the key of the local blockchain account can be reconstructed. Specifically, the parameter of the elliptic curve and the parameter of the key may be read from the key string of the local blockchain account, and then the elliptic curve used in the encryption process and the key of the local blockchain account may be reconstructed according to the read parameters.
And S850, reconstructing the elliptic curve used in the encryption process according to the parameters of the elliptic curve.
Specifically, after parameters of an elliptic curve and parameters of a secret key used in an encryption process are determined according to a secret key character string of the local blockchain account, an analytical expression corresponding to the elliptic curve can be determined according to the parameters of the elliptic curve and the like, and then the elliptic curve used in the encryption process is obtained.
And S860, reconstructing the key of the local block chain account according to the reconstructed elliptic curve and the parameter of the key.
Specifically, since the key of the account in the local block is determined based on the elliptic curve encryption algorithm, the key of the local block chain account can be obtained according to the reconstructed elliptic curve and the parameters of the key after the elliptic curve used in the encryption process is reconstructed according to the parameters of the elliptic curve. For example, the key parameter may be used as a value of an elliptic curve, or a value of one or more parameters in the elliptic curve, and then the elliptic curve is solved reversely, so as to obtain the key of the local blockchain account.
S870, using the reconstructed elliptic curve and the key, signs the blockchain transaction request of the local blockchain account.
The technical scheme provided by the embodiment of the invention provides a thought of how to reconstruct the encryption algorithm and the key according to the key character string under the condition that the encryption algorithm is an elliptic curve encryption algorithm, and then the block chain transaction request of the local block chain account can be signed by using the reconstructed encryption algorithm and the reconstructed key. According to the scheme, a user does not need to memorize the key of the local blockchain account, and can complete the signature of the blockchain transaction request of the local blockchain account only by inputting the transaction password, so that the user experience is improved. In addition, the cipher key character string ciphertext is recorded in the user terminal equipment, so that the cipher key plaintext can be prevented from being stolen by other people, and the method has high safety and usability.
Example nine
Fig. 9 is a block diagram of a key processing apparatus according to a ninth embodiment of the present invention, where the apparatus may be configured in a user terminal device. The device can execute the key processing method provided by the first to the fourth embodiments of the invention, and has the corresponding functional modules and beneficial effects of the execution method. As shown in fig. 9, the apparatus may include:
a key determining module 910, configured to determine a key of the local blockchain account by using an encryption algorithm;
a key string determining module 920, configured to determine a key string of the local blockchain account according to the characteristics of the encryption algorithm and the characteristics of the key;
the ciphertext determining module 930 is configured to process the key string of the local blockchain account according to the transaction password of the local user, to obtain a key string ciphertext, where the key string ciphertext is used to be recorded in the user terminal device.
According to the technical scheme provided by the embodiment of the invention, after the key of the local blockchain account is determined by using the encryption algorithm, the key character string of the local blockchain account can be determined according to the characteristics of the encryption algorithm and the characteristics of the key; and then processing the key character string of the local block chain account by adopting the transaction key of the local user to obtain a key character string ciphertext, and recording the key character string ciphertext in user terminal equipment. Compared with the prior art, the key of the local block chain account is converted into the key character string ciphertext through layer-by-layer processing and is recorded in the user terminal equipment, so that the key plaintext can be prevented from being stolen by other people, and the method has high safety and usability. In addition, the user does not need to memorize the key of the local blockchain account.
For example, if the encryption algorithm is an elliptic curve encryption algorithm, the key string determining module 920 may be specifically configured to:
extracting parameters of an elliptic curve and parameters of a secret key used in the encryption process;
and converting the parameters of the elliptic curve and the parameters of the key into character strings to obtain the key character strings of the local block chain account.
For example, the ciphertext determination module 930 may include:
the first derived key determining unit is used for carrying out key derived derivation on the transaction password of the local user by using an encryption function to obtain a derived key;
and the ciphertext determining unit is used for processing the key character string of the local block chain account according to the derived key to obtain a key character string ciphertext.
Illustratively, the ciphertext determination unit may include:
an auxiliary character string determining subunit, configured to determine an auxiliary character string according to the derived key and the key character string of the local blockchain account;
a new key string determining subunit, configured to add an auxiliary string to a fixed position of a key string of the local blockchain account to obtain a new key string;
and the encryption subunit is used for encrypting the new key character string by adopting the derived key.
For example, the auxiliary string determination subunit may be specifically configured to:
performing modular processing on the byte length of the derived key by using the byte length of the key character string of the local blockchain account to obtain an intermediate characteristic value;
subtracting the difference value of the middle characteristic value from the byte length of the key character string of the local block chain account to be used as an auxiliary characteristic value;
and taking the characters taking the values of the auxiliary characteristic values as auxiliary character strings.
The transaction password is a natural semantic character string input by a user, and the device can be configured in a user terminal device, and further can be configured in a blockchain lightweight node in the user terminal device or an application program interacting with the lightweight node.
Example ten
Fig. 10 is a block diagram illustrating a key using apparatus according to a tenth embodiment of the present invention, where the apparatus may be configured in a user terminal device. The device can execute the key using method provided by the fifth to the eighth embodiments of the invention, and has the corresponding functional modules and beneficial effects of the executing method. As shown in fig. 10, the apparatus may include:
a transaction password obtaining module 1010, configured to obtain a transaction password input by a local user;
a ciphertext obtaining module 1020, configured to obtain a key string ciphertext of the local blockchain account stored in the user terminal device;
the ciphertext decryption module 1030 is configured to decrypt the key string ciphertext by using the transaction password to obtain a key string of the local blockchain account;
the algorithm key reconstruction module 1040 is configured to reconstruct an encryption algorithm and a key of the local blockchain account according to the key string of the local blockchain account;
a signature module 1050 configured to sign the blockchain transaction request of the local blockchain account using the reconstructed encryption algorithm and the key.
According to the technical scheme provided by the embodiment of the invention, when the fact that a user needs to sign the block chain transaction request of the local block chain account by using the secret key is determined, the transaction password input by the local user and the secret key character string ciphertext of the local block chain account stored in the user terminal equipment can be obtained; and decrypting the cipher key character string ciphertext by adopting the transaction password to obtain the cipher key character string of the local blockchain account, reconstructing an encryption algorithm and a cipher key according to the cipher key character string, and further signing the blockchain transaction request of the local blockchain account by using the reconstructed encryption algorithm and the reconstructed cipher key. According to the scheme, a user does not need to memorize the key of the local blockchain account, and can complete the signature of the blockchain transaction request of the local blockchain account only by inputting the transaction password, so that the user experience is improved. In addition, the cipher key character string ciphertext is recorded in the user terminal equipment, so that the cipher key plaintext can be prevented from being stolen by other people, and the method has high safety and usability.
Illustratively, the ciphertext decryption module 1030 may include:
the second derived key determining unit is used for carrying out key derived derivation on the transaction password input by the local user by using an encryption function to obtain a derived key;
and the ciphertext decryption unit is used for decrypting the cipher key string ciphertext according to the derived key to obtain the key string of the local block chain account.
It should be noted that, for the same user terminal device, the first derived key determining unit and the second derived key determining unit are the same.
Illustratively, the ciphertext decryption unit may include:
the cipher text decryption subunit is used for decrypting the cipher text of the key character string according to the derived key to obtain a new key character string;
and the character string removing subunit is used for removing the auxiliary character string from the new key character string to obtain the key character string of the local block chain account.
For example, the string culling subunit may be specifically configured to:
reading an auxiliary characteristic character value in a new key character string;
and eliminating the auxiliary characteristic character value characters at the fixed position of the new key character string.
For example, if the encryption algorithm is an elliptic curve encryption algorithm, the algorithm key reconstruction module 1040 may specifically be configured to:
determining parameters of an elliptic curve and parameters of a secret key used in an encryption process according to a secret key character string of a local block chain account;
reconstructing an elliptic curve used in the encryption process according to the parameters of the elliptic curve;
and reconstructing the key of the local block chain account according to the reconstructed elliptic curve and the parameter of the key.
Illustratively, the apparatus may further include:
the transaction request acquisition module is used for acquiring a block chain transaction request initiated by a user before acquiring a transaction password input by a local user;
and the reminding notification initiating module is used for initiating a reminding notification to notify the user of inputting the transaction password if the operation affair of the local blockchain account is contained in the blockchain affair request.
The transaction password is a natural semantic character string input by a user, and the device can be configured in a user terminal device, and further can be configured in a blockchain lightweight node in the user terminal device or an application program interacting with the lightweight node.
EXAMPLE eleven
Fig. 11 is a schematic structural diagram of an apparatus according to an eleventh embodiment of the present invention, and fig. 11 shows a block diagram of an exemplary apparatus suitable for implementing the embodiment of the present invention. The device shown in fig. 11 is only an example and should not bring any limitation to the function and the scope of use of the embodiments of the present invention. The device may be a user terminal device, typically a user terminal device that loads a blockchain lightweight node, or a user terminal device configured with an application that can interact with a lightweight node.
As shown in FIG. 11, device 12 is in the form of a general purpose computing device. The components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. Device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 11, and commonly referred to as a "hard drive"). Although not shown in FIG. 11, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of embodiments described herein.
Device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with device 12, and/or with any devices (e.g., network card, modem, etc.) that enable device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with the other modules of the device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing, such as key processing and/or key usage methods provided by embodiments of the present invention, by executing programs stored in the system memory 28.
Example twelve
An embodiment of the present invention provides a computer-readable storage medium, on which a computer program (or referred to as computer-executable instructions) is stored, where the computer program is used for executing a key processing method when executed by a processor, and the method includes:
determining a key of a local blockchain account by using an encryption algorithm;
determining a key character string of the local blockchain account according to the characteristics of the encryption algorithm and the characteristics of the key;
and processing the key character string of the local block chain account according to the transaction password of the local user to obtain a key character string ciphertext, wherein the key character string ciphertext is used for being recorded in user terminal equipment.
And/or a method of key usage, the method comprising:
acquiring a transaction password input by a local user;
acquiring a key character string ciphertext of a local area block chain account stored in user terminal equipment;
decrypting the cipher key character string ciphertext by adopting the transaction password to obtain a cipher key character string of the local block chain account;
reconstructing an encryption algorithm and a key of the local blockchain account according to the key character string of the local blockchain account;
the blockchain transaction request of the local blockchain account is signed using the reconstructed encryption algorithm and key.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the embodiments of the present invention have been described in more detail through the above embodiments, the embodiments of the present invention are not limited to the above embodiments, and many other equivalent embodiments may be included without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (17)

1. A key processing method is applied to user terminal equipment, and the method comprises the following steps:
determining a key of a local blockchain account by using an encryption algorithm;
determining a key character string of the local blockchain account according to the characteristics of the encryption algorithm and the characteristics of the key; the characteristics of the encryption algorithm are characterized by the parameters of the encryption function or the analysis function associated with the encryption algorithm; the key is obtained by carrying out Hash operation on the key through a Hash algorithm according to the characteristics of the key;
processing a key character string of the local block chain account according to a transaction password of a local user to obtain a key character string ciphertext, wherein the key character string ciphertext is used for being recorded in user terminal equipment; the transaction password is a natural semantic character string.
2. The method of claim 1, wherein if the encryption algorithm is an elliptic curve encryption algorithm, determining a key string of a local blockchain account according to the characteristics of the encryption algorithm and the characteristics of the key comprises:
extracting parameters of an elliptic curve and parameters of the secret key used in the encryption process;
and converting the parameters of the elliptic curve and the parameters of the secret key into character strings to obtain the secret key character strings of the local block chain account.
3. The method of claim 1, wherein processing the key string of the local blockchain account according to a transaction password of a local user to obtain a key string ciphertext comprises:
carrying out key derivation on the transaction password of the local user by using an encryption function to obtain a derived key;
and processing the key character string of the local block chain account according to the derived key to obtain a key character string ciphertext.
4. The method of claim 3, wherein processing the key string of the local blockchain account from the derived key comprises:
determining an auxiliary character string according to a derived key and a key character string of the local blockchain account;
adding the auxiliary character string at a fixed position of the key character string of the local block chain account to obtain a new key character string;
encrypting the new key string using the derivative key.
5. The method of claim 4, wherein determining an auxiliary string based on a derived key and a key string of the local blockchain account comprises:
performing modular processing on the byte length of the derived key by using the byte length of the key character string of the local block chain account to obtain an intermediate characteristic value;
taking the difference value between the byte length of the key character string of the local block chain account and the intermediate characteristic value as an auxiliary characteristic value;
and taking the characters taking the values of the auxiliary characteristic values as auxiliary character strings.
6. The method according to claim 1, wherein the transaction password is a natural semantic character string input by a user, and the execution subject of the method is a blockchain lightweight node in a user terminal device or an application program interacting with the lightweight node.
7. A key usage method, applied to a user terminal device, the method comprising:
acquiring a transaction password input by a local user;
acquiring a key character string ciphertext of a local block chain account stored in the user terminal equipment;
decrypting the cipher key character string ciphertext by adopting the transaction password to obtain a cipher key character string of the local block chain account;
reconstructing an encryption algorithm and a key of the local blockchain account according to the key character string of the local blockchain account;
the blockchain transaction request of the local blockchain account is signed using the reconstructed encryption algorithm and key.
8. The method of claim 7, wherein decrypting the key string ciphertext using the transaction cipher to obtain the key string of the local blockchain account comprises:
carrying out key derivation on a transaction password input by a local user by using an encryption function to obtain a derived key;
and decrypting the key character string ciphertext according to the derived key to obtain the key character string of the local block chain account.
9. The method of claim 8, wherein decrypting the key string ciphertext according to the derived key to obtain a key string of a local blockchain account comprises:
decrypting the key character string ciphertext according to the derived key to obtain a new key character string;
and removing the auxiliary character string from the new key character string to obtain the key character string of the local block chain account.
10. The method of claim 9, wherein removing helper strings from new key strings comprises:
reading an auxiliary characteristic character value in a new key character string;
and eliminating the auxiliary characteristic character value characters at the fixed position of the new key character string.
11. The method of claim 7, wherein reconstructing the cryptographic algorithm and the key of the local blockchain account from the key string of the local blockchain account if the cryptographic algorithm is an elliptic curve cryptographic algorithm comprises:
determining parameters of an elliptic curve and parameters of a secret key used in an encryption process according to a secret key character string of a local block chain account;
reconstructing an elliptic curve used in the encryption process according to the parameters of the elliptic curve;
and reconstructing the key of the local block chain account according to the reconstructed elliptic curve and the parameters of the key.
12. The method of claim 7, wherein prior to obtaining the transaction password entered by the local user, further comprising:
acquiring a block chain transaction request initiated by a user;
and if the block chain transaction request contains the operation on the local block chain account, initiating a reminding notice to inform a user of inputting a transaction password.
13. The method according to claim 7, wherein the transaction password is a natural semantic character string input by a user, and the execution subject of the method is a blockchain lightweight node in a user terminal device or an application program interacting with the lightweight node.
14. A key processing apparatus, provided in a user terminal device, comprising:
the key determining module is used for determining a key of the local block chain account by using an encryption algorithm;
the key character string determining module is used for determining a key character string of the local block chain account according to the characteristics of the encryption algorithm and the characteristics of the key; the characteristics of the encryption algorithm are characterized by the parameters of the encryption function or the analysis function associated with the encryption algorithm; the key is obtained by carrying out Hash operation on the key through a Hash algorithm according to the characteristics of the key;
the cipher text determining module is used for processing the key character string of the local area chain account according to the transaction password of the local user to obtain a key character string cipher text, and the key character string cipher text is used for being recorded in user terminal equipment; the transaction password is a natural semantic character string.
15. A key usage apparatus, configured in a user terminal device, the apparatus comprising:
the transaction password acquisition module is used for acquiring a transaction password input by a local user;
a ciphertext acquisition module, configured to acquire a key string ciphertext of a local blockchain account stored in the user terminal device;
the cipher text decryption module is used for decrypting the cipher text of the key character string by adopting the transaction password to obtain the key character string of the local block chain account;
the algorithm key reconstruction module is used for reconstructing an encryption algorithm and a key of the local blockchain account according to the key character string of the local blockchain account;
and the signature module is used for signing the block chain transaction request of the local block chain account by using the reconstructed encryption algorithm and the key.
16. A user terminal device, comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the key processing method of any one of claims 1-6 or the key usage method of any one of claims 7-13.
17. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a key processing method according to any one of claims 1 to 6, or a key usage method according to any one of claims 7 to 13.
CN201910107557.8A 2019-02-02 2019-02-02 Key processing and using method, device, equipment and storage medium Active CN109818751B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910107557.8A CN109818751B (en) 2019-02-02 2019-02-02 Key processing and using method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910107557.8A CN109818751B (en) 2019-02-02 2019-02-02 Key processing and using method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109818751A CN109818751A (en) 2019-05-28
CN109818751B true CN109818751B (en) 2021-12-07

Family

ID=66605229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910107557.8A Active CN109818751B (en) 2019-02-02 2019-02-02 Key processing and using method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109818751B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109818751B (en) * 2019-02-02 2021-12-07 百度在线网络技术(北京)有限公司 Key processing and using method, device, equipment and storage medium
CN110990872B (en) * 2019-12-03 2022-03-25 成都链鱼科技有限公司 Private key export two-dimensional code storage and scanning recovery method based on block chain
CN111031475B (en) * 2019-12-19 2021-05-18 达闼机器人有限公司 Method for collecting terminal position information, terminal, position collecting terminal and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108702287A (en) * 2018-04-16 2018-10-23 深圳前海达闼云端智能科技有限公司 Information publication based on block chain and acquisition methods, device and block chain node
CN108833093A (en) * 2018-06-14 2018-11-16 百度在线网络技术(北京)有限公司 Determination method, apparatus, equipment and the storage medium of account key
US20180351750A1 (en) * 2016-06-16 2018-12-06 The Bank Of New York Mellon Distributed, centrally authored block chain network
CN108964903A (en) * 2018-07-12 2018-12-07 腾讯科技(深圳)有限公司 password storage method and device
CN109120639A (en) * 2018-09-26 2019-01-01 众安信息技术服务有限公司 A kind of data cloud storage encryption method and system based on block chain
CN109818751A (en) * 2019-02-02 2019-05-28 百度在线网络技术(北京)有限公司 Key handling and application method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180351750A1 (en) * 2016-06-16 2018-12-06 The Bank Of New York Mellon Distributed, centrally authored block chain network
CN108702287A (en) * 2018-04-16 2018-10-23 深圳前海达闼云端智能科技有限公司 Information publication based on block chain and acquisition methods, device and block chain node
CN108833093A (en) * 2018-06-14 2018-11-16 百度在线网络技术(北京)有限公司 Determination method, apparatus, equipment and the storage medium of account key
CN108964903A (en) * 2018-07-12 2018-12-07 腾讯科技(深圳)有限公司 password storage method and device
CN109120639A (en) * 2018-09-26 2019-01-01 众安信息技术服务有限公司 A kind of data cloud storage encryption method and system based on block chain
CN109818751A (en) * 2019-02-02 2019-05-28 百度在线网络技术(北京)有限公司 Key handling and application method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《一种用于终端小型设备的轻量级》;刘艳;《软件学报》;20190131;全文 *

Also Published As

Publication number Publication date
CN109818751A (en) 2019-05-28

Similar Documents

Publication Publication Date Title
CN109150499B (en) Method and device for dynamically encrypting data, computer equipment and storage medium
CN109951295B (en) Key processing and using method, device, equipment and medium
CN107733656A (en) A kind of cipher authentication method and device
CN107612683B (en) Encryption and decryption method, device, system, equipment and storage medium
CN101236591B (en) Method, terminal and safe chip for guaranteeing critical data safety
CN109818751B (en) Key processing and using method, device, equipment and storage medium
CN110084599B (en) Key processing method, device, equipment and storage medium
EP2352251A1 (en) Content decoding apparatus, content decoding method and integrated circuit
CN111835774B (en) Data processing method, device, equipment and storage medium
KR20100016579A (en) System and method for distribution of credentials
CN106067874B (en) It is a kind of by the method for data record to server end, terminal and server
CN110661814A (en) Bidding file encryption and decryption method, device, equipment and medium
CN109613990A (en) Soft keyboard secured inputting method, server, client, electronic equipment and medium
CN111062045A (en) Information encryption and decryption method and device, electronic equipment and storage medium
CN112287379A (en) Service data using method, device, equipment, storage medium and program product
CN113872770A (en) Security verification method, system, electronic device and storage medium
CN112989391A (en) Hybrid encryption method, hybrid decryption method, system, device and storage medium
CN115473722A (en) Data encryption method and device, electronic equipment and storage medium
CN109711178B (en) Key value pair storage method, device, equipment and storage medium
CN106789017A (en) Accounts information Explore of Unified Management Ideas based on biological feature encryption
CN113946863A (en) Data encryption storage method, system, equipment and storage medium
CN110601836B (en) Key acquisition method, device, server and medium
CN111415155A (en) Encryption method, device, equipment and storage medium for chain-dropping transaction data
CN115396179A (en) Data transmission method, device, medium and equipment based on block chain
CN114117404A (en) User authentication method, device, equipment, system and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant