Disclosure of Invention
The invention mainly solves the technical problems in the prior art and provides an intelligent contract out-of-chain data access method and system based on content extraction signcryption. The method and the system adopt a certificateless content extraction signcryption technology supporting privacy protection, and the problem of privacy data leakage is solved based on content extraction signcryption, so that privacy protection in a signature process is realized. And elliptic curve encryption and certificateless design are adopted, so that the problems of low signature efficiency and certificatemanagement are solved.
The technical problem of the invention is mainly solved by the following technical scheme:
a certificateless content extraction signcryption method to support privacy protection, comprising:
step 1, a key generation center constructs a finite field by selecting k-bit prime numbers, a circular addition group with the order of prime numbers constructs an elliptic parameter according to the finite field, a master key is randomly selected to calculate a master public key, the key generation center selects a hash function, the master key is stored, public parameters are constructed, partial secret keys of a user are further generated, and a private key and a public key of the user are constructed;
step 2, dividing the original message into a plurality of sub-message blocks, constructing a salt tree, calculating the commitment value of the sub-message blocks by combining the sub-message blocks with the root salt value generated by the salt tree, constructing a commitment binary tree, assigning values to leaf nodes of the commitment binary tree according to the commitment value of the sub-message blocks, and generating the signature of the original message by a signer according to the commitment binary tree;
step 3, extracting the signcryption person to execute a signcryption extraction algorithm, extracting the privacy message and executing signcryption operation;
step 4, the verifier executes the signcryption verification algorithm to return verification information;
preferably, the finite field in step 1 is FpOf order pk;
Step 1, the circular addition group with prime order is selected, and ellipse parameters are constructed according to a finite field as follows:
the key generation center selects a cyclic addition group G with the order of prime p, defining E/FpIs a finite field FpThe above elliptic curve, P is the generator of G, gets { Fp,E/FpG, P }, E represents an elliptic curve, E/FpDefining elliptic curve in finite field FpThe above step (1);
step 1 said randomly selecting master key to calculate master public key is:
key generation center random selection parameters
x is the main key, the main key x is kept secret, and the main public key P is obtained through calculation
pub=xP,
An integer group of an arbitrary order;
step 1, the key generation center selects a hash function as follows:
H
1、H
2、H
3、H
4sequentially represents a first collision-free hash function, a second collision-free hash function, a third collision-free hash function, a fourth collision-free hash function, {0,1}
*Representing a set of combinations of binary sequences of arbitrary bit length,
integer groups of arbitrary order are represented, → representing a set-to-group mapping;
the construction public parameters in the step 1 are as follows:
params={Fp,E/Fp,G,P,H1,H2,H3,H4}
the step 1 of generating the partial secret key of the user is as follows:
user A randomly selects parameters
Calculating P as a secret value
A=x
AP, mixing P
ATo a key generation center, P
AGenerating element for user A;
the key generation center passes through a system master key x and a generation element P of a user AAAnd a common parameter, params ═ Fp,E/Fp,G,P,H1,H2,H3,H4Calculating to obtain a partial secret key D of the user AAThe method comprises the following steps:
key generation center random selection parameters
R
A=r
AP, calculate h
A=H
1(ID
A,R
A,P
A) Wherein ID
AFor the identity of user A in an identity-based cryptographic environment, R
ATo sign a key, P
AGenerating element for user A;
the key generation center calculates sA=(rA+hAx) mod n, mod being modular transportCalculating sAFor the parameters of the partial key of the user A, the partial key D of the user A is generated by combining the signing keyA={sA,RAAnd sending the data to the user A;
step 1, the private key and the public key of the user are constructed as follows:
user A converts the secret value of user A, namely xAAnd a parameter s of a partial key of the user AAConstructing the private Key SK of user AAI.e. SKA=(xA,sA)。
Constructing the public key PK of user AAI.e. PKA=(PA,RA);PAAs a generator of user A, RAA signing key for user a;
preferably, in step 2, the original message is divided into a plurality of sub-message blocks, and the specific method includes:
M={M[1],M[2],…,M[i],…,M[n]}
wherein M is an original message, M [ i ] represents the ith sub-message block, n is the number of the sub-message blocks, and i belongs to [1, n ];
2, inputting a random value to the constructed salt tree, and obtaining a pseudorandom root salt value through a variable-length pseudorandom model to construct the salt tree;
step 2, the commitment value of the sub-message block is calculated by combining the sub-message block with the root salt value generated by the salt tree, and is as follows:
wherein C [ i ] represents the commitment value of the ith sub-message block, C represents a commitment algorithm, and the commitment value about the message block is generated, and the privacy of the message block M [ i ] can be effectively protected by using the commitment algorithm;
the specific way is that the message block M [ i ]]Corresponding and pseudo-random salt values
Binding and generating a commitment character string
The commitment string c relates to the message M [ i ]]Is determined, the message M' is recalculated during the verification process [ i]Promise of (1)
The validity of the signature can be described by verifying whether c ═ c' is true;
M[i]denotes the ith sub-message block, n is the number of sub-message blocks,
in
rIndicates the message name, i
cIndicating the sub-message block name.
Step 2, constructing a commitment binary tree, and assigning values to leaf nodes of the commitment binary tree according to the commitment values of the sub message blocks as follows:
the number of the committed binary tree is L;
the jth node of the kth layer is Vk,j,k∈[1,L],j∈[1,2k-1];
For k-th leaf node, the total number of nodes is 2k-1. Will promise the value c [ i ]]Is given to va[i]I.e. va[i]=c[i];
For k e [1, L-1]Nodes of a layer, every two sibling nodes being subjected to a hash function H2Calculating va=H2(va[i],va[i+1]) All v are obtainedaUntil the final root node value v is obtained0;
Step 2, the signature of the original message generated by the signer according to the commitment binary tree is as follows:
step 2.1, random selection
As a master key of the system, it is,
randomly selecting a prime number P with k bits for an integer group with an arbitrary order, and calculating a parameter R which is l.P and is a generator of G;
step 2.2, calculating parameter H ═ H3(v0,R,PKA);H3Is a third collision-free hash function, v0To commit a binary tree root node value, PKAIs the public key of user A;
step 2.3, judging whether gcd (l + h, n) is 1 or not through a greatest common divisor function, if yes, executing step 2.4, and if not, returning to step 2.1; l is the system master key, h is the hash value generated in step 2.6, and n is the number of message blocks;
step 2.4, calculate s ═ (l + h)-1(xA+sA) mod n; l is the system master key, h is the hash value generated in step 2.2, xAIs the secret value of user A, sAIs a parameter of the partial key of user a.
Step 2.5, by combining the parameters CEAS, R, s, c [ i ]]i∈nConstructing the signature of the original message, outputting the signature sigmaF=(CEAS,R,s,c[i]i∈n);
CEAS is content extraction access control structure, R is generator of G, s is system partial key, c [ i ]]i∈nA set of commitment values for all message blocks;
the signer sends the original message and the signature of the original message to the signer who extracted the signcryption.
Preferably, the extraction of the signature σ of the original message received by the signcryptor in step 3 is performedFThen, calculating a new root node value v according to the method in the step 20At the same time, calculate hA=H1(IDA,RA,PA) And H ═ H3(v0,R,PKA);
IDAFor the identity of user A in an identity-based encrypted environment, PAFor a generator, R, of user AATo sign the key, hAFor A-based identity digest hash values, h is the generated hash value, v0For commitment of a binary tree root node value, R is a generator of G, PKAIs the public key of user A;
further verify the equation s (R + hP) ═ PA+RA+hAPpubWhether it is true or not, if the equality is not trueStopping, otherwise, continuing to execute the following steps:
wherein, M '[ i ] represents the extracted sub-message with the number i, ext (i) represents the set of sub-message blocks i in the original message M contained in the sub-message set M', CEAS is the content extraction access structure, and i is the sub-message block name.
Constructing ext (i) from the content extraction access structure CEAS; CEAS is a content extraction access control structure, ext (i) represents a set of sub-message blocks i in the original message M contained in the sub-message set M';
replacing M { M [1], M [2], …, M ' [ i ], …, M ' [ n ] } by M ═ { M [1], M [2], …, M [ i ], …, M [ n ] }, if i ∈ ext (i), then M ' [ i ] ═ M [ i ], indicating that the sub-message block was extracted; otherwise, M' [ i ] ═ c [ i ]; m '[ i ] represents the extracted sub-message with the number of i, M [ i ] represents the sub-message block with the original number of i, and ext (i) represents a set of sub-message blocks i in the original message M contained in the sub-message set M';
calculation of E
A=l(P
A+R
A+h
AP
pub),
l is the system master key, P
AOne generator, R, for user A
ATo sign the key, h
AAs identity ID based on A
ADigest hash value, P
pubIs the system master public key, E
AFor the encryption key, M' is the set of sub-messages, E is the encryption ciphertext, H
4In order to be a function of the hash function,
is an exclusive or operation;
step 3.4, output and extraction signcryption sigmaEAnd E is an encrypted ciphertext, CEAS is a content extraction access control structure, ext (i) represents a set of sub-message blocks i in an original message M contained in a sub-message set M', R is a generator of G, and s is a system partial key.
Preferably, in step 4, the verifier executing the signcryption verification algorithm returns a verification message that:
the verifier receives the extracted signcryption sigmaEThen, the following operations are performed to verify the signcryption:
step 4.1, judging whether the ext (i) epsilon CEAS is established or not, and if not, terminating the algorithm; otherwise, carrying out the next step; ext (i) represents a set of sub-message blocks i in the original message M contained in a sub-message set M' [ i ], and CEAS is an access control structure for content extraction;
step 4.2, calculate E
B=s(x
A+s
A)(P
A+R
A+ R + h.P), decryption
s is a system partial key, x
AIs the secret value of user A, s
APartial key D for user A
AParameter of (A), P
AFor a generator, R, of user A
AR is a generator of G, h is a hash value generated in the
step 3, and P is a randomly selected prime number;
step 4.3, according to M' [ i ]]And ext (i) recovery v'0The method comprises the following specific steps: first, it is determined whether i ∈ ext (i) is true, and if so, M' [ i ] is restored]A value of (d); otherwise, keeping the original value unchanged; v 'is then calculated'0;M'[i]For the regenerated message, ext (i) represents the set of sub-message blocks i, v 'in the original message M contained in the set of sub-messages M'0A new commitment binary tree root node value is calculated;
step 4.4, calculate hA=H1(IDA,RA,PA) And H is H4(v0',R,PKA) While verifying the equation s (R + hP) ═ PA+RA+hAPpubAnd if the result is positive, the signcryption verification is successful, otherwise, the signcryption verification fails. ID (identity)AFor the identity of user A in an identity-based cryptographic environment, PAFor a generator, R, of user AAFor the signing key, h is the regenerated hash value, v0For commitment of a binary tree root node value, R is a generator of G, PKAIs the public key of user a. h isAAs identity ID based on AADigest hash value, PpubIs the system master public key.
The method has the advantages that the signcryption is extracted based on the content, so that the problem of privacy data leakage is solved, and privacy protection in the signing process is realized; and elliptic curve encryption and certificateless design are adopted, so that the problems of low signature efficiency and certificatemanagement are solved.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
The invention provides a certificateless content extraction signcryption method supporting privacy protection, which comprises the following steps:
step 1, a key generation center constructs a finite field by selecting k-bit prime numbers, a circular addition group with the order of prime numbers constructs an elliptic parameter according to the finite field, a master key is randomly selected to calculate a master public key, the key generation center selects a hash function, the master key is stored, public parameters are constructed, partial secret keys of a user are further generated, and a private key and a public key of the user are constructed;
step 1 the finite field is FpOf order pk;
Step 1, the circular addition group with prime order is selected, and ellipse parameters are constructed according to a finite field as follows:
the key generation center selects a cyclic addition group G with the order of prime p 13, defining E/FpIs a finite field FpThe above elliptic curve, P is the generator of G, gets { Fp,E/FpG, P }, E represents an elliptic curve, E/FpDefining elliptic curve in finite field FpThe above step (1);
step 1 said randomly selecting master key to calculate master public key is:
key generation center random selection parameters
x is the main key, the main key x is kept secret, and the main public key P is obtained through calculation
pub=xP,
An integer group of an arbitrary order;
step 1, the key generation center selects a hash function as follows:
H
1、H
2、H
3、H
4sequentially represents a first collision-free hash function, a second collision-free hash function, a third collision-free hash function, a fourth collision-free hash function, {0,1}
*Representing a set of combinations of binary sequences of arbitrary bit length,
integer groups of arbitrary order are represented, → representing a set-to-group mapping;
the construction public parameters in the step 1 are as follows:
params={Fp,E/Fp,G,P,H1,H2,H3,H4}
the step 1 of generating the partial secret key of the user is as follows:
user A randomly selects parameters
Calculating P as a secret value
A=x
AP, mixing P
ATo a key generation center, P
AGenerating element for user A;
the key generation center passes through a system master key x and a generation element P of a user AAAnd a common parameter, params ═ Fp,E/Fp,G,P,H1,H2,H3,H4Calculating to obtain a partial secret key D of the user AAThe method comprises the following steps:
key generation center random selection parameters
R
A=r
AP, calculate h
A=H
1(ID
A,R
A,P
A) Wherein ID
AFor the identity of user A in an identity-based cryptographic environment, R
ATo sign a key, P
AGenerating element for user A;
the key generation center calculates sA=(rA+hAx) mod 8, mod being a modulo operation, sAFor the parameters of the partial key of the user A, the partial key D of the user A is generated by combining the signing keyA={sA,RAAnd sending the data to the user A;
step 1, the private key and the public key of the user are constructed as follows:
user A converts the secret value of user A, namely xAAnd a parameter of a partial key of the user A, i.e. sAConstructing the private Key SK of user AAI.e. SKA=(xA,sA)。
Constructing the public key PK of user AAI.e. PKA=(PA,RA);PAFor the generator of user A, RAA signing key for user a;
step 2, dividing the original message into 8 sub-message blocks, constructing a salt tree, calculating commitment values of the sub-message blocks by combining root salt values generated by the salt tree, constructing a commitment binary tree, assigning values to leaf nodes of the commitment binary tree according to the commitment values of the sub-message blocks, and generating a signature of the original message by a signer according to the commitment binary tree;
step 2, dividing the original message into a plurality of sub-message blocks, specifically comprising:
M={M[1],M[2],…,M[i],…,M[8]}
wherein M is an original message, M [ i ] represents the ith sub-message block, the number of the sub-message blocks is 8, i belongs to [1, …,8 ];
2, inputting a random value into the salt tree construction, and obtaining a pseudorandom root salt value through a variable-length pseudorandom model to construct a salt tree;
step 2, the commitment value of the sub-message block is calculated by combining the sub-message block with the root salt value generated by the salt tree, and is as follows:
wherein C [ i ] represents the commitment value of the ith sub-message block, C represents a commitment algorithm, and the commitment value about the message block is generated, and the privacy of the message block M [ i ] can be effectively protected by using the commitment algorithm;
the specific way is that the message block M [ i ]]Corresponding and pseudo-random salt values
Binding and generating a commitment character string
The commitment string c relates to the message M [ i ]]Is determined, the message M' is recalculated during the verification process [ i]Promise of (1)
The validity of the signature can be described by verifying whether c ═ c' is true;
M[i]indicating the ith sub-message block, the number of sub-message blocks being 8,
in
rIndicates the message name, i
cIndicating the sub-message block name.
Step 2, constructing a commitment binary tree, and assigning values to leaf nodes of the commitment binary tree according to the commitment values of the sub message blocks as follows:
the number of the committed binary tree is L;
the jth node of the kth layer is Vk,j,k∈[1,L],j∈[1,2k-1];
For the k-th leaf node, the total number of nodes is 2k-1. Will promise value c [ i ]]Is given to va[i]I.e. va[i]=c[i];
For k e [1, L-1]Nodes of a layer, every two sibling nodes being subjected to a hash function H2Calculating va=H2(va[i],va[i+1]) Obtaining all vaUntil the final root node value v is obtained0;
Step 2, the signature of the original message generated by the signer according to the commitment binary tree is as follows:
step 2.1, random selection
As a master key of the system, it is,
randomly selecting a prime number 13 with k bits for an integer group with an arbitrary order, and calculating a parameter R as l.13, wherein R is a generator of G;
step 2.2, calculating parameter H ═ H3(v0,R,PKA);H3Is a third collision-free hash function, v0To commit to a binary tree root node value, PKAIs the public key of user A;
step 2.3, judging whether gcd (l + h,8) is 1 or not through a greatest common divisor function, if yes, executing step 2.4, otherwise, returning to step 2.1; l is the system master key, h is the hash value generated in step 2.6, and n is the number of message blocks;
step 2.4, calculate s ═ (l + h)-1(xA+sA) mod 8; l is the system master key and h is generated in step 2.2Hash value, xAIs the secret value of user A, sAIs a parameter of the partial key of user a.
Step 2.5, by combining the parameters CEAS, R, s, c [ i ]]i∈nConstructing the signature of the original message, outputting the signature sigmaF=(CEAS,R,s,c[i]i∈n);
CEAS is content extraction access control structure, R is generator of G, s is system partial key, c [ i ]]i∈nA set of commitment values for all message blocks;
the signer sends the original message and the signature of the original message to the signer.
Step 3, extracting the signcryption person to execute a signcryption extraction algorithm, extracting the privacy message and executing a signcryption operation;
step 3, extracting the signature sigma of the original message received by the signatoryFThen, calculating a new root node value v according to the method in the step 20At the same time, calculate hA=H1(IDA,RA,PA) And H ═ H3(v0,R,PKA);
IDAFor the identity of user A in an identity-based cryptographic environment, PAFor a generator, R, of user AATo sign the key, hAFor A-based identity digest hash values, h is the generated hash value, v0For commitment of a binary tree root node value, R is a generator of G, PKAA public key for user A;
further verify the equation s (R + h.13) as PA+RA+hAPpubIf the equation is not satisfied, stopping if the equation is not satisfied, otherwise, continuing to execute the following steps:
wherein, M '[ i ] represents the extracted sub-message with the number i, ext (i) represents the set of sub-message blocks i in the original message M contained in the sub-message set M', CEAS is the content extraction access structure, and i is the sub-message block name.
Constructing ext (i) according to a Content Extraction Access Structure (CEAS); CEAS is a content extraction access control structure, ext (i) represents a set of sub-message blocks i in the original message M contained in the sub-message set M';
replacing M { M [1], M [2], …, M ' [ i ], …, M ' [ n ] } by M ═ { M [1], M [2], …, M [ i ], …, M [ n ] }, if i ∈ ext (i), then M ' [ i ] ═ M [ i ], indicating that the sub-message block was extracted; otherwise, M' [ i ] ═ c [ i ]; m '[ i ] represents the extracted sub-message with the number of i, M [ i ] represents the sub-message block with the original number of i, and ext (i) represents a set of sub-message blocks i in the original message M contained in the sub-message set M';
calculation of E
A=l(P
A+R
A+h
AP
pub),
l is the system master key, P
AFor a generator, R, of user A
ATo sign the key, h
AAs identity ID based on A
ADigest hash value, P
pubIs a system master public key, E
AFor the encryption key, M' is the set of sub-messages, E is the encryption ciphertext, H
4In order to be a function of the hash function,
is an exclusive or operation;
step 3.4, output and extraction signcryption sigmaEE, CEAS, ext (i), R, s, E is an encrypted ciphertext, CEAS is a content extraction access control structure, ext (i) represents a set of sub-message blocks i in the original message M included in the sub-message set M', R is a generator of G, and s is a system partial key.
Step 4, the verifier executes the signcryption verification algorithm to return verification information;
step 4, the verifier executes the signcryption verification algorithm and returns a verification message as follows:
the verifier receives the extracted signcryption sigmaEThen, the following operations are performed to verify the signcryption:
step 4.1, judging whether the ext (i) epsilon CEAS is established or not, and if not, terminating the algorithm; otherwise, carrying out the next step; ext (i) represents a set of sub-message blocks i in the original message M contained in a sub-message set M' [ i ], and CEAS is a structure for extracting access control for content;
step 4.2, calculate E
B=s(x
A+s
A)(P
A+R
A+ R + h.p), decryption
s is a system partial key, x
AIs the secret value of user A, s
APartial key D for user A
AParameter of (A), P
AFor a generator, R, of user A
AR is a generator of G, h is a hash value generated in the
step 3, and p is a randomly selected prime number 13;
step 4.3, according to M' [ i ]]And ext (i) recovery v'0The method comprises the following specific steps: first, it is determined whether i ∈ ext (i) is true, and if so, M' [ i ] is restored]A value of (d); otherwise, keeping the original value unchanged; v 'is then calculated'0;M'[i]For the regenerated message, ext (i) represents the set of sub-message blocks i, v 'in the original message M contained in the set of sub-messages M'0A new commitment binary tree root node value is calculated;
step 4.4, calculate hA=H1(IDA,RA,PA) And H ═ H4(v0',R,PKA) While verifying the equation s (R + hp) ═ PA+RA+hAPpubAnd if the result is positive, the signcryption verification is successful, otherwise, the signcryption verification fails. IDAFor the identity of user A in an identity-based encrypted environment, PAFor a generator, R, of user AAFor the signing key, h is the regenerated hash value, v0For commitment of a binary tree root node value, R is a generator of G, PKAIs the public key of user a. h isAAs identity ID based on AADigest hash value, PpubIs the system master public key.
It should be understood that parts of the specification not set forth in detail are well within the prior art.
It should be understood that the above description of the preferred embodiments is illustrative, and not restrictive, and that various changes and modifications may be made therein by those skilled in the art without departing from the scope of the invention as defined in the appended claims.