CN110517045B - Block chain data processing method, device, equipment and storage medium - Google Patents

Block chain data processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN110517045B
CN110517045B CN201911002855.7A CN201911002855A CN110517045B CN 110517045 B CN110517045 B CN 110517045B CN 201911002855 A CN201911002855 A CN 201911002855A CN 110517045 B CN110517045 B CN 110517045B
Authority
CN
China
Prior art keywords
signature
target
algorithm
uniform
data structure
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
CN201911002855.7A
Other languages
Chinese (zh)
Other versions
CN110517045A (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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201911002855.7A priority Critical patent/CN110517045B/en
Publication of CN110517045A publication Critical patent/CN110517045A/en
Application granted granted Critical
Publication of CN110517045B publication Critical patent/CN110517045B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management

Abstract

The embodiment of the invention discloses a block chain data processing method, a block chain data processing device, block chain data processing equipment and a storage medium. The method comprises the following steps: determining target transaction data to be processed by a target user; based on a target signature algorithm, performing digital signature on target transaction data by adopting a block chain key of a target user to obtain target signature content; and generating a uniform signature result with a uniform signature data structure according to a target signature algorithm and the target signature content. The embodiment of the invention realizes the unification of the signature data structure in the blockchain network by generating the unified signature result with the unified signature data structure and integrating the identification information of the target signature algorithm into the unified signature result, supports the blockchain network to use the unified digital signature technology, avoids the additional independent addition and sending of the signature algorithm information, enables the signature algorithm information to be fused in the signature result, directly embodies the used signature algorithm in the unified signature result, and is convenient for signature verification of the signature result.

Description

Block chain data processing method, device, equipment and storage medium
Technical Field
The present invention relates to the field of blockchain technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing blockchain data.
Background
With the continuous development of internet technology, a decentralized and transparent block chain technology is developed. The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm.
In order to verify that the transaction data transmitted in the blockchain is actually signed and sent by the sender and to determine the integrity of the transaction data, digital signature technology is generally used to sign and verify the transaction data. The digital signature technique is to encrypt the digest information with the sender's private key and transmit it to the receiver together with the transaction data. Correspondingly, the receiver can decrypt the encrypted summary information only by using the public key of the sender, then generates summary information for the received transaction data by using the hash function, and compares the summary information with the summary information obtained by decryption to realize signature verification of the transaction data.
The signature algorithms on the current block chain network are more in variety, such as ECDSA, EDDSA, Schnorr, ring signature, multiple signature and the like, and binary signature data generated based on various signature algorithms have diversity, so that a uniform digital signature technology does not exist in the block chain network, and the difficulty and uncertainty of signature verification are increased.
Disclosure of Invention
The embodiment of the invention provides a block chain data processing method, a block chain data processing device, block chain data processing equipment and a block chain data processing storage medium, which can support a block chain network to use a uniform digital signature technology.
In a first aspect, an embodiment of the present invention provides a method for processing blockchain data, where the method is performed by a user node, and the method includes:
determining target transaction data to be processed by a target user;
based on a target signature algorithm, performing digital signature on the target transaction data by adopting a block chain key of the target user to obtain target signature content;
and generating a uniform signature result with a uniform signature data structure according to the target signature algorithm and the target signature content.
In a second aspect, an embodiment of the present invention provides a method for processing blockchain data, where the method is performed by a user node, and the method includes:
acquiring a block chain key of a target user, target transaction data and a uniform signature result with a uniform signature data structure;
determining a target signature algorithm and target signature content of the target transaction data according to the uniform signature result and the uniform signature data structure;
and based on the target signature algorithm, adopting the block chain key of the target user and the target transaction data to verify the signature of the target signature content.
In a third aspect, an embodiment of the present invention provides a device for processing block chain data, where the device is configured at a user node, and the device includes:
the transaction data determining module is used for determining target transaction data to be processed by a target user;
the digital signature module is used for digitally signing the target transaction data by adopting the block chain key of the target user based on a target signature algorithm to obtain target signature content;
and the signature result generation module is used for generating a uniform signature result with a uniform signature data structure according to the target signature algorithm and the target signature content.
In a fourth aspect, an embodiment of the present invention provides a device for processing blockchain data, where the device is configured at a user node, and the device includes:
the signature result acquisition module is used for acquiring a block chain key of a target user, target transaction data and a uniform signature result with a uniform signature data structure;
the digital signature determining module is used for determining a target signature algorithm and target signature content of the target transaction data according to the uniform signature result and the uniform signature data structure;
and the signature verification module is used for verifying the signature of the target signature content by adopting the block chain key of the target user and the target transaction data based on the target signature algorithm.
In a fifth aspect, an embodiment of the present invention provides an apparatus, including:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for processing blockchain data according to any embodiment of the first aspect of the present invention, or implement the method for processing blockchain data according to any embodiment of the second aspect of the present invention.
In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the blockchain data processing method according to any embodiment of the first aspect of the present invention, or implements the blockchain data processing method according to any embodiment of the second aspect of the present invention.
The embodiment of the invention takes a target user as a sender of transaction data, determines the target transaction data to be processed by the target user, digitally signs the target transaction data by adopting a block chain key of the target user based on a target signature algorithm to obtain target signature content, and finally generates a uniform signature result with a uniform signature data structure together according to the target signature algorithm and the target signature content. The embodiment of the invention realizes the unification of the signature data structure in the blockchain network by generating the unified signature result with the unified signature data structure and integrating the identification information of the target signature algorithm into the unified signature result, supports the blockchain network to use the unified digital signature technology, avoids the additional independent addition and sending of the signature algorithm information, enables the signature algorithm information to be fused in the signature result, directly embodies the used signature algorithm in the unified signature result, and is convenient for signature verification of the signature result.
Drawings
Fig. 1 is a flowchart of a block chain data processing method according to an embodiment of the present invention;
fig. 2 is a flowchart of a block chain data processing method according to a second embodiment of the present invention;
fig. 3 is a flowchart of a block chain data processing method according to a third embodiment of the present invention;
fig. 4 is a flowchart of a block chain data processing method according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a block chain data processing apparatus according to a fifth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a block chain data processing apparatus according to a sixth embodiment of the present invention;
fig. 7 is a schematic structural diagram of an apparatus according to a seventh 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.
It should be further noted that, for the convenience of description, only some but not all of the relevant portions of the present application are shown in the drawings. Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example one
Fig. 1 is a flowchart of a method for processing blockchain data according to an embodiment of the present invention, where the embodiment is applicable to a case where a user node in a blockchain network digitally signs transaction data, and the method can be executed by a blockchain data processing apparatus, which can be implemented in software and/or hardware, and is preferably configured at the user node. The method specifically comprises the following steps:
and S110, determining target transaction data to be processed by a target user.
In the embodiment of the present invention, the target transaction data refers to transaction data to be digitally signed, for example, original transaction content between the sender and the receiver, so that the sender sends the target transaction data added with the digital signature to the receiver, and accordingly, the receiver can verify the target transaction data according to the digital signature. Taking a transaction scenario as an example, the transaction data may include transaction input information, transaction output information, transaction time information, transaction initiator information, transaction description information, ETC (ethereal Classic). The transaction data can be plaintext without encryption processing or ciphertext processed based on an encryption algorithm.
In this embodiment, the target user refers to a sender of the target transaction data, and the target user transmits the target transaction data to at least one other user node in the block chain network through the user node, so that the receiver receives the target transaction data through the at least one other user node.
The user node may be a common block link node or a lightweight node, and the user node may serve one or more target users. Specifically, the lightweight node is used as a node in the blockchain network, and can directly send a request to the blockchain and receive transaction data fed back by the blockchain network or other blockchain nodes. The device to which the target user belongs can be used as a user node to directly process the transaction data of the target user; or, the device to which the target user belongs may be used as an external device to perform communication connection with the user node, and the user node may be used as a channel for communication between the blockchain and the external device, and may receive information sent by the external device, generate a transaction request, transmit the transaction request to the blockchain network, and transmit information acquired from the blockchain to the external device. Meanwhile, the user node is used as a node in the block chain network, and can process the transaction processing request in the block chain.
Specifically, the target user may operate a terminal device to which the user node belongs, or operate an external device communicatively connected to the user node, and initiate a transaction processing request to the blockchain network, so as to transmit the target transaction data to the blockchain network. Correspondingly, the user node determines target transaction data to be processed by the target user according to the transaction processing request.
And S120, based on a target signature algorithm, performing digital signature on the target transaction data by using the block chain key of the target user to obtain target signature content.
In an embodiment of the present invention, the blockchain key of the user may include a private key and a public key, and based on the blockchain key, the user may perform digital signature according to a signature algorithm, or perform signature verification according to the signature algorithm, and may also perform encryption or decryption according to an encryption algorithm, and the like. In the digital signature process, the private key is usually used for a user to perform encryption signature on transaction data to be sent, and the public key is used for other users to decrypt and verify the received transaction data. The user's blockchain key may be obtained upon receiving the user's transaction request or upon determining the target transaction data to be processed for the target user.
The user's blockchain key may be generated according to a target elliptic curve adopted in an elliptic curve-type encryption algorithm when creating the user's blockchain account. For example, the user node obtains a random number from the blockchain network, or the user node locally generates the random number based on a random number generation rule, takes the random number as a parameter of an analytic expression corresponding to the target elliptic curve, and takes a solving result as a value-taking part in the blockchain key of the user by solving the analytic expression corresponding to the target elliptic curve. Correspondingly, the target elliptic curve information can be extracted according to the block chain key of the user.
In this embodiment, the target Signature Algorithm is a specific Digital Signature Algorithm (DSA) adopted when the user node digitally signs target transaction data to be processed by the target user at present. The digital signature algorithm is based on a certain operation rule, and usually adopts a private key of a transaction data sender to perform operation processing on the whole transaction data to be sent so as to generate the target signature content of the digital signature. The digital signature algorithm includes, but is not limited to, ECDSA, EdDSA, multiple signature algorithm, and ring signature algorithm. The target signature algorithm may be an algorithm specified when the target user initiates the request, or may be an algorithm selected by the user node based on factors such as a smart contract. One or more digital signature algorithms may be included in the target signature algorithm.
Specifically, according to an operation rule specified by a target signature algorithm, the whole target transaction data is operated by using a block chain key of a target user, and target signature content including the digital signature and the target transaction data is generated. Illustratively, based on a target signature algorithm, a user node generates a digest from target transaction data by using a hash function, and encrypts the digest by using a block chain key of a target user to obtain a digital signature corresponding to the target transaction data as target signature content.
And S130, generating a uniform signature result with a uniform signature data structure according to the target signature algorithm and the target signature content.
In the specific embodiment of the invention, the target signature content is not directly sent as the final signature result, but the original signature is secondarily packaged by combining a target signature algorithm to generate a uniform signature result with a uniform signature data structure. The uniform signature result with the uniform signature data structure not only comprises identification information of a target signature algorithm, but also unifies data structures of different signature algorithms in the blockchain network, so that a uniform digital signature technology supporting different signature algorithms is formed in the blockchain network.
In this embodiment, for the target signature content, each signature algorithm has a corresponding original signature data structure, that is, the original signature data structure corresponding to the signature algorithm is used for recording the target signature content. Correspondingly, according to the original signature data structure corresponding to the signature algorithm, the target signature content and the information such as the digital signature therein can be analyzed from the original signature data structure, so that the receiver can verify according to the digital signature.
In this embodiment, for the target signature content and the target signature algorithm, the original signature data structures of all signature algorithms are secondarily encapsulated, and a uniform signature data structure is configured for all signature algorithms, that is, the uniform signature data structure includes not only the target signature content but also the identification information of the target signature algorithm. Correspondingly, the uniform signature data structure at least comprises a signature content part and a signature algorithm identification part, the signature algorithm identification information is used as a part of the signature result instead of independent information, the association degree of the signature algorithm identification information and the signature content is improved, data loss easily caused when information is transmitted in an independent form is avoided, the signature data structure has an algorithm identification function on the signature content, a receiver can conveniently and quickly determine a target signature algorithm according to the signature algorithm identification, and the signature content is directly verified by adopting the target signature algorithm.
Specifically, the signature content part in the uniform signature data structure is determined according to the target signature content, wherein the target signature content may be encoded based on a certain Encoding rule, for example, DER (distinguishable Encoding Rules), to obtain a target signature byte array, and the target signature byte array is used as a value of the signature content part in the uniform signature data structure. And determining a signature algorithm identification part in the unified signature data structure according to the target signature algorithm, wherein if the target signature algorithm comprises an elliptic curve digital signature algorithm, determining a target elliptic curve used by the elliptic curve digital signature algorithm, and determining the signature algorithm identification part in the unified signature data structure according to identification information of the elliptic curve digital signature algorithm and identification information of the target elliptic curve. And generating a uniform signature result according to the determined signature content part and the signature algorithm identification part.
In addition, based on consideration of difficulty and convenience in writing, analyzing and generating the signature result, a certain data exchange mode, such as a JSON (JavaScript Object Notation) data exchange format, can be adopted to convert the uniform signature result into a byte array format to obtain a final signature result of the target transaction data.
For example, assume that the target signature algorithm is a multiple signature algorithm and that the generated original signature data structure is as follows:
type MultiSignature struct {
S []byte
R []byte
}。
wherein, MultiSignature represents a multiple signature algorithm; the type MultiSignature struct represents an original signature data structure corresponding to a multiple signature algorithm in a byte array format; s and R represent the target signature content in the form of a byte array. According to the target signature algorithm and the target signature content, the following uniform signature result with a uniform signature data structure can be generated:
type XuperSignature struct {
SigType string
SigContent []byte
}。
wherein, XuperSignature represents the uniform signature result of the final uniform signature data structure; typeXupSignature struct represents a uniform signature data structure for secondarily encapsulating target signature contents; SigType represents the algorithm identifier of the target signature algorithm, and for example, the symbol "MultiSig" represents multiple signatures, "RingSig" represents ring signature algorithm; SigContent represents the content of the target signature in the form of an array of bytes.
According to the technical scheme of the embodiment, a target user is taken as a sender of transaction data, target transaction data to be processed by the target user is determined, digital signature is carried out on the target transaction data by adopting a block chain key of the target user based on a target signature algorithm to obtain target signature content, and finally a uniform signature result with a uniform signature data structure is generated together according to the target signature algorithm and the target signature content. The embodiment of the invention realizes the unification of the signature data structure in the blockchain network by generating the unified signature result with the unified signature data structure and integrating the identification information of the target signature algorithm into the unified signature result, supports the blockchain network to use the unified digital signature technology, avoids the additional independent addition and sending of the signature algorithm information, enables the signature algorithm information to be fused in the signature result, directly embodies the used signature algorithm in the unified signature result, and is convenient for signature verification of the signature result.
Example two
The present embodiment provides a preferred implementation of the block chain data processing method based on the first embodiment, and is capable of generating a uniform signature result including a signature content part and a signature algorithm identification part in a uniform signature data structure according to a target signature algorithm and a target signature content. Fig. 2 is a flowchart of a block chain data processing method according to a second embodiment of the present invention, as shown in fig. 2, the method specifically includes the following steps:
s210, determining target transaction data to be processed by a target user.
S220, based on the target signature algorithm, the block chain key of the target user is adopted to carry out digital signature on the target transaction data so as to obtain target signature content.
In the embodiment of the invention, according to an operation rule specified by a target signature algorithm, the whole target transaction data is operated by adopting a block chain key of a target user to generate target signature content including a signature. Further, for the target signature content, each signature algorithm has a corresponding original signature data structure, that is, the original signature data structure corresponding to the signature algorithm is used for recording the target signature content.
And S230, determining a signature content part in the unified signature data structure according to the target signature content.
In a specific embodiment of the present invention, the uniform signature data structure is a representation of a uniform signature result, and at least a signature content part is divided in the uniform signature data structure and is used for recording a digital signature for the target transaction data, that is, the target signature content. The method and the device can perform secondary processing on an original signature data structure of the target signature content generated based on the target signature algorithm to serve as a signature content part in a uniform signature data structure.
Optionally, encoding the target signature content to obtain a target signature byte array; and taking the target signature byte array as a value of the signature content part in the unified signature data structure.
In this embodiment, the target signature content may be encoded based on a certain encoding rule, and the representation form of the uniform signature content obtains the target signature content in the form of a byte array, so that the target signature byte array is used as a value of the signature content part in the uniform signature data structure. The target signature content can be coded by adopting a binary-based DER coding standard based on the ASN.1 language standard.
And S240, determining a signature algorithm identification part in the unified signature data structure according to the target signature algorithm.
In the specific embodiment of the present invention, the unified signature data structure is further divided into at least a signature algorithm identification portion for recording a signature algorithm for generating a target signature content, and the unique identification information of the target signature algorithm may be stored in the signature algorithm identification portion. If the target signature algorithm may further include at least one optional algorithm detail operation condition, for example, different elliptic curves may be adopted in the circular curve digital signature algorithm, the at least one algorithm detail operation condition may be further determined, and the identification information of the at least one algorithm detail operation condition and the identification information of the target signature algorithm are recorded in the signature algorithm identification portion together, so as to sufficiently identify the signature algorithm, avoid the occurrence of an uncertain condition of any factor in the signature algorithm, and avoid the uncertainty of any factor from causing the target signature algorithm to be unable to be executed.
Optionally, if the target signature algorithm includes an elliptic curve digital signature algorithm, determining a target elliptic curve used by the elliptic curve digital signature algorithm; and determining a signature algorithm identification part in the uniform signature data structure according to the identification information of the elliptic curve digital signature algorithm and the identification information of the target elliptic curve.
In this embodiment, the target signature algorithm may include one or more digital signature algorithms, and since different elliptic curves may be used in the elliptic curve digital signature algorithm for digital signature, if it is detected that the target signature algorithm includes the elliptic curve digital signature algorithm, the target elliptic curve used needs to be further determined according to the algorithm identifier. The target elliptic curve can be determined according to elliptic curve information adopted by an elliptic curve digital signature algorithm in the target signature algorithm, and the target elliptic curve information can be extracted from a block chain key of a target user. And finally, taking the identification information of the elliptic curve digital signature algorithm and the identification information of the target elliptic curve as the values of the identification part of the signature algorithm.
And S250, generating a uniform signature result comprising a signature algorithm identification part and a signature content part.
In the specific embodiment of the invention, the target signature content is not directly sent as the final signature result, but the original signature data structure is secondarily packaged by combining the target signature algorithm, and the uniform signature result is generated according to the signature algorithm identification part and the signature content part on the basis of the uniform signature data structure.
And S260, converting the uniform signature result into a byte array format to obtain a final signature result of the target transaction data.
In the specific embodiment of the present invention, based on consideration of difficulty and convenience in writing, analyzing, and generating the signature result, a certain data exchange manner, for example, a JSON (JavaScript Object Notation) data exchange format, may be adopted to convert the uniform signature result into a byte array format, so as to obtain a final signature result of the target transaction data. Therefore, the final signature result is unified in form, namely the final signature result generated by different signature algorithms is identical in form, the final signature result encapsulates the signature content and the signature algorithm information together from the content, the signature algorithm information is used for identifying the signature algorithm of the signature content, and the signature mode supports all digital signature algorithms in the block chain network, so that all digital signature algorithms are unified, and the transmission and the unified processing of transaction data are facilitated.
According to the technical scheme of the embodiment, a target user is used as a sender of transaction data, target transaction data to be processed by the target user is determined, digital signature is performed on the target transaction data by adopting a block chain key of the target user based on a target signature algorithm to obtain target signature content, a signature content part in a uniform signature data structure is determined according to the target signature content, a signature algorithm identification part in the uniform signature data structure is determined according to the target signature algorithm, a uniform signature result comprising the signature algorithm identification part and the signature content part is generated, and the uniform signature result is converted into a byte array format to obtain a final signature result of the target transaction data. The embodiment of the invention realizes the unification of the signature data structure in the blockchain network by generating the unified signature result with the unified signature data structure and integrating the identification information of the target signature algorithm into the unified signature result, supports the blockchain network to use the unified digital signature technology, avoids the additional independent addition and sending of the signature algorithm information, enables the signature algorithm information to be fused in the signature result, directly embodies the used signature algorithm in the unified signature result, and is convenient for signature verification of the signature result.
EXAMPLE III
Fig. 3 is a flowchart of a method for processing blockchain data according to a third embodiment of the present invention, where the method is applicable to a situation where a user node performs a signature verification on received transaction data, and the method can be executed by a blockchain data processing apparatus, and the apparatus can be implemented in a software and/or hardware manner, and is preferably configured in the user node. The method specifically comprises the following steps:
s310, acquiring a block chain key of a target user, target transaction data and a uniform signature result with a uniform signature data structure.
In an embodiment of the present invention, the target transaction data refers to transaction data to be verified, for example, original content of a transaction between a sender and a receiver, so that the receiver can verify the target transaction data according to the digital signature. Taking a transaction scenario as an example, the transaction data may include transaction input information, transaction output information, transaction time information, transaction initiator information, transaction description information, ETC (ethereal Classic). The transaction data can be plaintext without encryption processing or ciphertext processed based on an encryption algorithm.
In this embodiment, the target user refers to a sender of the target transaction data, and the target user transmits the target transaction data to at least one other user node in the block chain network through the user node, so that the receiver receives the target transaction data through the at least one other user node.
In this embodiment, based on the digital signature of the sending user node on the target transaction data in the foregoing embodiment, the digital signature of the target transaction data is no longer a single signature content, but is a uniform signature result having a uniform signature data structure. The uniform signature data structure is at least divided into a signature content part and a signature algorithm identification part, the signature content part is used for recording a digital signature of target transaction data, and the signature algorithm identification part records signature algorithm information when a user records the signature of the target transaction data. And generating a uniform signature result comprising signature content and a signature algorithm identifier based on the uniform signature data structure, wherein the signature algorithm adopted by the signature content is directly embodied by the signature algorithm identifier part in the uniform signature result, so that a receiver can conveniently and quickly identify the signature algorithm of the target transaction data, and the identified signature algorithm is adopted to verify the target transaction data.
Specifically, the receiver user may receive, through a terminal device to which the user node belongs or through an external device communicatively connected to the user node, the digitally signed target transaction data transmitted in the blockchain network, and may correspondingly receive a uniform signature result having a uniform signature data structure and corresponding to the target transaction data, and a blockchain key, such as a public key, of the sender, that is, the target user.
In view of the difficulty and convenience in writing, parsing and generating the signature result, the signature result received by the user node may be a final signature result after format conversion. Optionally, the obtaining the uniform signature result with the uniform signature data structure includes: and converting the uniform signature result into a byte array format to obtain a final signature result of the target transaction data. The JSON conversion is performed, for example, based on the JSON data exchange format. And then in the process of obtaining the uniform signature result with the uniform signature data structure, the final signature result of the target transaction data in the byte array format can be obtained, and the final signature result of the target transaction data is converted into the uniform signature data structure, for example, the inverse JSON conversion, so as to obtain the uniform signature result.
And S320, determining a target signature algorithm and target signature content of the target transaction data according to the uniform signature result and the uniform signature data structure.
In the embodiment of the invention, according to the uniform signature result, the signature algorithm information of the target transaction data is extracted from the signature algorithm identification part of the uniform signature data structure, the target signature algorithm is determined, the signature content of the target transaction data is extracted from the signature content part of the uniform signature data structure, and the target signature content is determined. If the target signature algorithm comprises an elliptic curve digital signature algorithm, extracting elliptic curve information from the signature content part of the uniform signature data structure, and determining a target elliptic curve used by the elliptic curve digital signature algorithm. Wherein, elliptic curve information can be extracted from the block chain key of the target user.
S330, based on the target signature algorithm, checking the target signature content by adopting the block chain key of the target user and the target transaction data.
In the specific embodiment of the invention, through the identification information of the signature algorithm in the unified signature result, when the user node of the receiver acquires the target transaction data, the user node of the receiver faces a binary signature data and does not know which signature verification algorithm to select for verification; in the case of a binary signature, it is not known which elliptic curve should be selected for verification in the elliptic curve signature algorithm. And then, based on the identified operation rule of the target signature algorithm, the block chain key of the target user is adopted to decrypt the target signature content, and the decryption result and the received target transaction data are compared, so that the target transaction data are quickly checked.
Illustratively, based on a target signature algorithm, a user node generates a summary A from target transaction data by adopting a hash function; decrypting by using the block chain key target signature content of the target user, namely the digital signature to obtain a digest B, finally comparing the digest A with the digest B, and if the decryption result is consistent with the target transaction data, verifying the signature data correctly; otherwise, if the decryption result is consistent with the target transaction data, the signature verification data is wrong.
In this embodiment, in view of the target signature content, each signature algorithm has a corresponding original signature data structure, that is, the original signature data structure corresponding to the signature algorithm is used for recording the target signature content, and the uniform signature result of the uniform signature data structure is obtained by secondarily encapsulating the original signature data structures of all signature algorithms with respect to the target signature content and the target signature algorithm. Therefore, in the process of signature verification, firstly, an original signature data structure of a target tag name algorithm is determined as a target data structure, target signature content is decoded according to the target data structure to decode the target signature content into the target data structure, the target signature content in a unified result of the unified signature data structure is converted into the original signature data structure consistent with the target signature algorithm, and therefore signature verification is performed on the target signature content decoded into the target data structure by adopting a block chain key and target transaction data of a target user based on the target signature algorithm.
If the target signature algorithm comprises an elliptic curve digital signature algorithm, decrypting the target signature content by adopting the identified target elliptic curve and the block chain key of the target user, and comparing the decrypted result with the received target transaction data to realize the quick signature verification of the target transaction data. For algorithms such as a multiple signature algorithm and the like which need a plurality of block chain keys to carry out digital signature, verification can be carried out based on the number of the block chain keys in the process of carrying out signature verification along with target transaction data. Exemplarily, if the number of the acquired block chain keys of the target user is different from the number of the block chain keys required to be used by the target signature algorithm, determining that the signature verification is wrong; if the number of the acquired block chain keys of the target user is the same as the number of the block chain keys required to be used by the target signature algorithm, determining whether the acquired elliptic curves used by the block chain keys of at least two target users are the same; and if the used elliptic curves are different, determining that the signature verification is wrong.
According to the technical scheme of the embodiment, a target user is used as a sender of transaction data, a user node obtains a block chain key of the target user, the target transaction data and a uniform signature result with a uniform signature data structure, a target signature algorithm and target signature content of the target transaction data are determined according to the uniform signature result and the uniform signature data structure, and signature verification is performed on the target signature content by adopting the block chain key of the target user and the target transaction data based on the target signature algorithm. According to the embodiment of the invention, the signature algorithm information is fused in the signature result by receiving the uniform signature result with the uniform signature data structure, the used signature algorithm is directly embodied in the uniform signature result, and the judgment basis of the signature algorithm is provided for signature verification, so that the signature verification is carried out on the target transaction data based on the determined target signature algorithm, and the signature verification is conveniently carried out on the signature result.
Example four
On the basis of the third embodiment, this embodiment provides a preferred implementation of the block chain data processing method, which is capable of verifying the digital signature based on the determined target signature algorithm and the signature data structure converted by the structure. Fig. 4 is a flowchart of a block chain data processing method according to a fourth embodiment of the present invention, as shown in fig. 4, the method specifically includes the following steps:
s410, acquiring a block chain key of a target user, target transaction data and a uniform signature result with a uniform signature data structure.
S420, taking the signature algorithm identification part in the uniform signature data structure in the uniform signature result as a target signature algorithm of the target transaction data; and taking the signature content part in the uniform signature data structure in the uniform signature result as the target signature content of the target transaction data.
In a specific embodiment of the present invention, a signature content part and a signature algorithm identification part are at least divided in a unified signature data structure, the signature content part is used for recording a digital signature for target transaction data, and the signature algorithm identification part records signature algorithm information when a user records a signature of the target transaction data. And according to the uniform signature result, extracting signature algorithm information of the target transaction data from the signature algorithm identification part of the uniform signature data structure, determining a target signature algorithm, extracting signature content of the target transaction data from the signature content part of the uniform signature data structure, and determining target signature content.
Optionally, if the target signature algorithm includes an elliptic curve digital signature algorithm, determining a target elliptic curve used by the elliptic curve digital signature algorithm according to the uniform signature result and the uniform signature data structure.
In this embodiment, since different elliptic curves can be used in the elliptic curve digital signature algorithm for digital signature, according to the algorithm identifier, if it is detected that the target signature algorithm includes the elliptic curve digital signature algorithm, elliptic curve information needs to be extracted from the signature algorithm identifier portion of the uniform signature data structure, and the target elliptic curve used by the elliptic curve digital signature algorithm is determined. Target elliptic curve information can be extracted from the blockchain key of the target user.
And S430, taking the signature data structure of the target signature algorithm as a target data structure.
In the embodiment of the present invention, each signature algorithm has a corresponding original signature data structure, that is, the original signature data structure corresponding to the signature algorithm is used for recording the target signature content, and the signature result adopts a uniform signature data structure. Therefore, in the process of signature verification, an original signature data structure adopted by a target signature algorithm is firstly determined, and the original signature data structure consistent with the target signature algorithm is taken as a target data structure.
And S440, decoding the target signature content according to the target data structure so as to decode the target signature content into the target data structure.
In an embodiment of the present invention, since the target signature algorithm can generally only parse the signature data structure consistent with itself, the target signature content is decoded into the target data structure after the target data structure of the target signature algorithm is determined.
By way of example, assume that the uniform signature results with a uniform signature data structure are as follows:
type XuperSignature struct {
SigType string
SigContent []byte
}。
and the SigType is a signature algorithm identification part, and is judged according to the SigType to determine which target signature algorithm is adopted by the target transaction data. SigContent is a signature content part, and a digital signature which is the target signature content of the target transaction data can be extracted according to SigContent.
For another example, assuming that the target signature algorithm is a multiple signature algorithm, a target data structure MultiSignature struct corresponding to the multiple algorithm is determined, and the target signature content SigContent [ ] byte in the uniform signature result is converted into the following data structure:
type MultiSignature struct {
S []byte
R []byte
}。
wherein S and R represent the target signature content in the form of byte arrays.
S450, based on the target signature algorithm, the target signature content decoded into the target data structure is verified by adopting the block chain key of the target user and the target transaction data.
In the specific embodiment of the invention, through the identification information of the signature algorithm in the unified signature result, when the user node of the receiver acquires the target transaction data, the user node of the receiver faces a binary signature data and does not know which signature verification algorithm to select for verification; in the case of a binary signature, it is not known which elliptic curve should be selected for verification in the elliptic curve signature algorithm. And then, based on the identified operation rule of the target signature algorithm, the block chain key of the target user is adopted to decrypt the target signature content, and the decryption result and the received target transaction data are compared, so that the target transaction data are quickly checked. Optionally, if the target signature algorithm includes an elliptic curve digital signature algorithm, the target signature content is verified based on the elliptic curve digital signature algorithm by using the target elliptic curve, the block chain key of the target user, and the target transaction data.
In this embodiment, for algorithms such as a multiple signature algorithm that require multiple blockchain keys to perform digital signature, verification may be performed based on the number of blockchain keys in the process of performing signature verification with target transaction data. Optionally, if the number of the obtained block chain keys of the target user is different from the number of the block chain keys required to be used by the target signature algorithm, a signature verification error is determined. If the number is the same, the subsequent verification process is continued. Further, if the number of the acquired block chain keys of the target user is the same as the number of the block chain keys required to be used by the target signature algorithm, determining whether the acquired elliptic curves used by the block chain keys of the at least two target users are the same; if the used elliptic curves are different, determining that the signature verification is wrong; if the used elliptic curves are the same, the subsequent verification process is continued. Wherein the signature verification error indicates that the sender identity is verified based on the digital signature and/or that the target transaction data does not have integrity.
According to the technical scheme of the embodiment, a target user is used as a sender of transaction data, a user node obtains a block chain key of the target user, the target transaction data and a uniform signature result with a uniform signature data structure, a target signature algorithm and target signature content of the target transaction data are determined according to the uniform signature result and the uniform signature data structure, and signature verification is performed on the target signature content by adopting the block chain key of the target user and the target transaction data based on the target signature algorithm. According to the embodiment of the invention, the signature algorithm information is fused in the signature result by receiving the uniform signature result with the uniform signature data structure, the used signature algorithm is directly embodied in the uniform signature result, and the judgment basis of the signature algorithm is provided for signature verification, so that the signature verification is carried out on the target transaction data based on the determined target signature algorithm, and the signature verification is conveniently carried out on the signature result.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a block chain data processing apparatus according to a fifth embodiment of the present invention, which is applicable to a case where a user node in a block chain network digitally signs transaction data, and the apparatus is configured for the user node, so that the block chain data processing method according to any embodiment of the present invention can be implemented. The device specifically comprises the following steps:
a transaction data determining module 510, configured to determine target transaction data to be processed by a target user;
a digital signature module 520, configured to perform digital signature on the target transaction data by using the blockchain key of the target user based on a target signature algorithm, so as to obtain target signature content;
a signature result generating module 530, configured to generate a uniform signature result with a uniform signature data structure according to the target signature algorithm and the target signature content.
Optionally, the signature result generating module 530 includes:
a signature content determination unit 5301 for determining a signature content part in the unified signature data structure based on the target signature content;
a signature algorithm determining unit 5302, configured to determine a signature algorithm identification portion in the unified signature data structure according to the target signature algorithm;
a signature result generation unit 5303 for generating a uniform signature result including the signature algorithm identification portion and the signed content portion.
Optionally, the signature content determining unit 5301 is specifically configured to:
encoding the target signature content to obtain a target signature byte array;
and taking the target signature byte array as a value of a signature content part in the unified signature data structure.
Optionally, the signature algorithm determining unit 5302 is specifically configured to:
if the target signature algorithm comprises an elliptic curve digital signature algorithm, determining a target elliptic curve used by the elliptic curve digital signature algorithm;
and determining a signature algorithm identification part in the uniform signature data structure according to the identification information of the elliptic curve digital signature algorithm and the identification information of the target elliptic curve.
Further, the apparatus further includes a format conversion module 540, specifically configured to:
and after the uniform signature result with the uniform signature data structure is generated, converting the uniform signature result into a byte array format to obtain a final signature result of the target transaction data.
According to the technical scheme of the embodiment, through the mutual cooperation of the functional modules, the functions of determining the target transaction data, generating the digital signature, determining the signature content, determining the signature algorithm, generating the signature result, converting the signature data structure and the like are realized. The embodiment of the invention realizes the unification of the signature data structure in the blockchain network by generating the unified signature result with the unified signature data structure and integrating the identification information of the target signature algorithm into the unified signature result, supports the blockchain network to use the unified digital signature technology, avoids the additional independent addition and sending of the signature algorithm information, enables the signature algorithm information to be fused in the signature result, directly embodies the used signature algorithm in the unified signature result, and is convenient for signature verification of the signature result.
EXAMPLE six
Fig. 6 is a schematic structural diagram of a block chain data processing apparatus according to a sixth embodiment of the present invention, which is applicable to a case where a user node performs signature verification on received transaction data. The device specifically comprises the following steps:
the signature result obtaining module 610 is configured to obtain a blockchain key of a target user, target transaction data, and a uniform signature result with a uniform signature data structure;
a digital signature determining module 620, configured to determine a target signature algorithm and a target signature content of the target transaction data according to the uniform signature result and the uniform signature data structure;
and the signature verification module 630 is configured to verify the signature of the target signature content by using the blockchain key of the target user and the target transaction data based on the target signature algorithm.
Optionally, the digital signature determining module 620 is specifically configured to:
taking a signature algorithm identification part in the uniform signature data structure in the uniform signature result as a target signature algorithm of the target transaction data;
and taking the signature content part in the uniform signature data structure in the uniform signature result as the target signature content of the target transaction data.
Optionally, the signature verification module 630 is specifically configured to:
taking the signature data structure of the target signature algorithm as a target data structure;
decoding the target signature content according to the target data structure to decode the target signature content into the target data structure;
and based on the target signature algorithm, adopting the block chain key of the target user and the target transaction data to verify the target signature content decoded into the target data structure.
Optionally, if the target signature algorithm includes an elliptic curve digital signature algorithm, the digital signature determining module 620 is further specifically configured to: determining a target elliptic curve used by the elliptic curve digital signature algorithm according to the uniform signature result and the uniform signature data structure;
correspondingly, the signature verification module 630 is specifically configured to: and based on the elliptic curve digital signature algorithm, adopting the target elliptic curve, the block chain key of the target user and the target transaction data to verify the signature of the target signature content.
Optionally, the signature result obtaining module 610 is specifically configured to:
acquiring a final signature result of target transaction data in a byte array format;
and converting the final signature result of the target transaction data into the uniform signature data structure to obtain a uniform signature result.
Optionally, the signature verification module 630 is specifically configured to:
if the number of the obtained block chain keys of the target user is different from the number of the block chain keys required to be used by the target signature algorithm, determining that the signature is verified to be wrong;
if the number of the acquired block chain keys of the target user is the same as the number of the block chain keys required to be used by the target signature algorithm, determining whether the acquired elliptic curves used by the block chain keys of at least two target users are the same;
and if the used elliptic curves are different, determining that the signature verification is wrong.
According to the technical scheme of the embodiment, through mutual cooperation of all functional modules, the functions of obtaining a uniform signature result, visualizing a uniform signature result format, determining a target signature algorithm and target signature content based on the same signature data structure, converting the target signature content format, checking the signature and the like are realized. According to the embodiment of the invention, the signature algorithm information is fused in the signature result by receiving the uniform signature result with the uniform signature data structure, the used signature algorithm is directly embodied in the uniform signature result, and the judgment basis of the signature algorithm is provided for signature verification, so that the signature verification is carried out on the target transaction data based on the determined target signature algorithm, and the signature verification is conveniently carried out on the signature result.
EXAMPLE seven
Fig. 7 is a schematic structural diagram of an apparatus according to a seventh embodiment of the present invention, and fig. 7 shows a block diagram of an exemplary apparatus suitable for implementing the embodiment of the present invention. The device shown in fig. 7 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 700 shown in fig. 7 is only an example and should not bring any limitation to the function and scope of use of the embodiments of the present invention. The device 700 is preferably an electronic device carrying blockchain nodes.
As shown in fig. 7, device 700 is embodied in a general purpose computing device. The components of device 700 may include, but are not limited to: one or more processors 710, a system memory 720, and a bus 730 that couples the various system components (including the system memory 720 and the processors 710).
Bus 730 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 700 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by device 700 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 720 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 721 and/or cache memory 722. The device 700 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, the storage system 723 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 7, commonly referred to as a "hard disk drive"). Although not shown in FIG. 7, 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 730 by one or more data media interfaces. System memory 720 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 725 having a set (at least one) of program modules 724 may be stored, for instance, in system memory 720, such program modules 724 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 include an implementation of a network environment. Program modules 724 generally carry out the functions and/or methodologies of embodiments described herein.
Device 700 may also communicate with one or more external devices 740 (e.g., keyboard, pointing device, display 741, etc.), with one or more devices that enable a user to interact with device 700, and/or with any devices (e.g., network card, modem, etc.) that enable device 700 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 750. Also, device 700 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 network adapter 760. As shown, the network adapter 760 communicates with the other modules of the device 700 via the bus 730. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the device 700, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processor 710 executes at least one of the programs stored in the system memory 720 to perform various functional applications and data processing, for example, to implement the blockchain data processing method provided in the first embodiment of the present invention or to implement the blockchain data processing method provided in the second embodiment of the present invention.
Example eight
An eighth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program (or referred to as computer-executable instructions) is stored, where the computer program, when executed by a processor, can implement a method for processing blockchain data, executed by a user node in any of the above embodiments, where the method includes:
determining target transaction data to be processed by a target user;
based on a target signature algorithm, performing digital signature on the target transaction data by adopting a block chain key of the target user to obtain target signature content;
and generating a uniform signature result with a uniform signature data structure according to the target signature algorithm and the target signature content.
An eighth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program (or referred to as computer-executable instructions) is stored, where the computer program, when executed by a processor, can implement another method for processing blockchain data, which is executed by a user node in any of the above embodiments, where the method includes:
acquiring a block chain key of a target user, target transaction data and a uniform signature result with a uniform signature data structure;
determining a target signature algorithm and target signature content of the target transaction data according to the uniform signature result and the uniform signature data structure;
and based on the target signature algorithm, adopting the block chain key of the target user and the target transaction data to verify the signature of the target signature content.
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 device. 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 (12)

