CN117220852A - Trusted data sharing method and system based on blockchain - Google Patents

Trusted data sharing method and system based on blockchain Download PDF

Info

Publication number
CN117220852A
CN117220852A CN202311141926.8A CN202311141926A CN117220852A CN 117220852 A CN117220852 A CN 117220852A CN 202311141926 A CN202311141926 A CN 202311141926A CN 117220852 A CN117220852 A CN 117220852A
Authority
CN
China
Prior art keywords
data
blockchain
encryption algorithm
encryption
feature code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311141926.8A
Other languages
Chinese (zh)
Inventor
史本军
孙圣力
董顺林
李青山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Boya Chain Beijing Technology Co ltd
Nanjing Boya Certification Chain Technology Co ltd
Original Assignee
Boya Chain Beijing Technology Co ltd
Nanjing Boya Certification Chain 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 Boya Chain Beijing Technology Co ltd, Nanjing Boya Certification Chain Technology Co ltd filed Critical Boya Chain Beijing Technology Co ltd
Priority to CN202311141926.8A priority Critical patent/CN117220852A/en
Publication of CN117220852A publication Critical patent/CN117220852A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a trusted data sharing method and a system based on a blockchain, which are characterized in that a data information block is packed into by an encryption algorithm, a feature code of data to be shared and position information in an IPFS network and is sent to a blockchain node to finish the uplink recording of the data and finish the data release; acquiring an encryption algorithm and a feature code of data to be verified stored in a blockchain and position information in an IPFS network; downloading data to be verified from the IPFS network according to the obtained position information; processing the data to be verified by using the encryption algorithm to obtain a new feature code; and judging whether the new feature code is consistent with the feature code obtained in the block chain to verify whether the original data is changed or not, and finishing data verification. The invention provides a trusted data sharing method and a trusted data sharing system based on a blockchain, which ensure the non-tamper property and traceability of data.

Description

