CLOUD-SIDE COLLABORATIVE MULTI-MODE PRIVATE DATA CIRCULATION METHOD BASED ON SMART CONTRACT
20230041862 · 2023-02-09
Assignee
Inventors
Cpc classification
H04L9/3268
ELECTRICITY
H04L9/0825
ELECTRICITY
H04L9/30
ELECTRICITY
International classification
H04L9/32
ELECTRICITY
H04L9/00
ELECTRICITY
Abstract
The present invention discloses a cloud-side collaborative multi-mode private data circulation method based on a smart contract, including: S1, a system is initialized; S2, the original data are encrypted into private data, an encryption certificate z′ for storage is generated, and z′ includes metadata and a data certificate key′; S3, the DO calls a smart contract program to realize uplink of the encryption certificate z′ and releases z′ to a block chain through a smart contract, wherein the smart contract is open to all user accounts; S4, rapid data circulation is realized: when DO releases the data certificate, DU has been identified, a DU's account ID.sub.DU is set through an access policy, the DU obtains an encryption key for data access by executing a smart contract and a key algorithm, private data are obtained through metadata and decrypted to obtain a plaintext; and S5, the data circulation is confirmed.
Claims
1. A cloud-side collaborative multi-mode private data circulation method based on a smart contract, comprising the following steps: S1, a system is initialized, comprising the following steps: S11, initialization of a key algorithm is completed by building a Key-Policy as a Service (KaaS) to obtain a public system key (PSK) and a master secret key (MSK); and S12, a user account is created for each user, comprising a user account ID, a corresponding public key ID.sub.pub-key and a private key ID.sub.pri-key; wherein the user account comprises a data owner (DO) and a data user (DU); S2, the original data are encrypted into private data by the DO, an encryption certificate z′ for storage is generated, and the z′ comprises metadata and a data certificate key′, comprising the following steps: S21, the DO applies to Kaas for PSK; and S22, the DO obtains the data certificate key′ from the PSK and an encryption key, that is key′=enc_cpabe (key,PSK,policy), while z′=[metadata,key′], comprising the following steps: S221, the DO generates metadata based on the original data, a random number is generated as an encryption key of the original data, the original data of the DO are encrypted through the encryption key to form private data, and the private data are stored in a cloud storage space; and S222, the DO generates an access policy based on the user account ID, key′=enc_cpabe (key,PSK,policy) is generated based on the key algorithm, while z′=[metadata,key′]; the key algorithm is executed by DO, the PSK, a key of a message to be encrypted and the access policy associated with the access policy are inputted into the algorithm to generate a data certificate key′ based on attribute encryption, and the data certificate key′ can be decrypted only by a requester who satisfies the access policy; S3, the DO calls a smart contract program to realize uplink of the encryption certificate z′, and the DO releases the z′ to a block chain through the smart contract which is open to all user accounts; S4, rapid data circulation is realized: when the DO releases the data certificate, the DU has been identified, a DU's account ID.sub.DU is set through the access policy, the DU obtains an encryption key for data access by executing a smart contract and a key algorithm, and private data are obtained through metadata and decrypted to obtain a plaintext, comprising the following steps: S411, the smart contract is executed for a DU's account to obtain z′; S412, a request is sent to KaaS through the smart contract to apply for a user secret key (USK); S413, the key algorithm is executed by KaaS, the PSK, the MSK and the DU's account ID.sub.DU are inputted to generate a USK, the USK is encrypted through the public key DU.sub.pub-key of the DU, i.e., USK′=enc (USK,DU.sub.pub-key), and the USK′ is released to a block chain through the smart contract which is only accessible to DU; S414, the smart contract is executed by the DU to obtain the USK′, and the USK is obtained through a private key DU.sub.pri-key of the DU; S415, the data certificate key′ in the z′ is decrypted by the DU through the USK to obtain key=dec_cpabe (key′, PSK, USK); and S416, private data are obtained by the DU through the metadata in the z′ and decrypted through the key to obtain the original data, and data circulation is completed; and S5, the data circulation is confirmed: the DO submits a transaction certificate of data circulation, and confirms that the data circulation is completed.
2. The cloud-side collaborative multi-mode private data circulation method based on a smart contract of claim 1, wherein in the S11, a security coefficient γ and an attribute space U are inputted into the key algorithm and the key algorithm is executed to obtain the PSK and the MSK of the algorithm Setup (γ,policy).fwdarw.(PSK,MSK) wherein elements in U constitute an access policy.
3. The cloud-side collaborative multi-mode private data circulation method based on a smart contract of claim 1, wherein in the S2, the original data are encrypted into the private data by the DO and saved on a cloud side, and an encryption certificate z′ for cloud storage is generated; in the S4, the DU obtains the private data from the cloud side through metadata and decrypts the private data to obtain a plaintext.
4. The cloud-side collaborative multi-mode private data circulation method based on a smart contract of claim 1, wherein in the S414, the obtained USK is saved; in the S412, whether the USK based on the key algorithm is saved is checked in the DU's account, and if not, a request is sent to KaaS through the smart contract to apply for the USK; if present, skip to S415.
5. The cloud-side collaborative multi-mode private data circulation method based on a smart contract of claim 1, wherein in the S12, a supervision committee (SC) is further built, comprising a SC's account ID.sub.SC, a SC's public key SC.sub.pub-key, and a SC's private key SC.sub.pri-key.
6. The cloud-side collaborative multi-mode private data circulation method based on a smart contract of claim 5, wherein the policy=ID.sub.DU∪ID.sub.SC.
7. The cloud-side collaborative multi-mode private data circulation method based on a smart contract of claim 5, wherein broadcasting data circulation is realized in the S4: when the DO releases a data certificate, the DU has not been identified, the DU retrieves the block chain and browses the metadata, a file reading request is published through the smart contract, and data circulation is completed if an authority passes a review after the DO executes the smart contract, comprising the following steps: S421, the DU calls the smart contract, retrieves the block chain and browses the metadata; S422, the DU sends an access request to the DO through the smart contract; S423, the DO submits a policy=((t≥t.sub.start∩t≤t.sub.end∩ID.sub.DU)∪ID.sub.SC) with a time attribute to the block chain through the smart contract, t, t.sub.start and t.sub.end represent a current contract execution time, a circulation cycle starting time and a circulation cycle ending time respectively, the ID.sub.DU represents a DU's account, the ID.sub.SC represents a SC's account, and the smart contract access authority is only open to the SC; S424, the SC executes the smart contract, obtains a policy from the block chain, and verifies the validity of the policy; if the validity fails, the DU is informed, and the process is ended; S425, the DO executes the key algorithm, and the PSK, a file encryption key and an access policy are inputted to generate a data certificate key′=enc_cpabe (key,PSK,plicy) which is open to all accounts; S426, the KaaS executes the key algorithm, and the PSK, the MSK and the access policy are inputted to generate a USK; the USK is encrypted through the public key DU.sub.pub-key of the DU that is USK′=enc (USK, DU.sub.pub-key), and the USK′ is released to a block chain through the smart contract which is only accessible to the DU; S427, the DU executes the smart contract, obtains the USK′, and obtains the USK by decryption through the private key DU.sub.pri-key of the USK′; S428, the DU executes the key algorithm, the PSK, USK and key′ are inputted, an encryption key is obtained through decryption as long as the DU's account satisfies an enabling characteristic in the access policy within an effective time limit, the DU obtains private data through metadata in z′ and decrypts the private data through the key to obtain the original data, and data circulation is completed.
8. The cloud-side collaborative multi-mode private data circulation method based on a smart contract of claim 7, wherein the policy=ID.sub.SC.
9. The cloud-side collaborative multi-mode private data circulation method based on a smart contract of claim 6, wherein data supervision is realized in the S4: SC decrypts and verifies private data corresponding to a transaction time, a private data sharing initiator, a private data receiver and metadata based on the metadata of the block chain because the policy enables the SC's account in all the data circulation processes, comprising the following steps: S431, the SC saves the PSK and MSK, and z′=[metadata, key′] is obtained by retrieving the block chain; S432, decryption is executed based on the USK corresponding to the SC's account to obtain key=dec_cpabe (key, PSK, USK); and S433, the SC performs decryption based on the key and the private data obtained by metadata to obtain the original data.
10. The cloud-side collaborative multi-mode private data circulation method based on a smart contract of claim 7, wherein data supervision is realized in the S4: SC decrypts and verifies private data corresponding to a transaction time, a private data sharing initiator, a private data receiver and metadata based on the metadata of the block chain because the policy enables the SC's account in all the data circulation processes, comprising the following steps: S431, the SC saves the PSK and MSK, and z′=[metadata, key′] is obtained by retrieving the block chain; S432, decryption is executed based on the USK corresponding to the SC's account to obtain key=dec_cpabe (key, PSK, USK); and S433, the SC performs decryption based on the key and the private data obtained by metadata to obtain the original data.
11. The cloud-side collaborative multi-mode private data circulation method based on a smart contract of claim 8, wherein data supervision is realized in the S4: SC decrypts and verifies private data corresponding to a transaction time, a private data sharing initiator, a private data receiver and metadata based on the metadata of the block chain because the policy enables the SC's account in all the data circulation processes, comprising the following steps: S431, the SC saves the PSK and MSK, and z′=[metadata, key′] is obtained by retrieving the block chain; S432, decryption is executed based on the USK corresponding to the SC's account to obtain key=dec_cpabe (key′, PSK, USK); and S433, the SC performs decryption based on the key and the private data obtained by metadata to obtain the original data.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0048]
[0049]
[0050]
DETAILED DESCRIPTION OF THE EMBODIMENTS
[0051] The detailed description of the embodiments of the present invention will be described in detail below in association with the accompanying drawings. It should be understood that the detailed description of the embodiments described herein are only used to describe and interpret, rather than to limit, the present invention.
[0052] The present invention uses the smart contract as an important means of authorized data access. The smart contract is a technology closely coupled with a block chain. Due to the consistency of a block chain state, the smart contract will be executed on all consensus nodes. Therefore, the present invention designs a cloud-side collaborative multi-mode private data circulation method based on a smart contract to realize supervisable circulation between a Data Owner (DO) and a Data User (DU), as shown in
[0053] S1, a system is initialized;
[0054] S11, initialization of a CP_ABE algorithm is completed by building a Key-Policy as a Service (KaaS); the initialization algorithm is a randomized algorithm which is executed on a trusted key distribution center, a security coefficient γ and an attribute space U are inputted into the algorithm, elements in the attribute space U become a policy through “and”, “or” and other operations, and the policy is executed to obtain a PSK and a MSK of the algorithm
[0055] Setup (γ, policy).fwdarw.(PSK,MSK)
[0056] S12, a user account is created for each user, comprising a user account ID, a corresponding public key ID.sub.pub-key and a private key ID.sub.pri-key; a supervision committee (SC) is built, and a SC's public key SC.sub.pub-key and a SC's private key SC.sub.pri-key are allocated.
[0057] S2, the DO saves data on the cloud side by using symmetric encryption and signature, an encryption certificate z′ for cloud storage is generated, and the z′ includes metadata and key information for data encryption.
[0058] S21, the DO applies to Kaas for PSK.
[0059] S22, the DO obtains the data certificate key′ from the PSK and an encryption key, i.e., key′=enc_cpabe (key, PSK, policy), while z′=[metadata,key′].
[0060] S221, the DO generates metadata (including a target file identifier, a storage address URL and a hash, business type and the like) based on the original data, a random number is generated as a file encryption key, the original data of the DO are encrypted by using AES through the encryption key to form a private file, and the private file is stored in a cloud storage space.
[0061] S222, the DO generates an access policy based on a user account ID set by a platform, the policy is composed of the elements in the attribute space U through “and”, “or” and other operations, policy=ID.sub.DU∪ID.sub.SC if it is a rapid mode; policy=ID.sub.SC if it is a broadcasting mode. A key′=enc_cpabe (key,PSK,policy) is generated based on the CP-ABE algorithm, while z′=[metadata,key′]; the encryption algorithm is executed by the DO, the PSK, a message key to be encrypted and the access policy associated with the access policy are inputted into the algorithm to generate a ciphertext key′ based on attribute encryption, and the ciphertext key′ can be decrypted only by a requester who satisfies the access policy.
[0062] S3, the DO calls a smart contract program to realize uplink of the encryption certificate z′, and the DO releases the z′ to a chain through the smart contract which is open to all user accounts. The smart contract is as shown in
[0063] S4, the system realizes three modes of data circulation: rapid data circulation, broadcasting mode, and supervision mode, and the following situations are included.
[0064] S41, rapid data circulation mode: when the DO releases the data certificate, the DU has been identified, a DU's account ID.sub.DU can be set through the access policy, the DU obtains a symmetric key for data access by executing a smart contract and a CP_ABE decryption algorithm, and a private file is obtained from a cloud side and decrypted to obtain a plaintext.
[0065] S411, the smart contract is executed for a DU's account (a process is as shown in
[0066] S412, whether the USK based on CP-ABE is saved is checked in the DU's account, and if not, a request is sent to KaaS through the smart contract to apply for the USK; if present, skip to step S415.
[0067] S413, the CP-ABE key algorithm is executed by the KaaS, the PSK, the MSK and the DU's account ID.sub.DU are inputted to generate a USK; the USK is encrypted through the public key DU.sub.pub-key of the DU, i.e., USK′=enc (USK,DU.sub.pub-key), and the USK′ is released to a block chain through the smart contract which is only accessible to the DU.
[0068] S414, the smart contract is executed by the DU to obtain the USK′, and the USK is obtained and saved by decrypting the private data through the private key DU.sub.pri-key of the USK′.
[0069] S415, the ciphertext key′ in the z′ is decrypted through the USK to obtain key=dec−cpabe (key′, PSK, USK).
[0070] S416, an address of the original data cloud storage is obtained by the DU through z′ metadata, the file is downloaded and decrypted by using AES through the key to obtain a file content, and data circulation is completed.
[0071] S42, broadcasting data circulation mode: when the DO releases a data certificate, the data user has not been identified, the DU judges that the DU is interested in a certain data item when retrieving the block chain and browsing the metadata, and a file reading request is published through the smart contract. If an authority passes a review after the DO executes the smart contract, a process of S42 proceeds, and data circulation is completed.
[0072] S421, when executing a consensus algorithm, the DU calls a smart contract, retrieves a block chain, browses metadata and checks conditions related to a data processing service, and all related nodes of the block chain can verify the correctness of metadata based on the openness of the block chain.
[0073] S422, the DU judges that a certain data item is related to the DU and sends an access request to the DO through the smart contract, wherein the access request includes an identifier name, a hashed value and the like of a target file.
[0074] S423, the DO submits a policy=((t≥t.sub.start∩t≤t.sub.end∩ID.sub.DU)∪ID.sub.SC) with a time attribute to the block chain through the smart contract, t, t.sub.start and t.sub.end represent a current contract execution time, a circulation cycle starting time and a circulation cycle ending time respectively, the ID.sub.DU represents a DU's account, the ID.sub.SC represents a SC's account, and the smart contract access authority is only open to the SC.
[0075] S424, the SC executes the smart contract, obtains an attribute collection policy from a chain, and verifies the validity of the policy, if the validity fails, the DU is informed, and the process is ended.
[0076] S425, the DO executes the CP-ABE encryption algorithm, and the PSK, the file encryption key and the access policy are inputted to generate a ciphertext key′=enc_cpabe (key, PSK, plicy) which is open to all accounts.
[0077] S426, the KaaS executes the CP-ABE key algorithm, and the PSK, the MSK and the policy are inputted to generate a USK; the USK is encrypted through the public key of the DU, i.e., USK′=enc (USK,DU.sub.pub-key), and the USK′ is released to a block chain through the smart contract which is only accessible to DU.
[0078] S427, the DU executes a smart contract to obtain the USK′, and USK is obtained through the private key DU.sub.pri-key of the DU.
[0079] S428, the DU executes the CP-ABE decryption algorithm, the PSK, USK and ciphertext key′ are inputted, a key is obtained through decryption as long as the DU's account satisfies an enabling characteristic in the ciphertext access policy within an effective time limit, metadata are decrypted, and master data related files are obtained.
[0080] S43, data supervision mode: the SC can decrypt a private file corresponding to a transaction time, a private data sharing initiator, a private data receiver and metadata based on the metadata of the block chain because the policy enables the SC's account in all the data circulation processes, and the SC can verify the authenticity and other contents of the private file.
[0081] S431, the SC saves the PSK, MSK and a retrieved block chain to obtain z′=[metadata, key′].
[0082] S432, as the policy in the fast mode and broadcasting mode has been set to a supervision committee enabling policy, decryption can be executed based on the USK corresponding to the SC's account to obtain key=dec_cpabe (key′, PSK, USK).
[0083] S433, the SC's account downloads the private file based on the key and a URL stored in the private file in metadata and decrypts the private file by using AES to obtain plaintext information of the private file.
[0084] S5, private data circulation is confirmed: in the data circulation mode, the DO submits a transaction certificate of data circulation, and confirms that the data circulation is completed; in the data supervision mode, the SC submits a transaction certificate of data circulation, and confirms that the data circulation is completed.
[0085] The above-mentioned embodiments are only used to illustrate, rather than to limit, the technical solution of the present invention. Although the present invention has been described in detail by reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solution recorded in the foregoing embodiments, or make equivalent replacements to some or all of the technical features in the technical solution. These modifications or replacements will not cause the essence of the corresponding technical solution to depart from the scope of the technical solution in the embodiments of the present invention.