Disclosure of Invention
The application provides a block chain data controlled sharing method and system based on proxy re-encryption, which solves the problems that in the prior art, the sharing performance of a block chain is limited to preset data users, efficient expansion is difficult to realize, the actual availability is low while privacy protection is realized, and the actual requirement of data sharing cannot be met; meanwhile, when the access right of the block chain data is changed, the data needs to be repeatedly encrypted, so that the calculation amount of a user is increased, and the technical problem of communication overhead of the user is also increased.
In view of the above, a first aspect of the present application provides a method for controlled sharing of blockchain data based on proxy re-encryption, where the method includes:
the first user end of the data owning user initially encrypts the shared data and constructs an initial ciphertext C and a proxy re-encryption key rk after the proxy re-encryption key is constructedA→BUploading the transaction information tx to the blockchain network;
a first user end of the data owning user sends a data access authority authorization list of the shared data to an authorization management node in the block chain network, wherein the data access authorization list comprises a decryption parameter alpha;
and the first user end of the data owning user sends a data access authority authorization list updating request to the authorization management node, so that the authorization management node updates a decryption parameter alpha corresponding to a second user end of a legal data requesting user contained in the data access authority authorization list.
Optionally, the sending, by the first user of the data owning user, a data access right authorization list update request to the authorization management node, so that the updating, by the authorization management node, of the decryption parameter α corresponding to the second user of the legal data requesting user included in the data access right authorization list specifically includes:
and the first user end of the data owning user sends a data access authority authorization list deleting request to the authorization management node, so that the authorization management node deletes the decryption parameter alpha corresponding to the second user end of the legal data requesting user contained in the data access authority authorization list.
Optionally, the sending, by the first user of the data owning user, a data access right authorization list update request to the authorization management node, so that the updating, by the authorization management node, of the decryption parameter α corresponding to the second user of the legal data requesting user included in the data access right authorization list specifically includes:
the numberConstructing a proxy re-encryption key rk for a new legal data requesting user according to a first user terminal owning the userA→CAnd a decryption parameter alpha' in the data access authority authorization list;
the first user end of the data owning user sends a data access authority authorization list updating request to the authorization management node, so that the authorization management node updates the decryption parameter alpha in the data access authority authorization list into a decryption parameter alpha';
the data owning user broadcasts the proxy re-encryption key rk to the blockchain networkA→C。
Optionally, the method further comprises:
if the second user end of the legal data request user sends a data request to the block chain network, the miner node of the block chain network sends the initial ciphertext C in the transaction information tx through the proxy re-encryption key rkA→BCarrying out re-encryption to generate a re-encrypted ciphertext C';
the miner node sends the re-encrypted ciphertext C' to the legal data request user;
the authorization management node sends the decryption parameter alpha to a second user end of the legal data request user;
and the second user end of the legal data request user decrypts the re-encrypted ciphertext C' by using a user private key and the decryption parameter alpha to obtain the shared data.
Optionally, the first user side of the data owning user initially encrypts the shared data and constructs an initial ciphertext C and a proxy re-encryption key rk after the proxy re-encryption key is constructedA→BThe uploading of the transaction information tx to the blockchain network specifically includes:
the first user end of the data owning user passes through a user private key pkACarrying out initial encryption on the shared data to obtain an initial ciphertext C, wherein C is (C)1,C2,C3,C4);
The first user end of the data owning user constructs the proxy weight aiming at the legal data requesting userEncryption key rkA→BAnd a decryption parameter alpha in the data access authority authorization list;
the first user end of the data owning user is added with the initial ciphertext C and the proxy re-encryption key rkA→BThe transaction information tx is uploaded to a block chain network, so that a miner node in the block chain network verifies the transaction information tx and then adds the transaction information tx into a block chain account book.
A second aspect of the present application provides a blockchain data controlled system based on proxy re-encryption, the system including:
the system comprises a first user terminal belonging to a data owning user and a block chain network, wherein the block chain network comprises an authorization management node and a miner node;
wherein:
the first user end of the data owning user initially encrypts the shared data and constructs an initial ciphertext C and a proxy re-encryption key rk after the proxy re-encryption key is constructedA→BUploading the transaction information tx to the blockchain network;
a first user end of the data owning user sends a data access authority authorization list of the shared data to an authorization management node in the block chain network, wherein the data access authorization list comprises a decryption parameter alpha;
and the first user end of the data owning user sends a data access authority authorization list updating request to the authorization management node, so that the authorization management node updates a decryption parameter alpha corresponding to a second user end of a legal data requesting user contained in the data access authority authorization list.
Optionally, the sending, by the first user of the data owning user, a data access right authorization list update request to the authorization management node, so that the updating, by the authorization management node, of the decryption parameter α corresponding to the second user of the legal data requesting user included in the data access right authorization list specifically includes:
and the first user end of the data owning user sends a data access authority authorization list deleting request to the authorization management node, so that the authorization management node deletes the decryption parameter alpha corresponding to the second user end of the legal data requesting user contained in the data access authority authorization list.
Optionally, the sending, by the first user of the data owning user, a data access right authorization list update request to the authorization management node, so that the updating, by the authorization management node, of the decryption parameter α corresponding to the second user of the legal data requesting user included in the data access right authorization list specifically includes:
the first user end of the data owning user constructs a proxy re-encryption key rk aiming at a new legal data requesting userA→CAnd a decryption parameter alpha' in the data access authority authorization list;
the first user end of the data owning user sends a data access authority authorization list updating request to the authorization management node, so that the authorization management node updates the decryption parameter alpha in the data access authority authorization list into a decryption parameter alpha';
the data owning user broadcasts the proxy re-encryption key rk to the blockchain networkA→C。
Optionally, the system further comprises a second user terminal belonging to the legal data requesting user;
wherein:
if the second user end of the legal data request user sends a data request to the block chain network, the miner node of the block chain network sends the initial ciphertext C in the transaction information tx through the proxy re-encryption key rkA→BCarrying out re-encryption to generate a re-encrypted ciphertext C';
the miner node sends the re-encrypted ciphertext C' to the legal data request user;
the authorization management node sends the decryption parameter alpha to a second user end of the legal data request user;
and the second user end of the legal data request user decrypts the re-encrypted ciphertext C' by using a user private key and the decryption parameter alpha to obtain the shared data.
Optionally, the first user side of the data owning user initially encrypts the shared data and constructs an initial ciphertext C and a proxy re-encryption key rk after the proxy re-encryption key is constructedA→BThe uploading of the transaction information tx to the blockchain network specifically includes:
the first user end of the data owning user passes through a user private key pkACarrying out initial encryption on the shared data to obtain an initial ciphertext C, wherein C is (C)1,C2,C3,C4);
The first user end of the data owning user constructs a proxy re-encryption key rk aiming at a legal data requesting userA→BAnd a decryption parameter alpha in the data access authority authorization list;
the first user end of the data owning user is added with the initial ciphertext C and the proxy re-encryption key rkA→BThe transaction information tx is uploaded to a block chain network, so that a miner node in the block chain network verifies the transaction information tx and then adds the transaction information tx into a block chain account book.
According to the technical scheme, the embodiment of the application has the following advantages:
the application provides a block chain data controlled sharing method based on proxy re-encryption, wherein a data owner user initially encrypts shared data and constructs a proxy re-encryption key, uploads transaction information of the shared data to a block chain network, and simultaneously sends a data access authority authorization list of the shared data to an authorization management node in the block chain network, so that the data owner user can divide and manage decryption parameters of the re-encryption key by a work proxy in the block chain network through updating the data access authority authorization list, dynamically adjusts access authorities of other users to the shared data, solves the problem that the sharability of a block chain in the prior art is limited to a preset data user, is difficult to realize efficient expansion, has lower actual availability while realizing privacy protection, and cannot meet the actual requirement of data sharing; meanwhile, when the access right of the block chain data is changed, the data needs to be repeatedly encrypted, so that the calculation amount of a user is increased, and the technical problem of communication overhead of the user is also increased.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The application designs a block chain data controlled sharing method and system based on proxy re-encryption, and solves the problems that in the prior art, the sharing performance of a block chain is limited to preset data users, efficient expansion is difficult to realize, the actual usability is low while privacy protection is realized, and the actual requirement of data sharing cannot be met; meanwhile, when the access right of the block chain data is changed, the data needs to be repeatedly encrypted, so that the calculation amount of a user is increased, and the technical problem of communication overhead of the user is also increased.
For convenience of understanding, please refer to fig. 1 to 2, in which fig. 1 is a flowchart of a method for block chain data controlled sharing based on proxy re-encryption according to an embodiment of the present application, and fig. 2 is a flowchart of an improved proxy re-encryption algorithm according to an embodiment of the present application, and as shown in fig. 1 and 2, specifically, the method includes:
101. the first user end of the data owning user initially encrypts the shared data and constructs an initial ciphertext C and a proxy re-encryption key rk after the proxy re-encryption key is constructedA→BUploading the transaction information tx to the blockchain network;
it should be noted that, if the data owning user wants to publish the shared data in the blockchain network, it is first necessary to initially encrypt the shared data, construct a corresponding proxy re-encryption key, and encrypt the initial ciphertext C and the proxy re-encryption key rkA→BThe specific mode of uploading the transaction information tx to the block chain network is as follows:
the first user end of the data owning user passes the private key pk of the userACarrying out initial encryption on the shared data to obtain an initial ciphertext C, wherein C is (C)1,C2,C3,C4);
The first user end of the data owning user constructs a proxy re-encryption key rk aiming at a legal data requesting userA→BAnd a decryption parameter alpha in the data access authority authorization list;
the first user end of the data owning user is added with an initial ciphertext C and a proxy re-encryption key rkA→BThe transaction information tx is uploaded to the block chain network, so that a miner node in the block chain network verifies the transaction information tx and then adds the transaction information into a block chain account book.
In the encryption process, the specific execution process of the proxy re-encryption algorithm constructed based on the SM2 encryption algorithm is as follows:
1) setup (κ) → pp: the initialization algorithm outputs the public parameter pp by inputting the security parameter k.
And giving a security parameter kappa to obtain prime numbers p, q, E and G of the kappa bit. p represents the size of the finite field, E represents the size of the finite field defined in the finite field FpDefining p as a point on the elliptic curve E, and using the point as a generator of a group G, wherein G is a q-order cyclic group. Defining a set of hash functions H1,H2,H3,H4In which H is1:{0,1}*→{0,1}l,H2:G→Zq *,H3:{0,1}*→G,H4:{0,1}*→ G. The hash function may use secure cryptographic algorithm SM3, and the published system public parameter pp is { P, q, E, G, P, H1,H2,H3,H4}。
2)KeyGen(pp)→(skA,pkA): the key generation algorithm outputs the public and private key pair of the user by inputting the system public parameter pp.
Inputting the system public parameter pp, and selecting a random number x ∈ Zq *Private key skAX, public key pkA=xP。
3)Encrypt(M,pkA) → C: the initial encryption algorithm is realized by inputting a plaintext M and a data owner public key pkAAnd outputting an initial ciphertext C.
The data owner uses its own public key pkAEncrypting a plaintext M, wherein the length of M is l, i belongs to G randomly selected, and the encryption operation is as follows:
r=H2(i);
C1=rP=(x0,y0);
rpkA=(xA,yA);
t=H1(xA||yA);
C3=H3(xA||M||yA);
C4=H4(M||C1||C3);
ciphertext C ═ C1,C2,C3,C4);
The data user can use its own private key skAThe initial ciphertext C is decrypted, calculated as follows:
S=skAC1=(xA||yA);
t=H1(xA||yA);
C3'=H3(xA||M||yA);
if C3'=C3And obtaining a data plaintext M.
4)RekeyPara(r,pkA,pkB) → β: the proxy re-encryption key parameter generation algorithm: by inputting r, the data owner public key pkAAnd a public key pk of the data userBAnd outputting the proxy re-encryption key parameter beta.
β={rpkA,rpkB};
5)RekeyGen(α,β)→rkA→B: the agent re-encryption key generation algorithm outputs an agent re-encryption key rk by inputting an encryption parameter alpha and an agent re-encryption key parameter betaA→B。
102. A first user end of a data owning user sends a data access authority authorization list of shared data to an authorization management node in a block chain network, wherein the data access authorization list comprises a decryption parameter alpha;
it should be noted that the authorized management node in the blockchain network is selected through the blockchain consensus mechanism, and is used to complete registration of the node, distribution of the key, and management of the data access right. Therefore, the data owning user needs to send a data access authority authorization list of the shared data to the authorization management node, wherein the data access authority authorization list is provided with the decryption parameter alpha aiming at the legal data requesting user.
103. And the first user end of the data owning user sends a data access authority authorization list updating request to the authorization management node, so that the authorization management node updates the decryption parameter alpha corresponding to the second user end of the legal data requesting user contained in the data access authority authorization list.
It should be noted that, if the data owning user wants to update the legal data requesting user for the shared data, the data owning user needs to interact with the authorization management node to manage the data access authority list, so as to update the shared data access authority in the blockchain.
The updating mode may include:
the first user end of the data owning user sends a data access authority authorization list deleting request to the authorization management node, so that the authorization management node deletes the decryption parameter alpha corresponding to the second user end of the legal data requesting user contained in the data access authority authorization list.
It should be noted that, if the data owning user only wants to delete the access right of a legal data requesting user to the shared data, it only needs to send a data access right authorization list deletion request to the authorization management node, and delete the decryption parameter α corresponding to the original legal data requesting user in the data access right authorization list managed by the authorization management node for the shared data.
The updating method may further include:
the first user end of the data owning user constructs a proxy re-encryption key rk aiming at a new legal data requesting userA→CAnd a decryption parameter alpha' in the data access authority authorization list;
a first user end of a data owning user sends a data access authority authorization list updating request to an authorization management node, so that the authorization management node updates a decryption parameter alpha in the data access authority authorization list into a decryption parameter alpha';
data-owning user broadcasts proxy re-encryption key rk to blockchain networkA→C。
It should be noted that, if the data owning user needs to authorize the shared data to the new legal data requesting user, the proxy re-encryption key rk needs to be reconstructed for the legal data requesting userA→CAnd a decryption parameter alpha' in the authorization list of data access rights, broadcasting a new proxy re-encryption key rk in the blockchain networkA→CMeanwhile, a data access authority authorization list updating request is sent to the authorization management node, so that the authorization management node updates the decryption parameter alpha in the data access authority authorization list into a decryption parameter alpha', and visibility of shared data is improvedAnd (5) adjusting the state.
Further, still include:
if the second user end of the legal data request user sends a data request to the block chain network, the miner node of the block chain network encrypts the initial ciphertext C in the transaction information tx through the proxy re-encryption key rkA→BCarrying out re-encryption to generate a re-encrypted ciphertext C';
the miner node sends a re-encrypted ciphertext C' to a legal data request user;
the authorization management node sends a decryption parameter alpha to a second user end of a legal data request user;
and the second user end of the legal data request user decrypts the re-encrypted ciphertext C' by the user private key and the decryption parameter alpha to obtain the shared data.
It should be noted that, if a legal data request user wants to obtain shared data, after sending a data request to the blockchain network, a miner node in the blockchain network re-encrypts the initial ciphertext C in the transaction information tx through the proxy re-encryption key rkA→BCarrying out re-encryption to generate a re-encrypted ciphertext C', and the specific mode is as follows:
ReEncrypt(C,rkA→B) → C': the proxy re-encryption algorithm inputs an initial ciphertext C and a proxy re-encryption key rkA→BAnd outputs the re-encrypted ciphertext C'.
The proxy re-encryption for the initial ciphertext C is computed as follows:
C1'=C1;
C3'=C3;
C4'=C4;
re-encrypted ciphertext C ═ (C)1',C2',C3',C4')。
The legal data request user respectively receives the re-encrypted ciphertext C' sent by the miner node and the decryption parameter alpha sent by the authorization management nodeOver-user private key skBAnd decrypting the re-encrypted ciphertext C' by the decryption parameter alpha to obtain shared data, which specifically comprises the following steps:
calculating k as H4(M'||C1'||C3');
If k is ═ C4'if M is equal to M', legal data requests the user to obtain the plaintext M of the shared data.
Referring to fig. 3, fig. 3 is a system model diagram of a blockchain data controlled sharing system based on proxy re-encryption according to an embodiment of the present invention, as shown in fig. 3, including:
the system comprises a first user terminal belonging to a data owning user and a block chain network, wherein the block chain network comprises an authorization management node and a miner node;
wherein:
the first user end of the data owning user initially encrypts the shared data and constructs an initial ciphertext C and a proxy re-encryption key rk after the proxy re-encryption key is constructedA→BUploading the transaction information tx to the blockchain network;
a first user end of a data owning user sends a data access authority authorization list of shared data to an authorization management node in a block chain network, wherein the data access authorization list comprises a decryption parameter alpha;
and the first user end of the data owning user sends a data access authority authorization list updating request to the authorization management node, so that the authorization management node updates the decryption parameter alpha corresponding to the second user end of the legal data requesting user contained in the data access authority authorization list.
Further, the first user side of the data owning user sends a data access authority authorization list updating request to the authorization management node, so that the step of updating, by the authorization management node, the decryption parameter α corresponding to the second user side of the legal data requesting user included in the data access authority authorization list specifically includes:
the first user end of the data owning user sends a data access authority authorization list deleting request to the authorization management node, so that the authorization management node deletes the decryption parameter alpha corresponding to the second user end of the legal data requesting user contained in the data access authority authorization list.
Further, the first user side of the data owning user sends a data access authority authorization list updating request to the authorization management node, so that the step of updating, by the authorization management node, the decryption parameter α corresponding to the second user side of the legal data requesting user included in the data access authority authorization list specifically includes:
the first user end of the data owning user constructs a proxy re-encryption key rk aiming at a new legal data requesting userA→CAnd a decryption parameter alpha' in the data access authority authorization list;
a first user end of a data owning user sends a data access authority authorization list updating request to an authorization management node, so that the authorization management node updates a decryption parameter alpha in the data access authority authorization list into a decryption parameter alpha';
data-owning user broadcasts proxy re-encryption key rk to blockchain networkA→C。
Further, the system also comprises a second user terminal belonging to a legal data request user;
wherein:
if the second user end of the legal data request user sends a data request to the block chain network, the miner node of the block chain network encrypts the initial ciphertext C in the transaction information tx through the proxy re-encryption key rkA→BCarrying out re-encryption to generate a re-encrypted ciphertext C';
the miner node sends a re-encrypted ciphertext C' to a legal data request user;
the authorization management node sends a decryption parameter alpha to a second user end of a legal data request user;
and the second user end of the legal data request user decrypts the re-encrypted ciphertext C' by the user private key and the decryption parameter alpha to obtain the shared data.
Further, the first client of the data owning client will be paired with the shared numberAccording to the initial cipher text C after the initial encryption and the construction of the proxy re-encryption key and the proxy re-encryption key rkA→BThe uploading of the transaction information tx to the blockchain network specifically includes:
the first user end of the data owning user passes the private key pk of the userACarrying out initial encryption on the shared data to obtain an initial ciphertext C, wherein C is (C)1,C2,C3,C4);
The first user end of the data owning user constructs a proxy re-encryption key rk aiming at a legal data requesting userA→BAnd a decryption parameter alpha in the data access authority authorization list;
the first user end of the data owning user is added with an initial ciphertext C and a proxy re-encryption key rkA→BThe transaction information tx is uploaded to the block chain network, so that a miner node in the block chain network verifies the transaction information tx and then adds the transaction information into a block chain account book.
In the embodiment of the application, a block chain data controlled sharing method based on proxy re-encryption is provided, a data owner user carries out initial encryption on shared data and constructs a proxy re-encryption key, transaction information of the shared data is uploaded to a block chain network, meanwhile, sending a data access authority list of the shared data to an authorization management node in the block chain network, the data owning user can dynamically adjust the access authority of other users to the shared data by updating the data access authority authorization list, the node division agent in the block chain network and the division management of the decryption parameters of the re-encryption key, thereby solving the problems that the sharability of the block chain in the prior art is limited to the preset data user and the high-efficiency expansion is difficult to realize, the actual usability is low while privacy protection is realized, and the actual requirement of data sharing cannot be met; meanwhile, when the access right of the block chain data is changed, the data needs to be repeatedly encrypted, so that the calculation amount of a user is increased, and the technical problem of communication overhead of the user is also increased.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The terms "first," "second," "third," "fourth," and the like in the description of the application and the above-described figures, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.