Trusted data sharing method and system based on blockchain
Technical Field
The invention relates to a trusted data sharing method and system of a blockchain, and belongs to the technical field of data transaction.
Background
The traditional centralized content sharing strategy has the main problems that the content issued by the user is maliciously modified and deleted, the rights and interests of the user are difficult to be ensured, and trust among the users is lacking.
As blockchain technology advances, numerous advantages of blockchain technology begin to emerge across various domain applications. Its decentralization, non-tamperable, makes it possible for participants who do not trust each other to maintain a trusted system.
For this reason, blockchain techniques have begun to be applied to data sharing. Currently, there are a number of technical issues to be solved in the data sharing strategy based on the blockchain, such as a large amount of data being stored in the blocks and being processed in the uplink, which will cause a great waste of the storage space of the block data and a delay of the uplink of the block data. Therefore, how to solve the problem of resource waste and ensure the credibility of shared data becomes an important research direction.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a trusted data sharing method and a trusted data sharing system based on a block chain, which are used for recording data information by using the block chain, storing data by using an IPFS and associating the data information with the data information by using an encrypted data information block.
In order to achieve the above purpose, the invention adopts the following technical scheme: a trusted data sharing method based on block chains,
s1, publishing data
S1.1, processing data to be shared by using an encryption algorithm to obtain a feature code;
s1.2, storing data to be shared into an IPFS network to obtain position information of the data in the IPFS network;
s1.3, packing the encryption algorithm, the feature codes of the data to be shared and the position information of the IPFS network into a data information block, and sending the data information block to a blockchain node to finish the uplink record of the data;
s2, verifying data
S2.1, based on the storage address of the data information block in the blockchain, acquiring an encryption algorithm and a feature code of data to be verified stored in the blockchain and position information in an IPFS network;
s2.2, downloading data to be verified from the IPFS network according to the obtained position information;
s2.3, processing the data to be verified by using the encryption algorithm to obtain a new feature code;
s2.4, judging whether the new feature code is consistent with the feature code obtained in the block chain to verify whether the original data is changed.
Further, in the step S1, before the uplink recording of the data information block, the method further includes:
s1.3.1, using the user attribute of the data sender as a parameter, generating a pair of public key and private key by adopting an asymmetric encryption algorithm;
s1.3.2, performing secondary encryption on the private key by adopting an encryption method of a CP-ABE encryption algorithm to generate an encryption key, and sending the encryption key to a data receiver user;
s1.3.3 encrypting the data information block by using the public key and time stamping the data information block for later reference.
Further, in the step S2, before downloading the data to be verified from the IPFS network, the method further includes:
decrypting the encryption key by adopting a decryption method of a CP-ABE encryption algorithm to obtain the private key;
decrypting the data information block by adopting the private key to obtain an encryption algorithm and a feature code of the data and storage position information in an IPFS network;
encrypting the downloaded data by using the encryption algorithm to generate a new feature code, and judging whether the new feature code is consistent with the feature code obtained by decryption in the block chain; if the data is consistent, the shared data is not changed, and belongs to the trusted data, otherwise, the shared data is the untrusted data, and the receiving party feeds back the untrusted data to the transmitting party.
Further, the performing the second encryption on the private key by using the encryption method in the CP-ABE encryption algorithm to generate an encryption key includes:
extracting user attributes of the receiver user, and converting the extracted user attributes into character strings required by a CP-ABE encryption algorithm, wherein the CP-ABE encryption algorithm takes the character strings as an encryption strategy represented by an attribute set;
the CP-ABE encryption algorithm secondarily encrypts the private key based on the encryption policy to generate an encryption key.
Further, the storage address of the shared content in the IPFS network is expressed as: ipfs/< signature >/< file identifier >.
Further, the blockchain may be a coalition chain.
The system of the trusted data sharing method based on the blockchain comprises an issuing side terminal, a receiving side terminal, a data issuing module, a data verification module, an IPFS network and the blockchain, wherein:
the data release module is used for releasing shared data and comprises:
processing the data to be shared by using an encryption algorithm to obtain a feature code;
storing the data to be shared into an IPFS network to obtain the position information of the data in the IPFS network;
the encryption algorithm and the feature codes of the data to be shared are packaged into a data information block in the position information of the IPFS network and sent to the block chain node, and uplink recording of the data is completed;
the data verification module is used for verifying data content, and comprises:
based on the storage address of the data information block in the blockchain, acquiring an encryption algorithm and a feature code of data to be verified stored in the blockchain and position information in an IPFS network;
downloading data to be verified from the IPFS network according to the obtained position information;
processing the data to be verified by using the encryption algorithm to obtain a new feature code;
and judging whether the new feature code is consistent with the feature code obtained in the block chain to verify whether the original data is changed.
Further, before the uplink recording of the data information block, the method further includes:
using the user attribute of the data sender as a parameter, and generating a pair of public key and private key by using an asymmetric encryption algorithm;
performing secondary encryption on the private key by adopting an encryption method of a CP-ABE encryption algorithm to generate an encryption key, and sending the encryption key to a data receiver user;
and encrypting the data information block by adopting the public key.
Further, before downloading the sharing data from the IPFS network, the method further includes:
decrypting the encryption key by adopting a decryption method of a CP-ABE encryption algorithm to obtain the private key;
and decrypting the data information block by adopting the private key to obtain an encryption algorithm and a feature code of the data and storage position information in the IPFS network.
Encrypting the downloaded data by using the encryption algorithm to generate a new feature code, and judging whether the new feature code is consistent with the feature code obtained by decryption in the block chain; if the data is consistent, the shared data is not changed, and belongs to the trusted data, otherwise, the shared data is the untrusted data, and the receiving party feeds back the untrusted data to the transmitting party.
Further, the blockchain is embedded in the IPFS network.
Compared with the prior art, the invention has the beneficial effects that:
the invention solves the problems of great waste of block data storage space and delay of block data uplink and ensures the non-tamper property, the credibility and the traceability of shared data through the information interaction of the data issuing side terminal, the receiving side terminal, the data issuing module, the data verification module, the IPFS network and the block chain. In addition, in the invention, the block chain is used for recording data information, the IPFS is used for storing the data, and the data and the record are separated in a mode of associating the two by the encrypted data information block, so that the convenience of quickly searching the data is ensured.
Drawings
FIG. 1 is a schematic diagram of a data distribution module of a trusted data sharing method based on blockchain in the present invention.
FIG. 2 is a block diagram of a process for publishing data based on a blockchain-based trusted data sharing method of the present invention.
FIG. 3 is a schematic diagram of a data verification module of the blockchain-based trusted data sharing method of the present invention.
FIG. 4 is a block diagram of a process for verifying data for a blockchain-based trusted data sharing method of the present invention.
Description of the embodiments
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for explaining the present invention and are not to be construed as limiting the present invention.
Currently, there are a number of technical issues to be solved in the data sharing strategy based on the blockchain, such as a large amount of data being stored in the blocks and being processed in the uplink, which will cause a great waste of the storage space of the block data and a delay of the uplink of the block data.
In view of the above, the trusted data sharing method and system based on the blockchain solve the problems of great waste of the storage space of the blockdata and delay of the uplink of the blockdata, and ensure the non-tamper property, the credibility and the traceability of the shared data. In addition, in the invention, the block chain is used for recording data information, the IPFS is used for storing the data, and the data and the record are separated in a mode of associating the two by the encrypted data information block, so that the convenience of quickly searching the data is ensured. The method and system for trusted data sharing based on blockchain of the present invention will be described in detail with reference to the following embodiments.
Example 1
As shown in fig. 1 to 4, the trusted data sharing method based on blockchain provided in this embodiment includes two main links of publishing data and verifying data, wherein:
the data distribution is performed by the data distribution module through the data distribution terminal (namely, the user distributing the shared data), and the data distribution method comprises the following steps of:
s101: and processing the data to be shared by using an encryption algorithm to obtain the feature code.
S102: and storing the data to be shared into the IPFS network to obtain the position information of the data in the IPFS network.
S103: and packing the encryption algorithm and the feature codes of the data to be shared and the position information of the IPFS network into a data information block.
S104: and generating a public key by using the transmitted user attribute information, encrypting the data information block by using the public key, and performing uplink recording.
S105: and encrypting the private key by using a CP-ABE encryption algorithm and transmitting the private key to a receiver user.
Of course, prior to this, both the publisher user and the recipient user sharing the data have been registered as one data node of the blockchain.
The step S101: processing the data to be shared by using an encryption algorithm to obtain a feature code; the specific treatment process comprises the following steps:
and processing the data to be shared by adopting a summary algorithm or a hash algorithm to obtain the feature code. Notably, the algorithm is stored in the memory space of the blockchain node. When data encryption is needed, the encryption algorithm is read from the chain link point of the block, and the encryption algorithm is deleted after encryption is completed.
And storing an encryption algorithm library in the storage space of the blockchain node, and randomly acquiring an encryption algorithm from the encryption algorithm library each time data encryption is carried out. Before the block chain node performs the uplink record of the data information block, the encryption algorithm for generating the data feature code is stored into the data information block together, and after public key encryption is performed, the uplink record is performed.
S104, S105 include the following specific procedures:
using the user attribute of the data sender as a parameter, and generating a pair of public key and private key by using an asymmetric encryption algorithm;
performing secondary encryption on the private key by adopting an encryption method of a CP-ABE encryption algorithm to generate an encryption key, and sending the encryption key to a data receiver user;
and encrypting the data information block by adopting the public key.
Wherein the blockchain is a public chain or a private chain.
And intelligent contracts can be arranged on the blockchain in advance, so that the trusted data sharing process can be executed more efficiently and automatically.
The verification data is executed by the receiving terminal (i.e. the user receiving the shared data) through the data verification module, which comprises the steps of:
s201: and decrypting the private key sent by the receiving party user by using a CP-ABE decryption algorithm to obtain the private key.
S202: and decrypting by using a private key based on the storage address of the data information block in the block chain to obtain an encryption algorithm, a feature code and data position information.
S203: and downloading the data to be verified from the IPFS according to the obtained position information, and processing the data to be verified by using an encryption algorithm to obtain a new feature code.
S204: judging whether the new feature code is consistent with the feature code obtained in the block chain; if the data is consistent, the shared data is not changed, and belongs to the trusted data, otherwise, the shared data is the untrusted data, and the receiving party feeds back the untrusted data to the transmitting party.
Therefore, the trusted data sharing method and the trusted data sharing system based on the blockchain solve the problems of great waste of the storage space of the block data and delay of the uplink of the block data, and ensure the non-tamper property, the credibility and the traceability of the shared data. In addition, in the invention, the block chain is used for recording data information, the IPFS is used for storing the data, and the data and the record are separated in a mode of associating the two by the encrypted data information block, so that the convenience of quickly searching the data is ensured.
Example 2
The embodiment provides a trusted data sharing system based on a blockchain, which comprises a publisher terminal, a receiver terminal, a data publishing module, a data verification module, an IPFS network and the blockchain, wherein:
the data release module is used for releasing shared data and comprises:
processing the data to be shared by using an encryption algorithm to obtain a feature code;
storing the data to be shared into an IPFS network to obtain the position information of the data in the IPFS network;
the encryption algorithm and the feature codes of the data to be shared are packaged into a data information block in the position information of the IPFS network and sent to the block chain node, and uplink recording of the data is completed;
the data verification module is used for verifying data content, and comprises:
based on the storage address of the data information block in the blockchain, acquiring an encryption algorithm and a feature code of data to be verified stored in the blockchain and position information in an IPFS network;
downloading data to be verified from the IPFS network according to the obtained position information;
processing the data to be verified by using the encryption algorithm to obtain a new feature code;
and judging whether the new feature code is consistent with the feature code obtained in the block chain to verify whether the original data is changed.
The trusted data sharing method and the system based on the blockchain solve the problems of great waste of the storage space of the blockchain and delay of the uplink of the blockchain and ensure the non-tamper property, the credibility and the traceability of the shared data through the information interaction of the data issuing side terminal, the receiving side terminal, the data issuing module, the data verification module, the IPFS network and the blockchain. In addition, in the invention, the block chain is used for recording data information, the IPFS is used for storing the data, and the data and the record are separated in a mode of associating the two by the encrypted data information block, so that the convenience of quickly searching the data is ensured.
Before the uplink recording of the data information block, the method further comprises:
using the user attribute of the data sender as a parameter, and generating a pair of public key and private key by using an asymmetric encryption algorithm;
performing secondary encryption on the private key by adopting an encryption method of a CP-ABE encryption algorithm to generate an encryption key, and sending the encryption key to a data receiver user;
and encrypting the data information block by adopting the public key.
Before downloading the sharing data from the IPFS network, the method further includes:
decrypting the encryption key by adopting a decryption method of a CP-ABE encryption algorithm to obtain the private key;
and decrypting the data information block by adopting the private key to obtain an encryption algorithm and a feature code of the data and storage position information in the IPFS network.
Optionally, the blockchain is embedded in the IPFS network.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims.

