CN108833095B - Behavior verification method, node, system and electronic equipment in block chain - Google Patents

Behavior verification method, node, system and electronic equipment in block chain Download PDF

Info

Publication number
CN108833095B
CN108833095B CN201810660746.3A CN201810660746A CN108833095B CN 108833095 B CN108833095 B CN 108833095B CN 201810660746 A CN201810660746 A CN 201810660746A CN 108833095 B CN108833095 B CN 108833095B
Authority
CN
China
Prior art keywords
node
character string
data
random key
verification
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
CN201810660746.3A
Other languages
Chinese (zh)
Other versions
CN108833095A (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 Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo 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 Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201810660746.3A priority Critical patent/CN108833095B/en
Publication of CN108833095A publication Critical patent/CN108833095A/en
Application granted granted Critical
Publication of CN108833095B publication Critical patent/CN108833095B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/083Network architectures or network communication protocols for network security for authentication of entities using passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0863Generation of secret information including derivation or calculation of cryptographic keys or passwords involving passwords or one-time passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3226Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using a predetermined code, e.g. password, passphrase or PIN
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Storage Device Security (AREA)

Abstract

The application provides a behavior verification method, a node, a system and electronic equipment in a block chain. The method comprises the following steps: encrypting target data corresponding to the first character string by using a random key to obtain first data, and sending the first data to a second node, wherein the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm; receiving a signed second character string returned by the second node, wherein the second character string is obtained by encrypting the first data by the second node by using a homomorphic encryption algorithm; and generating a verification message based on the signed second character string, the random key and the first character string, and sending the verification message to any node in the block chain. According to the technical scheme, under the condition that original data are not disclosed, any node in the block chain can verify any data transaction process, whole-network supervision is achieved, and smooth data transaction and safety of user data are guaranteed.

Description

Behavior verification method, node, system and electronic equipment in block chain
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method, a node, a system, an electronic device, and a computer-readable storage medium for verifying a behavior in a blockchain.
Background
With the progress of internet technology and the development of big data, data contacted by people in life and office is exponentially increased, personal storage media of users are difficult to meet the needs of people, and sharing is inconvenient in sharing, so that sharing and storage become a trend.
In the shared storage system, a user of each node can provide storage service for other users in the network, the user can store data in storage media of other nodes, and when the data is needed, the data is acquired from the nodes in which the data is stored. Since the user who stores the data provides the service that stores the data and provides the data, the party who receives the service should pay a corresponding payment. In the practical application process, the following situations exist: after the data provider sends the data to the data demander, the data demander performs repudiation, and refuses to pay the data provider with the data not received or the received data not, so that the benefit of the data provider is damaged.
Therefore, the existing shared storage system has the defect that the data transaction behavior cannot be effectively verified.
Disclosure of Invention
The application provides a behavior verification method, a node, a system, an electronic device and a computer readable storage medium in a block chain, which can solve the problem that data transaction behaviors cannot be effectively verified. The technical scheme is as follows:
in a first aspect, the present application provides a method for behavior verification in a blockchain, the method including:
encrypting target data corresponding to the first character string by using a random key to obtain first data, and sending the first data to a second node, wherein the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm;
receiving a signed second character string returned by the second node, wherein the second character string is obtained by encrypting the first data by the second node by using a homomorphic encryption algorithm;
and generating a verification message based on the signed second character string, the random key and the first character string, and sending the verification message to any node in the block chain.
Optionally, before encrypting the target data corresponding to the first character string with the random key, the method further includes:
and receiving a data acquisition request sent by the second node, wherein the data acquisition request comprises the first character string.
Optionally, before encrypting the target data corresponding to the first character string with the random key, the method further includes:
generating a random number, and generating a random key by using a preset algorithm based on the random number, wherein the length of the random key is greater than that of the random number;
generating a verification message based on the signed second string, the random key and the first string, comprising:
and generating a verification message based on the signed second character string, the random number corresponding to the random key and the first character string.
Optionally, generating a random key by using a preset algorithm based on the random number includes:
randomly selecting at least one block from the block chain;
encrypting corresponding data in the selected block by using a cipher block chaining mode by using the random number as a secret key to obtain a random secret key;
generating a verification message based on the signed second string, the random key and the first string, comprising:
and generating a verification message based on the signed second character string, the random number corresponding to the random key, the block height of the selected block and the first character string.
Optionally, encrypting the selected block by using a cipher block chaining mode with a random number as a key to obtain a random key, including:
and repeatedly encrypting the corresponding data in the selected block by using the random number as a key and utilizing a cipher block chaining mode so as to enable the generated random key to reach a preset length.
Optionally, the length of the random key is the same as the length of the target data.
Optionally, the homomorphic encryption algorithm comprises an additive homomorphic encryption algorithm or a multiplicative homomorphic encryption algorithm.
Optionally, generating a verification message based on the signed second string, the random key and the first string, and sending the verification message to any node in the blockchain, where the verification message includes:
sending a verification message to any node in the block chain, wherein the verification message comprises the signed second character string, the random key and the first character string;
or the like, or, alternatively,
and generating verification information based on the signed second character string, the random key and the first character string, storing the verification information into a verification block in the block chain, and sending a verification message to any node in the block chain, wherein the verification message comprises the block height of the verification block.
In a second aspect, the present application provides a method for behavior verification in a blockchain, the method including:
receiving a verification message sent by a first node, and acquiring a signed second character string, a random key and a first character string corresponding to the verification message, wherein the first character string is obtained by encrypting target data by using a homomorphic encryption algorithm, and the second character string is obtained by encrypting the first data by using the homomorphic encryption algorithm;
verifying that the node receiving the first data sent by the first node is the second node according to the digital signature in the signed second character string;
and verifying that the data before encryption corresponding to the first data is the target data corresponding to the first character string by utilizing the homomorphism property of a homomorphic encryption algorithm according to the second character string, the random key and the first character string.
In a third aspect, the present application provides a behavior verification system in a blockchain, the system comprising a plurality of nodes, wherein,
the first node is used for encrypting target data corresponding to the first character string by using a random key to obtain first data and sending the first data to the second node, wherein the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm;
the second node is used for encrypting the first data by using a homomorphic encryption algorithm to obtain a second character string, signing the second character string and sending the signed second character string to the first node;
the first node is used for generating a verification message based on the signed second character string, the random key and the first character string, and sending the verification message to any node in the block chain.
Optionally, any node in the system is configured to:
receiving a verification message sent by a first node, and acquiring a signed second character string, a random key and a first character string corresponding to the verification message;
verifying that the node receiving the first data sent by the first node is the second node according to the digital signature in the signed second character string;
and verifying that the data before encryption corresponding to the first data is the target data corresponding to the first character string by utilizing the homomorphism property of a homomorphic encryption algorithm according to the second character string, the random key and the first character string.
Optionally, the second node is further configured to: and before the first node encrypts target data corresponding to the first character string by using the random key, sending a data acquisition request to the first node, wherein the data acquisition request comprises the first character string.
Optionally, the second node is further configured to: and decrypting the first data by using the random key to obtain target data.
Optionally, the homomorphic encryption algorithm comprises an additive homomorphic encryption algorithm or a multiplicative homomorphic encryption algorithm.
Optionally, the first node is further configured to: generating a random number before encrypting target data corresponding to the first character string by using a random key, and generating the random key by using a preset algorithm based on the random number, wherein the length of the random key is greater than that of the random number;
the first node is specifically configured to: and generating a verification message based on the signed second character string, the random number corresponding to the random key and the first character string, and sending the verification message to any other node except the first node in the block chain.
Optionally, the first node is specifically configured to:
randomly selecting at least one block from the block chain;
encrypting corresponding data in the selected block by using a cipher block chaining mode by using the random number as a secret key to obtain a random secret key;
and generating a verification message based on the signed second character string, the random number corresponding to the random key, the block height of the selected block and the first character string, and sending the verification message to any node except the first node in the block chain.
Optionally, the first node is specifically configured to: and repeatedly encrypting the selected block by using the random number as a key and utilizing a cipher block chaining mode so as to enable the generated random key to reach a preset length.
Optionally, the length of the random key is the same as the length of the target data.
Optionally, the first node is specifically configured to: sending a verification message to any node in the block chain, wherein the verification message comprises the signed second character string, the random key and the first character string; or generating verification information based on the signed second character string, the random key and the first character string, storing the verification information into a verification block in the block chain, and sending the verification information to any node in the block chain, wherein the verification information comprises the block height of the verification block.
In a fourth aspect, the present application provides a first node for implementing behavior verification in a blockchain, the first node comprising:
the first encryption module is used for encrypting target data corresponding to the first character string by using a random key to obtain first data and sending the first data to the second node, wherein the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm;
the first receiving module is used for receiving a signed second character string returned by the second node, wherein the second character string is obtained by encrypting the first data by the second node by using a homomorphic encryption algorithm;
the verification message generation module is used for generating a verification message based on the signed second character string, the random key and the first character string;
a first sending module, configured to send a verification message to any node in the blockchain.
In a fifth aspect, the present application provides a second node for implementing behavior verification in a blockchain, the second node comprising:
the second receiving module is used for receiving the verification message sent by the first node and acquiring a signed second character string, a random key and a first character string corresponding to the verification message, wherein the first character string is obtained by encrypting target data by using a homomorphic encryption algorithm, and the second character string is obtained by encrypting the first data by using the homomorphic encryption algorithm;
and the verification module is used for verifying that the node receiving the first data sent by the first node is the second node according to the digital signature in the signed second character string, and verifying that the data before encryption corresponding to the first data is the target data corresponding to the first character string by utilizing the homomorphic property of the homomorphic encryption algorithm according to the second character string, the random key and the first character string.
In a sixth aspect, the present application provides an electronic device comprising: one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more application programs configured to: the behavior verification method in the blockchain shown in the first aspect of the present application is performed.
In a seventh aspect, the present application provides an electronic device, including: one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more application programs configured to: the method for verifying the behavior in the blockchain shown in the second aspect of the present application is performed.
In an eighth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, implements the behavior verification method in a blockchain shown in the first aspect of the present application.
In a ninth aspect, the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the behavior verification method in a blockchain as shown in the second aspect of the present application.
The technical scheme provided by the embodiment of the application has the following beneficial effects: the data transaction between each node in the block chain can be realized under the condition that original data is not disclosed, and any node in the block chain can verify the transaction process of any data, so that the whole network supervision is realized, the condition that a data receiver refuses to pay a reward after receiving the data or a data sender randomly sends the data randomly and randomly is prevented, and the smooth data transaction and the safety of user data are ensured.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic flowchart of a method for verifying behavior in a blockchain according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of another method for verifying behavior in a blockchain according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of a method for verifying behavior in a blockchain according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a first node for implementing behavior verification in a blockchain according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of another first node for implementing behavior verification in a blockchain according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of another second node for implementing behavior verification in a blockchain according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of another electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
The terms referred to in this application will first be introduced and explained:
the homomorphic encryption algorithm is an encryption function, wherein the homomorphic encryption algorithm is used for encrypting a plaintext after ring addition and multiplication operation, and performing corresponding operation on a ciphertext after encryption, and the result is equivalent. An encryption function with an homomorphic property means an encryption function in which two plain texts a and b satisfy Dec (En (a) | En (b) |) a |, b, where En is an encryption operation and Dec is a decryption operation, and |, respectively correspond to operations in plain text and ciphertext fields. When ≧ represents addition, the encryption is said to be homomorphic: when |, represents multiplication, the encryption is said to be a multiplication homomorphic encryption.
Block height is an identifier of a block and refers to the position of the block in the block chain.
In the block chain, the address of the node is the identity of the node and has uniqueness. For example, the wallet address in the bitcoin block chain.
It should be noted that "first node" and "second node" in any of the following embodiments may be any node in a block chain, and "first" and "second" are merely for convenience of description and have no limiting effect on the node.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Example one
An embodiment of the present application provides a method for verifying a behavior in a blockchain, as shown in fig. 1, the method includes:
s101, encrypting target data corresponding to a first character string by using a random key to obtain first data, and sending the first data to a second node, wherein the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm;
step S102, receiving a signed second character string returned by the second node, wherein the second character string is obtained by encrypting the first data by the second node by using a homomorphic encryption algorithm;
and step S103, generating a verification message based on the signed second character string, the random key and the first character string, and sending the verification message to any node in the block chain.
For example, a user of the second node needs to obtain target data D, where the first character string corresponding to the target data D is D, where D ═ F (D), and F is a homomorphic encryption algorithm. The first node stores the target data D, finds the target data D according to the first character string D, encrypts the target data D by using the random key k to obtain first data D ', and sends the first data D' to the second node. After receiving the first data D ', the second node encrypts the first data D ' by using a homomorphic encryption algorithm F to obtain a second character string D ', D ═ F (D '), and signs the second character string D ', and sends the signed second character string to the first node. And the first node generates a verification message based on the signed second character string, the random key and the first character string, and sends the verification message to any node in the block chain.
The second node can generate a digital signature by using the wallet address of the second node to sign the second character string, and the wallet address has uniqueness in the whole block chain, so that any node in the block chain can verify that the node receiving the second character string is the second node according to the digital signature in the signed second character string after receiving the verification message. After any node in the block chain receives the verification message, a second character string d', a random key k and a first character string d are obtained according to the verification message, and verification is carried out
Figure GDA0002854493030000091
If it is, based on the homomorphic property of homomorphic encryption algorithm F, if it is
Figure GDA0002854493030000093
Figure GDA0002854493030000092
If yes, D '═ D ≦ k is indicated, that is, the encrypted data of the target data D is the first data D' corresponding to the second character string. Therefore, any node in the blockchain can draw the following conclusion according to the verification message: the second node receives the target data D sent by the first node. In the whole verification process, any node except the first node and the second node cannot acquire the target data D and the first data D', so that although the random key k is disclosed, other nodes cannot acquire the target data.
And the second node decrypts the first data D' according to the random key k in the verification message, so as to obtain the target data D. Wherein the first node publishes the random key k only after the second node sends the second string d' signed by the second node to the first node. Therefore, before the second node sends the signed second string D 'to the first node, the random key k cannot be obtained, and thus the target data D cannot be obtained, and once the second node sends the signed second string D' to the first node, the first node can prove the behavior of sending the target data D to the second node to all nodes in the full chain.
The behavior verification method in the block chain of the embodiment can realize data transaction among all nodes in the block chain under the condition of not disclosing original data, and enable any node in the block chain to verify the data transaction process, thereby realizing the whole network supervision, preventing the condition that a data receiver refuses to pay a reward after receiving data or a data sender randomly sends data out randomly and indiscriminately, and ensuring the smooth data transaction and the safety of user data.
Example two
The embodiment of the application provides another possible implementation manner, and on the basis of the first embodiment, the method further comprises the method shown in the second embodiment.
Wherein, the longer the encryption key is, the greater the cracking difficulty is. Therefore, the longer the random key in step S101 should be, the better, for example, the length of the random key may be in the same order of magnitude as the length of the target data, or the length of the random key may be equal to the length of the target data, which helps to improve the security of data encryption.
However, the length of the target data is often large, for example, the data amount of one picture is several megabits, the data amount of video reaches several hundreds of megabits, and a high-definition movie reaches even several G. When the length of the random key is in the same order of magnitude as the target data, it means that sending the random key to all nodes in the blockchain consumes a large amount of wasted network resources.
Further, to solve the problem that the random key is difficult to publish, as shown in fig. 2, before step S101, the method of the present embodiment further includes step S201: and generating a random number, and generating a random key by using a preset algorithm based on the random number. Wherein the length of the random key is greater than the length of the random number.
Correspondingly, step S103 specifically includes: and generating a verification message based on the signed second character string, the random number corresponding to the random key and the first character string, and sending the verification message to any node in the block chain.
Compared with the random key with large published data volume, the random number with small published data volume is obviously more convenient to publish. Any node in the block chain can complete behavior verification only by generating a random key by using a preset algorithm according to the acquired random number. And the second node generates a random key by using a preset algorithm according to the acquired random number, and the target data can be obtained by decryption. Therefore, the difficulty of sending the verification message is reduced and the network overhead in the verification process is reduced by publishing the random number corresponding to the random key.
Optionally, step S201 specifically includes:
step S2011, generating a random number;
step S2012, randomly selecting at least one block from the block chain;
and step S2013, encrypting corresponding data in the selected block by using the cipher block link mode by taking the random number as a secret key to obtain the random secret key.
Correspondingly, step S103 specifically includes: and generating a verification message based on the signed second character string, the random number corresponding to the random key, the block height of the selected block and the first character string.
Any node can be positioned to the position of the block in the block chain through the block height of the block so as to acquire corresponding data in the block.
Wherein the blocks used to generate the random key are randomly selected from the public data in the block chain. The public data refers to data which any node in the block chain has authority to acquire, so that each node can acquire the selected block smoothly in the verification process, and a random key can be generated conveniently.
Any node in the block chain acquires the block height according to the verification message, acquires a block for calculating the random key from the block chain based on the block height, and encrypts corresponding data in the selected block by using a cipher block chaining mode by taking a random number as the key to obtain the random key. The data volume of the verification message sent by the first node to any node in the block chain is reduced, and meanwhile, the random key is calculated through the randomly selected block, so that the randomness of the random key is ensured.
Wherein, the encryption by using the Cipher Block Chaining (CBC) mode comprises the following steps: firstly, grouping corresponding data in the selected blocks by using integral multiple bytes of 8 as a group to obtain D1、D2......DnIf the data obtained by grouping is not an integral multiple of 8, supplementing the insufficient data; then, for the first set of data D1Performing DES (Data Encryption Standard) Encryption on the result subjected to XOR with a preset initial vector I to obtain a first group of ciphertext C1Wherein, the random number is a key in the DES encryption process; next, for the second set of data D2Encryption result C with the first group1The result after the XOR is subjected to DES encryption to obtain a second group of ciphertext C2(ii) a And so on until obtaining the encryption result C of the nth groupn(ii) a Connecting C in sequence1C2C3......CnAnd obtaining an encryption result, namely the random key.
Optionally, step S2013 specifically includes: and repeatedly encrypting the corresponding data in the selected block by using the random number as a key and utilizing a cipher block chaining mode so as to enable the generated random key to reach a preset length.
For example, a block is randomly acquired, and assuming that the data size of the block is 2 megabits and the data size of the target data is 20 megabits, it is obvious that a random key of 20 megabits in length cannot be obtained by only the block. Therefore, the block can be reused for encryption, and the specific process is as follows: firstly, grouping corresponding data in the selected blocks by using integral multiple bytes of 8 as a group to obtain D1、D2......DnIf the data obtained by grouping is not an integral multiple of 8, supplementing the insufficient data; then, for the first set of data D1Performing DES (Data Encryption Standard) Encryption on the result subjected to XOR with a preset initial vector I to obtain a first group of ciphertext C1Wherein, the random number is a key in the DES encryption process; next, for the second set of data D2Encryption result C with the first group1The result after the XOR is subjected to DES encryption to obtain a second group of ciphertext C2(ii) a And so on until the first one is obtainedn sets of encryption results Cn(ii) a Connecting C in sequence1C2C3......CnObtaining an encryption result, and if the encryption result does not reach the preset length, performing encryption on the first group of data D1Encryption result C with n-th groupnThe result after the XOR is subjected to DES encryption to obtain an (n +1) th group of ciphertext Cn+1Updating the encryption result to C1C2C3......CnCn+1Then for the second set of data D2Encryption result C with n-th groupn+1The result after the XOR is subjected to DES encryption to obtain an (n +2) th group of ciphertext Cn+2Updating the encryption result to C1C2C3......CnCn+1Cn+2And repeating the steps until the length of the encryption result reaches the preset length.
By the encryption method, random keys of arbitrary lengths can be generated. Only the initial vector I, the random number and the block height of the selected block need to be disclosed, and any node can calculate the random key.
Optionally, the homomorphic encryption algorithm in any of the above method embodiments includes an additive homomorphic encryption algorithm or a multiplicative homomorphic encryption algorithm.
For example, the BLS Hash algorithm is selected as the homomorphic encryption algorithm, and the BLS Hash has the following homomorphic properties: hash (x + y) ═ hash (x) hash (y).
Optionally, step S103 specifically includes: and sending a verification message to any node in the block chain, wherein the verification message comprises the signed second character string, the random key and the first character string.
After any node in the block chain acquires the verification message, the data transaction behavior between the first node and the second node can be verified according to the signed second character string, the random key and the first character string in the verification message.
Optionally, step S103 specifically includes: and generating verification information based on the signed second character string, the random key and the first character string, storing the verification information into a verification block in the block chain, and sending a verification message to any node in the block chain, wherein the verification message comprises the block height of the verification block.
The second node may also select to store the signed verification information such as the second character string, the random key, and the first character string in a certain block in the block chain, and send the block height of the certain block to any node in the block chain in the form of a verification message, so as to reduce the data transmission amount. After any node in the block chain acquires the verification message, the signed second character string, the random key and the first character string in the verification block are extracted according to the block height, so that the data transaction behavior between the first node and the second node is verified.
Optionally, before step S101, the method of this embodiment further includes: and receiving a data acquisition request sent by the second node, wherein the data acquisition request comprises the first character string.
For example, if the second node needs the target data D, the first string D corresponding to the target data D is sent to any node in the block chain. Of course, if the second node knows the node storing the target data in advance, the second node may send only the data acquisition request to the node storing the target data. After the first node receives a data acquisition request sent by the second node, the target data D corresponding to the first character string D is found according to the first character string D in the data acquisition request, the target data D is encrypted by using the random key k to obtain first data D ', and the first data D' is sent to the second node.
EXAMPLE III
Based on the same inventive concept as the first and second embodiments, the present embodiment provides a method for verifying behavior in a blockchain, as shown in fig. 3, the method includes the following steps:
step S301, receiving a verification message sent by a first node, and acquiring a signed second character string, a random key and a first character string corresponding to the verification message, wherein the first character string is obtained by encrypting target data by using a homomorphic encryption algorithm, and the second character string is obtained by encrypting the first data by using the homomorphic encryption algorithm.
Step S302, according to the digital signature in the signed second character string, verifying that the node receiving the first data sent by the first node is the second node;
step S303, verifying that the data before encryption corresponding to the first data is the target data corresponding to the first character string by utilizing the homomorphic property of the homomorphic encryption algorithm according to the second character string, the random key and the first character string.
For example, a user of the second node needs to obtain target data D, where the first character string corresponding to the target data D is D, where D ═ F (D), and F is a homomorphic encryption algorithm. The first node stores the target data D, finds the target data D according to the first character string D, encrypts the target data D by using the random key k to obtain first data D ', and sends the first data D' to the second node. After receiving the first data D ', the second node encrypts the first data D ' by using a homomorphic encryption algorithm F to obtain a second character string D ', D ═ F (D '), and signs the second character string D ', and sends the signed second character string to the first node. And the first node generates a verification message based on the signed second character string, the random key and the first character string, and sends the verification message to any node in the block chain.
The second node can generate a digital signature by using the wallet address of the second node to sign the second character string, and the wallet address has uniqueness in the whole block chain, so that any node in the block chain can verify that the node receiving the second character string is the second node according to the digital signature in the signed second character string after receiving the verification message. After any node in the block chain receives the verification message, a second character string d', a random key k and a first character string d are obtained according to the verification message, and verification is carried out
Figure GDA0002854493030000141
If it is, based on the homomorphic property of homomorphic encryption algorithm F, if it is
Figure GDA0002854493030000143
Figure GDA0002854493030000142
If yes, D '═ D ≦ k is indicated, that is, the encrypted data of the target data D is the first data D' corresponding to the second character string. Therefore, any node in the blockchain can draw the following conclusion according to the verification message: the second node receives the target data D sent by the first node. In the whole verification process, any node except the first node and the second node cannot acquire the target data D and the first data D', so that although the random key k is disclosed, other nodes cannot acquire the target data.
The behavior verification method in the blockchain can verify any data transaction process in the blockchain under the condition of not disclosing original data, thereby realizing whole-network supervision, preventing the condition that a data receiver refuses to pay a reward after receiving data or a data sender randomly sends data randomly, and ensuring the smooth data transaction and the safety of user data.
Example four
Based on the same inventive concept as the first to third embodiments, the present application provides a behavior verification system in a blockchain, which includes a plurality of nodes.
The first node is used for encrypting target data corresponding to the first character string by using a random key to obtain first data, and sending the first data to the second node, wherein the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm.
The second node is used for encrypting the first data by using a homomorphic encryption algorithm to obtain a second character string, signing the second character string and sending the signed second character string to the first node.
The first node is further configured to generate a verification message based on the signed second string, the random key, and the first string, and send the verification message to any node in the blockchain.
Wherein the first node and the second node may be any node in the block chain.
The behavior verification method in the block chain of the embodiment can realize data transaction among all nodes in the block chain under the condition of not disclosing original data, and enable any node in the block chain to verify the data transaction process, thereby realizing the whole network supervision, preventing the condition that a data receiver refuses to pay a reward after receiving data or a data sender randomly sends data out randomly and indiscriminately, and ensuring the smooth data transaction and the safety of user data.
Optionally, any node in the system is configured to: receiving a verification message sent by a first node, and acquiring a signed second character string, a random key and a first character string corresponding to the verification message; verifying that the node receiving the first data sent by the first node is the second node according to the digital signature in the signed second character string; and verifying that the data before encryption corresponding to the first data is the target data corresponding to the first character string by utilizing the homomorphism property of a homomorphic encryption algorithm according to the second character string, the random key and the first character string.
Any node in the system of the embodiment can supervise any data transaction in the verification block chain, and the ordered proceeding of the transaction is ensured.
Optionally, the second node is further configured to: and before the first node encrypts target data corresponding to the first character string by using the random key, sending a data acquisition request to the first node, wherein the data acquisition request comprises the first character string. Accordingly, the first node is further configured to: receiving a data acquisition request sent by a second node, wherein the data acquisition request comprises a first character string, encrypting target data corresponding to the first character string by using a random key to obtain first data, and sending the first data to the second node, wherein the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm.
Optionally, the second node is further configured to: and decrypting the first data by using the random key to obtain target data.
Optionally, the first node is further configured to: generating a random number, and generating a random key by using a preset algorithm based on the random number, wherein the length of the random key is greater than that of the random number; encrypting the target data corresponding to the first character string by using the random key to obtain first data, and sending the first data to the second node; and generating a verification message based on the signed second character string, the random number corresponding to the random key and the first character string, and sending the verification message to any other node except the first node in the block chain.
Optionally, the first node is specifically configured to: randomly selecting at least one block from the block chain; encrypting corresponding data in the selected block by using a cipher block chaining mode by using the random number as a secret key to obtain a random secret key; encrypting the target data corresponding to the first character string by using the random key to obtain first data, and sending the first data to the second node; and generating a verification message based on the signed second character string, the random number corresponding to the random key, the block height of the selected block and the first character string, and sending the verification message to any node except the first node in the block chain.
Optionally, the first node is specifically configured to: randomly selecting at least one block from the block chain; repeatedly encrypting the selected block by using a cipher block chaining mode by using a random number as a key so as to enable the generated random key to reach a preset length; encrypting the target data corresponding to the first character string by using the random key to obtain first data, and sending the first data to the second node; and generating a verification message based on the signed second character string, the random number corresponding to the random key, the block height of the selected block and the first character string, and sending the verification message to any node except the first node in the block chain.
Optionally, the first node is specifically configured to: sending a verification message to any node in the block chain, wherein the verification message comprises the signed second character string, the random key and the first character string;
optionally, the first node is specifically configured to: and generating verification information based on the signed second character string, the random key and the first character string, storing the verification information into a verification block in the block chain, and sending a verification message to any node in the block chain, wherein the verification message comprises the block height of the verification block.
Optionally, the length of the random key in this embodiment is the same as the length of the target data.
Optionally, the homomorphic encryption algorithm in this embodiment includes an addition homomorphic encryption algorithm or a multiplication homomorphic encryption algorithm.
EXAMPLE five
Based on the same inventive concept as the first and second embodiments, the embodiment of the present application provides a first node for implementing behavior verification in a blockchain, as shown in fig. 4, the first node 40 may include: a first encryption module 401, a first receiving module 402, an authentication message generating module 403, and a first transmitting module 404.
The first encryption module 401 is configured to encrypt target data corresponding to a first character string by using a random key to obtain first data, and send the first data to a second node, where the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm.
The first receiving module 402 is configured to receive a signed second character string returned by the second node, where the second character string is obtained by encrypting the first data by using a homomorphic encryption algorithm by the second node.
The verification message generation module 403 is configured to generate a verification message based on the signed second string, the random key, and the first string.
The first sending module 404 is configured to send a verification message to any node in the blockchain.
Wherein the first node may be any node in the block chain.
The first node for realizing behavior verification in the block chain provided by the embodiment can realize data transaction among all nodes in the block chain under the condition of not disclosing original data, and any node in the block chain can verify the data transaction process, so that the whole network supervision is realized, the condition that a data receiver refuses to pay a reward or a data sender randomly sends data out randomly is prevented, and the smooth data transaction and the safety of user data are ensured.
Optionally, as shown in fig. 5, the first node 40 provided in this embodiment further includes a request obtaining module 405, configured to receive a data obtaining request sent by a second node, where the data obtaining request includes the first character string.
Optionally, as shown in fig. 5, the first node 40 provided in this embodiment further includes a random key generation module 406, configured to generate a random number, and generate a random key based on the random number by using a preset algorithm, where a length of the random key is greater than a length of the random number.
Correspondingly, the verification message generating module 403 is specifically configured to: and generating a verification message based on the signed second character string, the random number corresponding to the random key and the first character string.
Further, the random key generation module 406 is specifically configured to: randomly selecting at least one block from the block chain; and encrypting corresponding data in the selected block by using the cipher block chaining mode by using the random number as a secret key to obtain the random secret key.
Correspondingly, the verification message generating module 403 is specifically configured to: and generating a verification message based on the signed second character string, the random number corresponding to the random key, the block height of the selected block and the first character string.
Further, the random key generation module 406 is specifically configured to: and repeatedly encrypting the corresponding data in the selected block by using the random number as a key and utilizing a cipher block chaining mode so as to enable the generated random key to reach a preset length.
Optionally, the verification message generating module 403 is specifically configured to: and sending a verification message to any node in the block chain, wherein the verification message comprises the signed second character string, the random key and the first character string.
Optionally, the verification message generating module 403 is specifically configured to: and generating verification information based on the signed second character string, the random key and the first character string, storing the verification information into a verification block in the block chain, and sending a verification message to any node in the block chain, wherein the verification message comprises the block height of the verification block.
Optionally, the length of the random key in this embodiment is the same as the length of the target data.
Optionally, the homomorphic encryption algorithm in this embodiment includes an addition homomorphic encryption algorithm or a multiplication homomorphic encryption algorithm.
The first node for implementing behavior verification in a blockchain in this embodiment adopts the same inventive concept as the behavior verification method in the blockchain in the first and second embodiments, and can obtain the same beneficial effects, and details are not repeated herein.
EXAMPLE six
Based on the same inventive concept as the embodiment, the present application provides a second node for implementing behavior verification in a blockchain, as shown in fig. 6, where the second node 60 includes a second receiving module 601 and a verifying module 602.
The second receiving module 601 is configured to receive a verification message sent by a first node, and obtain a signed second character string, a random key, and a first character string corresponding to the verification message, where the first character string is obtained by encrypting target data using a homomorphic encryption algorithm, and the second character string is obtained by encrypting the first data using the homomorphic encryption algorithm.
The verification module 602 is configured to verify, according to a digital signature in the signed second character string, that the node that receives the first data sent by the first node is the second node, and verify, according to the second character string, the random key, and the first character string, that the data before encryption corresponding to the first data is the target data corresponding to the first character string, by using a homomorphic property of a homomorphic encryption algorithm.
Wherein the second node may be any node in the block chain.
The second node for realizing behavior verification in the blockchain provided by the embodiment can verify any data transaction process in the blockchain under the condition of not disclosing original data, thereby realizing whole network supervision, preventing the condition that a data receiver refuses to pay a reward after receiving data or a data sender randomly sends data randomly, and ensuring smooth data transaction and safety of user data.
EXAMPLE seven
An embodiment of the present application provides an electronic device, as shown in fig. 7, where the electronic device 70 includes: a processor 701 and a memory 702. The processor 701 is coupled to a memory 702, such as via a bus 703. Optionally, the electronic device 70 may also include a transceiver 704. It should be noted that the transceiver 704 is not limited to one in practical applications, and the structure of the electronic device 70 is not limited to the embodiment of the present application.
The processor 701 is applied to the embodiment of the present application, and is configured to implement the functions of the first encryption module 401, the first receiving module 402, the verification message generating module 403, and the first sending module 404 shown in fig. 4. The transceiver 704 includes a receiver and a transmitter.
The processor 701 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 701 may also be a combination of computing functions, e.g., comprising one or more microprocessors, DSPs, and microprocessors, among others.
Bus 703 may include a path that transfers information between the above components. The bus 703 may be a PCI bus or an EISA bus, etc. The bus 703 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 7, but this is not intended to represent only one bus or type of bus.
The memory 702 may be, but is not limited to, a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, an EEPROM, a CD-ROM or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
Optionally, the memory 702 is used for storing application program codes for implementing the present application, and the processor 701 controls the execution. The processor 701 is configured to execute application program code stored in the memory 702 to implement the actions of the behavior verification apparatus in the blockchain provided by the embodiment shown in fig. 4.
Compared with the prior art, the electronic equipment provided by the embodiment of the application can realize data transaction among all nodes in the block chain under the condition that original data is not disclosed, and any node in the block chain can verify the data transaction process, so that the whole network supervision is realized, the condition that a data receiver refuses to pay a reward after receiving data or a data sender randomly sends data out randomly is prevented, and the smooth data transaction and the safety of user data are ensured.
Optionally, the processor 701 is configured to execute the application program code stored in the memory 702 to implement the actions of the first node provided in the embodiment shown in fig. 5, which is not described herein again.
Example eight
An embodiment of the present application provides an electronic device, as shown in fig. 8, an electronic device 80 shown in fig. 8 includes: a processor 801 and a memory 802. Where the processor 801 is coupled to a memory 802, such as via a bus 803. Optionally, the electronic device 80 may also include a transceiver 804. It should be noted that the transceiver 804 is not limited to one in practical applications, and the structure of the electronic device 80 is not limited to the embodiment of the present application.
The processor 801 is applied to the embodiment of the present application, and is configured to implement the functions of the second receiving module 601 and the verifying module 602 shown in fig. 6. The transceiver 804 includes a receiver and a transmitter.
The processor 801 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 801 may also be a combination of computing functions, e.g., comprising one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
Bus 803 may include a path that transfers information between the above components. The bus 803 may be a PCI bus or an EISA bus, etc. The bus 803 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 8, but this is not intended to represent only one bus or type of bus.
The memory 802 may be, but is not limited to, a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, an EEPROM, a CD-ROM or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
Optionally, the memory 802 is used for storing application program codes for performing aspects of the present application, and is controlled by the processor 801 for execution. The processor 801 is configured to execute application program code stored in the memory 802 to implement the actions of the behavior verification apparatus in the block chain provided by the embodiment shown in fig. 6.
Compared with the prior art, the electronic equipment provided by the embodiment of the application can verify any data transaction process in the block chain under the condition of not disclosing original data, realizes whole-network supervision, prevents the situation that a data receiver refuses to pay a reward after receiving data or a data sender randomly sends data randomly, and ensures smooth data transaction and safety of user data.
Example nine
The embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the behavior verification method in the blockchain shown in the first embodiment.
Compared with the prior art, the embodiment of the application provides a computer-readable storage medium, which can realize data transaction among all nodes in a block chain under the condition of not disclosing original data, and enable any node in the block chain to verify the data transaction process, thereby realizing whole-network supervision, preventing the situation that a data receiver refuses to pay a reward after receiving data or a data sender randomly sends data out at random, and ensuring the smooth data transaction and the safety of user data.
Optionally, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the behavior verification method in the block chain shown in the second embodiment is implemented, which is not described herein again.
Example ten
The embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the behavior verification method in the blockchain shown in the third embodiment.
Compared with the prior art, the embodiment of the application provides a computer-readable storage medium, which can verify any data transaction process in a block chain under the condition of not disclosing original data, realizes whole-network supervision, prevents a data receiver from refusing to pay a reward after receiving data or a data sender from randomly sending data randomly, and ensures smooth data transaction and safety of user data.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present application, and it should be noted that, for those skilled in the art, several modifications and decorations can be made without departing from the principle of the present application, and these modifications and decorations should also be regarded as the protection scope of the present application.

Claims (26)

1. A behavior verification method in a blockchain is characterized by comprising the following steps:
generating a random number, and generating a random key by using a preset algorithm based on the random number, wherein the length of the random key is greater than that of the random number;
encrypting target data corresponding to a first character string by using a random key to obtain first data, and sending the first data to a second node, wherein the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm;
receiving a signed second character string returned by a second node, wherein the second character string is obtained by encrypting the first data by the second node by using a homomorphic encryption algorithm;
generating a verification message based on the signed second character string, the random number corresponding to the random key and the first character string, and sending the verification message to any node in the block chain;
the generating a random key by using a preset algorithm based on the random number includes:
randomly selecting at least one block from the block chain;
encrypting corresponding data in the selected block by using the random number as a key and a cipher block chaining mode to obtain the random key;
generating a verification message based on the signed second string, the random key, and the first string, including:
and generating a verification message based on the signed second character string, the random number corresponding to the random key, the block height of the selected block and the first character string.
2. The method of claim 1, wherein prior to encrypting the target data corresponding to the first string with the random key, the method further comprises:
and receiving a data acquisition request sent by the second node, wherein the data acquisition request comprises a first character string.
3. The method according to claim 1, wherein the encrypting the corresponding data in the selected block by using the cipher block chaining mode with the random number as the key to obtain the random key comprises:
and repeatedly encrypting the corresponding data in the selected block by using the random number as a key and utilizing a cipher block chaining mode so as to enable the generated random key to reach a preset length.
4. The method of claim 1, wherein the length of the random key is the same as the length of the target data.
5. The method of claim 1, wherein the homomorphic encryption algorithm comprises an additive homomorphic encryption algorithm or a multiplicative homomorphic encryption algorithm.
6. The method according to claim 1, wherein generating a verification message based on the signed second string, the random number corresponding to the random key, and the first string, and sending the verification message to any node in a blockchain comprises:
sending a verification message to any node in a blockchain, wherein the verification message comprises the signed second character string, the random key and the first character string;
or the like, or, alternatively,
generating verification information based on the signed second character string, the random key and the first character string, storing the verification information into a verification block in a block chain, and sending a verification message to any node in the block chain, wherein the verification message comprises the block height of the verification block.
7. A behavior verification method in a blockchain is characterized by comprising the following steps:
receiving a verification message sent by a first node, and acquiring a signed second character string corresponding to the verification message, a random number corresponding to a random key, block height of a randomly selected block and a first character string, wherein the first character string is obtained by encrypting target data by using a homomorphic encryption algorithm, and the second character string is obtained by encrypting the first data by using the homomorphic encryption algorithm; the random key is obtained by encrypting corresponding data in the selected block by the first node in a cipher block connection mode according to the random number generated by the first node and the block height of the randomly selected block, and the length of the random key is greater than that of the random number;
verifying that the node receiving the first data sent by the first node is a second node according to the digital signature in the signed second character string;
and verifying that the data before encryption corresponding to the first data is the target data corresponding to the first character string by utilizing the homomorphism property of a homomorphic encryption algorithm according to the second character string, the random number corresponding to the random key, the block height of the selected block and the first character string.
8. A behavior verification system in a blockchain, the system comprising a plurality of nodes, characterized by:
the first node is used for encrypting target data corresponding to a first character string by using a random key to obtain first data and sending the first data to the second node, wherein the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm;
the first node is further configured to: generating a random number before encrypting target data corresponding to a first character string by using a random key, and generating the random key by using a preset algorithm based on the random number, wherein the length of the random key is greater than that of the random number;
the second node is used for encrypting the first data by using a homomorphic encryption algorithm to obtain a second character string, signing the second character string and sending the signed second character string to the first node;
the first node is configured to generate a verification message based on the signed second character string, the random number corresponding to the random key, and the first character string, and send the verification message to any node in the block chain except the first node;
the first node is specifically configured to:
randomly selecting at least one block from the block chain;
encrypting corresponding data in the selected block by using the random number as a key and a cipher block chaining mode to obtain the random key;
and generating a verification message based on the signed second character string, the random number corresponding to the random key, the block height of the selected block and the first character string, and sending the verification message to any other node except the first node in the block chain.
9. The system of claim 8, wherein any node in the system is configured to:
receiving a verification message sent by a first node, and acquiring a signed second character string, a random key and a first character string corresponding to the verification message;
verifying that the node receiving the first data sent by the first node is a second node according to the digital signature in the signed second character string;
and verifying that the data before encryption corresponding to the first data is the target data corresponding to the first character string by utilizing the homomorphism property of a homomorphic encryption algorithm according to the second character string, the random key and the first character string.
10. The system of claim 8, wherein the second node is further configured to: before the first node encrypts target data corresponding to the first character string by using a random key, sending a data acquisition request to the first node, wherein the data acquisition request comprises the first character string.
11. The system of claim 8, wherein the second node is further configured to: and decrypting the first data by using the random key to obtain the target data.
12. The system of claim 8, wherein the homomorphic encryption algorithm comprises an additive homomorphic encryption algorithm or a multiplicative homomorphic encryption algorithm.
13. The system of claim 8, wherein the first node is specifically configured to: and repeatedly encrypting the selected block by using the random number as a key and utilizing a cipher block chaining mode so as to enable the generated random key to reach a preset length.
14. The system of claim 8, the length of the random key being the same as the length of the target data.
15. The system of claim 8, wherein the first node is specifically configured to:
sending a verification message to any node in a blockchain, wherein the verification message comprises the signed second character string, the random key and the first character string;
or the like, or, alternatively,
generating verification information based on the signed second character string, the random key and the first character string, storing the verification information into a verification block in a block chain, and sending a verification message to any node in the block chain, wherein the verification message comprises the block height of the verification block.
16. A first node for implementing behavioral verification in a blockchain, the first node comprising:
the random key generation module is used for generating a random number and generating a random key by using a preset algorithm based on the random number, wherein the length of the random key is greater than that of the random number;
the first encryption module is used for encrypting target data corresponding to a first character string by using a random key to obtain first data and sending the first data to a second node, wherein the first character string is obtained by encrypting the target data by using a homomorphic encryption algorithm;
the first receiving module is used for receiving a signed second character string returned by a second node, wherein the second character string is obtained by encrypting the first data by the second node by using a homomorphic encryption algorithm;
the verification message generation module is used for generating a verification message based on the signed second character string, the random number corresponding to the random key and the first character string;
a first sending module, configured to send the verification message to any node in a blockchain;
the random key generation module is specifically configured to:
randomly selecting at least one block from the block chain; encrypting corresponding data in the selected block by using the random number as a key and a cipher block chaining mode to obtain the random key;
the verification message generation module is specifically configured to:
and generating a verification message based on the signed second character string, the random number corresponding to the random key, the block height of the selected block and the first character string.
17. The first node of claim 16, wherein the first node further comprises:
and a request acquisition module, configured to receive a data acquisition request sent by the second node before encrypting, by using the random key, target data corresponding to the first character string, where the data acquisition request includes the first character string.
18. The first node of claim 16, wherein the random key generation module is specifically configured to:
and repeatedly encrypting the corresponding data in the selected block by using the random number as a key and utilizing a cipher block chaining mode so as to enable the generated random key to reach a preset length.
19. The first node of claim 16, wherein the length of the random key is the same as the length of the target data.
20. The first node of claim 16, wherein the homomorphic encryption algorithm comprises an additive homomorphic encryption algorithm or a multiplicative homomorphic encryption algorithm.
21. The first node of claim 16, wherein the verification message generation module is specifically configured to:
sending a verification message to any node in a blockchain, wherein the verification message comprises the signed second character string, the random key and the first character string; or generating verification information based on the signed second character string, the random key and the first character string, storing the verification information into a verification block in a block chain, and sending a verification message to any node in the block chain, wherein the verification message comprises the block height of the verification block.
22. A second node for implementing behavioral verification in a blockchain, the second node comprising:
the second receiving module is used for receiving the verification message sent by the first node and acquiring a signed second character string corresponding to the verification message, a random number corresponding to the random key, the block height of the selected block and the first character string, wherein the first character string is obtained by encrypting target data by using a homomorphic encryption algorithm, and the second character string is obtained by encrypting the first data by using a homomorphic encryption algorithm; the random key is obtained by encrypting corresponding data in the selected block by the first node in a cipher block connection mode according to a random number generated by the first node and the block height of the selected block, and the length of the random key is greater than that of the random number;
and the verification module is used for verifying that the node receiving the first data sent by the first node is the second node according to the digital signature in the signed second character string, and verifying that the data before encryption corresponding to the first data is the target data corresponding to the first character string by utilizing the homomorphic property of a homomorphic encryption algorithm according to the second character string, the random number corresponding to the random key and the first character string.
23. A behavior verification electronic device in a blockchain, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to: performing a method of behavioral verification in a blockchain according to any one of claims 1 to 6.
24. A behavior verification electronic device in a blockchain, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to: performing the method of behavior verification in a blockchain according to claim 7.
25. A computer-readable storage medium for storing computer instructions which, when run on a computer, cause the computer to perform the method of behavior verification in a blockchain according to any one of claims 1 to 6.
26. A computer-readable storage medium for storing computer instructions which, when run on a computer, cause the computer to perform the method of behavior verification in a blockchain of claim 7.
CN201810660746.3A 2018-06-25 2018-06-25 Behavior verification method, node, system and electronic equipment in block chain Active CN108833095B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810660746.3A CN108833095B (en) 2018-06-25 2018-06-25 Behavior verification method, node, system and electronic equipment in block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810660746.3A CN108833095B (en) 2018-06-25 2018-06-25 Behavior verification method, node, system and electronic equipment in block chain

Publications (2)

Publication Number Publication Date
CN108833095A CN108833095A (en) 2018-11-16
CN108833095B true CN108833095B (en) 2022-01-25

Family

ID=64138532

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810660746.3A Active CN108833095B (en) 2018-06-25 2018-06-25 Behavior verification method, node, system and electronic equipment in block chain

Country Status (1)

Country Link
CN (1) CN108833095B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111314060B (en) * 2018-12-12 2022-12-13 中移动信息技术有限公司 Key updating method, device and storage medium
CN109474619B (en) * 2018-12-17 2023-06-23 中国平安财产保险股份有限公司 Data encryption reporting method and device and data decryption method and device
CN110061828B (en) * 2019-04-04 2021-05-04 西安电子科技大学 Distributed digital signature method without trusted center
CN110348836B (en) * 2019-06-21 2023-07-21 中信百信银行股份有限公司 Payment method and device based on block chain and electronic equipment
CN110730187A (en) * 2019-10-22 2020-01-24 全链通有限公司 Transaction verification method, accounting node and medium based on block chain
CN114093465A (en) * 2021-10-28 2022-02-25 广东珠江智联信息科技股份有限公司 Medical image labeling system based on homomorphic encryption and data processing method thereof
CN113904869B (en) * 2021-11-10 2024-04-19 深圳前海微众银行股份有限公司 Method for detecting malicious nodes in blockchain and blockchain

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103929308A (en) * 2014-04-01 2014-07-16 嘉兴市辰翔信息科技有限公司 Information verification method applied to RFID card
CN104618467A (en) * 2015-01-20 2015-05-13 西安电子科技大学 Effective and anti-repudiation tumble helping method and system based on android platform
WO2017079652A1 (en) * 2015-11-05 2017-05-11 Pulsifer Allen Cryptographic transactions system
CN106682520A (en) * 2016-11-17 2017-05-17 精硕科技(北京)股份有限公司 Data exchange method and system
CN106982205A (en) * 2017-03-01 2017-07-25 中钞信用卡产业发展有限公司北京智能卡技术研究院 Digital asset treating method and apparatus based on block chain
CN108011945A (en) * 2017-11-30 2018-05-08 公安部第三研究所 A kind of cloud evidence obtaining process record method and system based on block chain

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107666388B (en) * 2016-07-28 2019-11-01 郑珂威 Block chain information encryption method based on complete homomorphic cryptography method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103929308A (en) * 2014-04-01 2014-07-16 嘉兴市辰翔信息科技有限公司 Information verification method applied to RFID card
CN104618467A (en) * 2015-01-20 2015-05-13 西安电子科技大学 Effective and anti-repudiation tumble helping method and system based on android platform
WO2017079652A1 (en) * 2015-11-05 2017-05-11 Pulsifer Allen Cryptographic transactions system
CN106682520A (en) * 2016-11-17 2017-05-17 精硕科技(北京)股份有限公司 Data exchange method and system
CN106982205A (en) * 2017-03-01 2017-07-25 中钞信用卡产业发展有限公司北京智能卡技术研究院 Digital asset treating method and apparatus based on block chain
CN108011945A (en) * 2017-11-30 2018-05-08 公安部第三研究所 A kind of cloud evidence obtaining process record method and system based on block chain