1. A method of processing blockchain data, performed by a user node, the method comprising:
determining target transaction data to be processed by a target user;
based on a target signature algorithm, performing digital signature on the target transaction data by adopting a block chain key of the target user to obtain target signature content;
generating a uniform signature result with a uniform signature data structure according to the target signature algorithm and the target signature content;
wherein the generating a uniform signature result having a uniform signature data structure according to the target signature algorithm and the target signature content includes:
determining a signature content part in the unified signature data structure according to the target signature content;
determining a signature algorithm identification part in the unified signature data structure according to the target signature algorithm;
generating a uniform signature result comprising the signature algorithm identification portion and the signed content portion;
wherein the determining the signature content part in the unified signature data structure according to the target signature content comprises:
encoding the target signature content to obtain a target signature byte array;
and taking the target signature byte array as a value of a signature content part in the unified signature data structure.
2. The method of claim 1, wherein determining the signature algorithm identification portion in the unified signature data structure based on the target signature algorithm comprises:
if the target signature algorithm comprises an elliptic curve digital signature algorithm, determining a target elliptic curve used by the elliptic curve digital signature algorithm;
and determining a signature algorithm identification part in the uniform signature data structure according to the identification information of the elliptic curve digital signature algorithm and the identification information of the target elliptic curve.
3. The method of claim 1, further comprising, after the generating the uniform signature result having the uniform signature data structure:
and converting the uniform signature result into a byte array format to obtain a final signature result of the target transaction data.
4. A method of processing blockchain data, performed by a user node, the method comprising:
acquiring a block chain key of a target user, target transaction data and a uniform signature result with a uniform signature data structure;
determining a target signature algorithm and target signature content of the target transaction data according to the uniform signature result and the uniform signature data structure;
based on the target signature algorithm, adopting a block chain key of the target user and the target transaction data to verify the target signature content;
wherein, the verifying the target signature content by using the block chain key of the target user and the target transaction data based on the target signature algorithm comprises:
taking the signature data structure of the target signature algorithm as a target data structure;
decoding the target signature content according to the target data structure to decode the target signature content into the target data structure;
and based on the target signature algorithm, adopting the block chain key of the target user and the target transaction data to verify the target signature content decoded into the target data structure.
5. The method of claim 4, wherein determining the target signature algorithm and the target signature content of the target transaction data according to the uniform signature result and the uniform signature data structure comprises:
taking a signature algorithm identification part in the uniform signature data structure in the uniform signature result as a target signature algorithm of the target transaction data;
and taking the signature content part in the uniform signature data structure in the uniform signature result as the target signature content of the target transaction data.
6. The method of claim 4, further comprising:
if the target signature algorithm comprises an elliptic curve digital signature algorithm, determining a target elliptic curve used by the elliptic curve digital signature algorithm according to the uniform signature result and the uniform signature data structure;
correspondingly, the verifying the target signature content by using the blockchain key of the target user and the target transaction data based on the target signature algorithm includes:
and based on the elliptic curve digital signature algorithm, adopting the target elliptic curve, the block chain key of the target user and the target transaction data to verify the signature of the target signature content.
7. The method of claim 4, wherein obtaining a uniform signature result having a uniform signature data structure comprises:
acquiring a final signature result of target transaction data in a byte array format;
and converting the final signature result of the target transaction data into the uniform signature data structure to obtain a uniform signature result.
8. The method of claim 4, wherein said verifying said target signature content using said target user's blockchain key and said target transaction data based on said target signature algorithm comprises:
if the number of the obtained block chain keys of the target user is different from the number of the block chain keys required to be used by the target signature algorithm, determining that the signature is verified to be wrong;
if the number of the acquired block chain keys of the target user is the same as the number of the block chain keys required to be used by the target signature algorithm, determining whether the acquired elliptic curves used by the block chain keys of at least two target users are the same;
and if the used elliptic curves are different, determining that the signature verification is wrong.
9. A block chain data processing apparatus, configured at a user node, the apparatus comprising:
the transaction data determining module is used for determining target transaction data to be processed by a target user;
the digital signature module is used for digitally signing the target transaction data by adopting the block chain key of the target user based on a target signature algorithm to obtain target signature content;
the signature result generation module is used for generating a uniform signature result with a uniform signature data structure according to the target signature algorithm and the target signature content;
wherein the signature result generation module comprises:
a signature content determining unit, configured to determine a signature content part in the unified signature data structure according to the target signature content;
the signature algorithm determining unit is used for determining a signature algorithm identification part in the unified signature data structure according to the target signature algorithm;
a signature result generation unit for generating a uniform signature result including the signature algorithm identification part and the signature content part;
wherein the signature content determining unit is specifically configured to:
encoding the target signature content to obtain a target signature byte array;
and taking the target signature byte array as a value of a signature content part in the unified signature data structure.
10. A block chain data processing apparatus, configured at a user node, the apparatus comprising:
the signature result acquisition module is used for acquiring a block chain key of a target user, target transaction data and a uniform signature result with a uniform signature data structure;
the digital signature determining module is used for determining a target signature algorithm and target signature content of the target transaction data according to the uniform signature result and the uniform signature data structure;
the signature verification module is used for verifying the signature of the target signature content by adopting the block chain key of the target user and the target transaction data based on the target signature algorithm;
wherein, the label checking module is specifically configured to:
taking the signature data structure of the target signature algorithm as a target data structure;
decoding the target signature content according to the target data structure to decode the target signature content into the target data structure;
and based on the target signature algorithm, adopting the block chain key of the target user and the target transaction data to verify the target signature content decoded into the target data structure.
11. An electronic 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 blockchain data processing method of any one of claims 1-3 or the blockchain data processing method of any one of claims 4-8.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the blockchain data processing method according to any one of claims 1 to 3, or carries out the blockchain data processing method according to any one of claims 4 to 8.
CN201911002855.7A 2019-10-22 2019-10-22 Block chain data processing method, device, equipment and storage medium Active CN110517045B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911002855.7A CN110517045B (en) 2019-10-22 2019-10-22 Block chain data processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911002855.7A CN110517045B (en) 2019-10-22 2019-10-22 Block chain data processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110517045A CN110517045A (en) 2019-11-29
CN110517045B true CN110517045B (en) 2020-02-04