Claims (10)

1. A trusted data sharing method based on a blockchain is characterized by comprising the following steps of:
s1, publishing data
S1.1, processing data to be shared by using an encryption algorithm to obtain a feature code;
s1.2, storing data to be shared into an IPFS network to obtain position information of the data in the IPFS network;
s1.3, packing the encryption algorithm, the feature codes of the data to be shared and the position information of the IPFS network into a data information block, and sending the data information block to a blockchain node to finish the uplink record of the data;
s2, verifying data
S2.1, based on the storage address of the data information block in the blockchain, acquiring an encryption algorithm and a feature code of data to be verified stored in the blockchain and position information in an IPFS network;
s2.2, downloading data to be verified from the IPFS network according to the obtained position information;
s2.3, processing the data to be verified by using the encryption algorithm to obtain a new feature code;
s2.4, judging whether the new feature code is consistent with the feature code obtained in the block chain to verify whether the original data is changed.
2. The blockchain-based trusted data sharing method of claim 1, wherein: in the step S1, before the uplink recording of the data information block, the method further includes:
s1.3.1, using the user attribute of the data sender as a parameter, generating a pair of public key and private key by adopting an asymmetric encryption algorithm;
s1.3.2, performing secondary encryption on the private key by adopting an encryption method of a CP-ABE encryption algorithm to generate an encryption key, and sending the encryption key to a data receiver user;
s1.3.3 encrypting the data information block by using the public key and time stamping the data information block for later reference.
3. The blockchain-based trusted data sharing method of claim 2, wherein: in S2, before downloading the data to be verified from the IPFS network, the method further includes:
decrypting the encryption key by adopting a decryption method of a CP-ABE encryption algorithm to obtain the private key;
decrypting the data information block by adopting the private key to obtain an encryption algorithm and a feature code of the data and storage position information in an IPFS network;
encrypting the downloaded data by using the encryption algorithm to generate a new feature code, and judging whether the new feature code is consistent with the feature code obtained by decryption in the block chain; if the data is consistent, the shared data is not changed, and belongs to the trusted data, otherwise, the shared data is the untrusted data, and the receiving party feeds back the untrusted data to the transmitting party.
4. The blockchain-based trusted data sharing method of claim 3, wherein: the performing secondary encryption on the private key by adopting an encryption method in the CP-ABE encryption algorithm to generate an encryption key comprises the following steps:
extracting user attributes of the receiver user, and converting the extracted user attributes into character strings required by a CP-ABE encryption algorithm, wherein the CP-ABE encryption algorithm takes the character strings as an encryption strategy represented by an attribute set;
the CP-ABE encryption algorithm secondarily encrypts the private key based on the encryption policy to generate an encryption key.
5. The blockchain-based trusted data sharing method of claim 3, wherein: the storage address of the shared content in the IPFS network is expressed as: ipfs/< signature >/< file identifier >.
6. The blockchain-based trusted data sharing method of claim 1, wherein: the blockchain may be a coalition chain.
7. A system of a blockchain-based trusted data sharing method as in claims 1-6, wherein: the trusted data sharing system comprises an issuer terminal, a receiver terminal, a data issuing module, a data verification module, an IPFS network and a block chain, wherein:
the data release module is used for releasing shared data and comprises:
processing the data to be shared by using an encryption algorithm to obtain a feature code;
storing the data to be shared into an IPFS network to obtain the position information of the data in the IPFS network;
the encryption algorithm and the feature codes of the data to be shared are packaged into a data information block in the position information of the IPFS network and sent to the block chain node, and uplink recording of the data is completed;
the data verification module is used for verifying data content, and comprises:
based on the storage address of the data information block in the blockchain, acquiring an encryption algorithm and a feature code of data to be verified stored in the blockchain and position information in an IPFS network;
downloading data to be verified from the IPFS network according to the obtained position information;
processing the data to be verified by using the encryption algorithm to obtain a new feature code;
and judging whether the new feature code is consistent with the feature code obtained in the block chain to verify whether the original data is changed.
8. The system of blockchain-based trusted data sharing method of claim 7, wherein:
before the uplink recording of the data information block, the method further comprises:
using the user attribute of the data sender as a parameter, and generating a pair of public key and private key by using an asymmetric encryption algorithm;
performing secondary encryption on the private key by adopting an encryption method of a CP-ABE encryption algorithm to generate an encryption key, and sending the encryption key to a data receiver user;
and encrypting the data information block by adopting the public key.
9. The system of blockchain-based trusted data sharing method of claim 8, wherein: before downloading the sharing data from the IPFS network, the method further includes:
decrypting the encryption key by adopting a decryption method of a CP-ABE encryption algorithm to obtain the private key;
decrypting the data information block by adopting the private key to obtain an encryption algorithm and a feature code of the data and storage position information in an IPFS network;
encrypting the downloaded data by using the encryption algorithm to generate a new feature code, and judging whether the new feature code is consistent with the feature code obtained by decryption in the block chain; if the data is consistent, the shared data is not changed, and belongs to the trusted data, otherwise, the shared data is the untrusted data, and the receiving party feeds back the untrusted data to the transmitting party.
10. The system of blockchain-based trusted data sharing method of claim 7, wherein: the blockchain is embedded in the IPFS network.
CN202311141926.8A 2023-09-06 2023-09-06 Trusted data sharing method and system based on blockchain Pending CN117220852A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311141926.8A CN117220852A (en) 2023-09-06 2023-09-06 Trusted data sharing method and system based on blockchain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311141926.8A CN117220852A (en) 2023-09-06 2023-09-06 Trusted data sharing method and system based on blockchain