Also Published As

Publication number Publication date
CN108833095A (en) 2018-11-16

Similar Documents

Publication Publication Date Title
CN108833095B (en) Behavior verification method, node, system and electronic equipment in block chain
CN107196763B (en) SM2 algorithm collaborative signature and decryption method, device and system
CN106961336B (en) A kind of key components trustship method and system based on SM2 algorithm
CN107634836B (en) SM2 digital signature generation method and system
CN107707358B (en) EC-KCDSA digital signature generation method and system
CN111510281B (en) Homomorphic encryption method and device
CN104270247B (en) Suitable for the efficient general Hash functions authentication method of quantum cryptography system
CN110414981B (en) Homomorphic encryption method supporting ZKPs and blockchain transaction amount encryption method
CN112906030B (en) Data sharing method and system based on multi-party homomorphic encryption
KR100259179B1 (en) Process of communication cryptograph
CN109245903B (en) Signature method and device for cooperatively generating SM2 algorithm by two parties and storage medium
CN107154845B (en) BGN type ciphertext decryption outsourcing scheme based on attributes
Oktaviana et al. Three-pass protocol implementation in caesar cipher classic cryptography
US10630476B1 (en) Obtaining keys from broadcasters in supersingular isogeny-based cryptosystems
CN114095181B (en) Threshold ring signature method and system based on cryptographic algorithm
CN109068322A (en) Decryption method, system, mobile terminal, server and storage medium
JP2023552263A (en) Redistribution of secret sharing
CN112632630A (en) SM 2-based collaborative signature calculation method and device
Rahmani et al. A multilayer evolutionary homomorphic encryption approach for privacy preserving over big data
CN111030821B (en) Encryption method of alliance chain based on bilinear mapping technology
CN116830523A (en) threshold key exchange
CN110865793A (en) Method for generating random number based on block chain intelligent contract
CN111245594A (en) Homomorphic operation-based collaborative signature method and system
CN111314059A (en) Processing method, device and equipment of account authority proxy and readable storage medium
Zhang et al. Privacy‐friendly weighted‐reputation aggregation protocols against malicious adversaries in cloud services

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