Family

ID=68633574

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911002855.7A Active CN110517045B (en) 2019-10-22 2019-10-22 Block chain data processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110517045B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116846564B (en) * 2023-08-30 2024-02-02 北京格尔国信科技有限公司 Signature verification method, system, terminal and storage medium supporting multiple algorithms

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180096347A1 (en) * 2016-09-30 2018-04-05 Cable Television Laboratories, Inc Systems and methods for securely tracking consumable goods using a distributed ledger
CN106712965B (en) * 2017-01-17 2020-02-18 数安时代科技股份有限公司 Digital signature method and device and password equipment
CN106878318B (en) * 2017-03-03 2020-01-07 上海唯链信息科技有限公司 Block chain real-time polling cloud system
CN107888375A (en) * 2017-11-08 2018-04-06 深圳市携网科技有限公司 A kind of electronic evidence safety system and method based on block chain technology
CN108833114A (en) * 2018-06-13 2018-11-16 上海交通大学 A kind of decentralization identity authorization system and method based on block chain
CN109034805B (en) * 2018-08-09 2022-09-02 江苏先安科技有限公司 Timestamp signature verification method suitable for block chain and embedded field

Also Published As

Publication number Publication date
CN110517045A (en) 2019-11-29

Similar Documents

Publication Publication Date Title
CN109150499B (en) Method and device for dynamically encrypting data, computer equipment and storage medium
CN110119643B (en) Two-dimensional code generation method and device and two-dimensional code identification method and device
CN111131278B (en) Data processing method and device, computer storage medium and electronic equipment
CN110084599B (en) Key processing method, device, equipment and storage medium
CN109194669B (en) Data transmission method, device, equipment and medium of lightweight node
CN105162588A (en) Media file encryption/decryption methods and device
CN113610526A (en) Data trust method and device, electronic equipment and storage medium
CN111865869B (en) Registration and authentication method and device based on random mapping, medium and electronic equipment
CN110517045B (en) Block chain data processing method, device, equipment and storage medium
CN114615031A (en) File storage method and device, electronic equipment and storage medium
CN111160504A (en) Method, device and equipment for generating dynamic two-dimensional code and storage medium
CN110545542A (en) Main control key downloading method and device based on asymmetric encryption algorithm and computer equipment
CN107133517B (en) Data recovery method based on data encryption and calculation in memory
CN113517982B (en) Password generation method, password execution method and terminal
CN116132041A (en) Key processing method and device, storage medium and electronic equipment
CN113890759B (en) File transmission method, device, electronic equipment and storage medium
US8966254B2 (en) Keyless challenge and response system
CN114915503A (en) Data stream splitting processing encryption method based on security chip and security chip device
CN112733166A (en) license authentication and authorization function realization method and system
CN111130788B (en) Data processing method and system, data reading method and iSCSI server
CN110768808A (en) Terminal configuration method, device, server and storage medium
CN111212042B (en) Data transmission method, device and system
CN113282662B (en) Block information processing method, device, equipment and medium
CN114679324B (en) Data exchange method, tool, system, equipment and medium
CN113259438B (en) Method and device for sending model file and method and device for receiving model file

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