Publications (1)

Publication Number Publication Date
CN117220852A true CN117220852A (en) 2023-12-12

Family

ID=89045436

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311141926.8A Pending CN117220852A (en) 2023-09-06 2023-09-06 Trusted data sharing method and system based on blockchain

Country Status (1)

Country Link
CN (1) CN117220852A (en)

Similar Documents

Publication Publication Date Title
CN107770182B (en) Data storage method of home gateway and home gateway
US10848315B2 (en) Contract agreement method, agreement verification method, contract agreement system, agreement verification device, contract agreement device, contract agreement program and agreement verification program
US10033720B2 (en) Method and system for creating a certificate to authenticate a user identity
CN110852745B (en) Block chain distributed dynamic network key automatic updating method
CN101753539B (en) Network data storage method and server
CN104255009A (en) Systems and methods for segment integrity and authenticity for adaptive streaming
CN102915263A (en) Data backup method, system and equipment
CN111970114B (en) File encryption method, system, server and storage medium
CN102821098A (en) System and method for self-dissolving instant messaging under cloud environment
CN112035895A (en) Electronic contract evidence obtaining method and system based on transaction mode
CN115567312B (en) Alliance chain data authority management system and method capable of meeting various scenes
CN111262852B (en) Business card signing and issuing method and system based on block chain
CN112732695A (en) Cloud storage data security deduplication method based on block chain
CN114142995B (en) Key security distribution method and device for block chain relay communication network
US20220020019A1 (en) Smart Contract-Based Electronic Contract Forensics Method and System
CN114547698A (en) CORS service data storage system and method based on block chain
CN112651049B (en) Privacy data sharing method and system based on block chain
CN112954039A (en) Block chain evidence storage method
CN116455572A (en) Data encryption method, device and equipment
CN117220852A (en) Trusted data sharing method and system based on blockchain
CN105790928B (en) A kind of file splitting method based on digital digest
US11856085B2 (en) Information management system and method for the same
CN113810421A (en) Block chain-based PRE Internet of things data sharing method and system
Du et al. The applications of blockchain in the covert communication
CN112954388A (en) Data file acquisition method and device, terminal equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication