Disclosure of Invention
The embodiment of the invention provides a key recovery device and a key recovery method for a UOV signature, which can quickly recover a key and find the security problem of the UOV signature, thereby providing technical support for protecting the UOV.
The embodiment of the invention provides a key recovery device for UOV signature, which comprises:
the message and signature module is used for generating N pairs of message signatures based on a UOV signature algorithm; wherein N is a positive integer greater than 2000;
the power consumption curve module is used for acquiring power consumption curves generated in the generation process of each pair of message signature pairs to obtain N power consumption curves;
the key operation module is used for sequentially selecting calculation formulas in which all keys participate in the UOV signature generation process;
a key guess value module for selecting GF (2) in turnk) As guesses of the key in each chosen calculation formula; and the number of the first and second groups,
and the central processing module is used for calling the message and signature module, the power consumption curve module, the key operation module and the key guess value module, acquiring the input values of the calculation formula and performing operation according to the messages in the N pairs of message signatures in sequence when each guess value is selected to obtain N output values, and analyzing the N power consumption curves to obtain the keys in the UOV signature algorithm based on the N input values and the N output values corresponding to each guess value.
Further, the key comprises a plurality of elements; choosing GF (2) in sequencek) As the keyA guess value for each element in (a);
the central processing module comprises a controller and a processor;
the controller is used for calling the message and signature module, the power consumption curve module, the key operation module and the key guess value module;
the processor is used for calculating the Hamming distance between each input value and the corresponding output value after selecting a guess value for each element in the key for operation, and obtaining N Hamming distances corresponding to each guess value; the N Hamming distances correspond to the N power consumption curves one by one;
the controller is further used for grouping the N power consumption curves according to the Hamming distance, so that the power consumption curves with the Hamming distance larger than a preset value are in a first group, and the power consumption curves with the Hamming distance smaller than the preset value are in a second group;
the processor is also used for carrying out differential operation on the two groups of power consumption curves to obtain a curve of each guessed value;
the controller is further configured to use the maximum amplitude of each curve as an extreme value of the curve, obtain an extreme value of the curve for each guess value, use a guess value corresponding to the curve with the maximum extreme value as the element in the key, and further obtain all elements in the key to obtain the key in the calculation formula.
Further, the calculation formula of the difference operation is as follows:
wherein, Delta is a curve of guessed values,t
iis the ith power consumption curve, T
0Is a first set of power consumption curves, T
1Is a second set of power consumption curves, | T
0L is the number of the first set of power consumption curves, | T
1L is the number of the second set of power consumption curves,
k is a positive integer, which is the hamming distance between the ith input value D and the ith output value R.
Further, the calculation formula of all key participation in the UOV signature generation process is
Where D is the input value, E is the key, R is the output value, □ is the addition or multiplication, D, E and R are both GF (2)
k) The composition of elements (A) and (B).
Further, the UOV signature algorithm includes a first affine transformation calculation formula
y is the message in the message signature pair,
as a result after the y affine transformation, a is a matrix of m × m, b is a vector of length m;
the first affine transformation calculation formula comprises a first calculation formula aij′=aij×yiAnd a second calculation formula bi′=aij′+bi,0≤i≤m-1,0≤j≤n-1;
Wherein in the first calculation formula, yiIs input with a value D, aijIs a secret key E, aij' is the output value R; in the second calculation formula, aijIs an input value D, biIs a secret key E, bi' is the output value R.
Further, the key recovery device for UOV signature further comprises a random variable control module;
the random variable control module is used for fixing random variables in the UOV signature generation process;
the controller is also used for calling the random variable control module.
Further, the UOV signature algorithm includes a central mapping calculation formula
Is composed of
The result after the inverse transformation of the center map,
the O and the V are two types of variables;
the center map calculation formula includes a plurality of multivariate equations:
the multiple multivariate equations are divided into a first layer of calculation formula V
j′=α
ijV
jThe second layer calculation formula V ″)
j=V
j′+δ
iThird layer of calculation formula V
i′=β
ijV
iFourth layer calculation formula V
i″=γ
iV
iAnd the fifth calculation formula
Wherein, in the first layer of calculation formula, V
jIs fixed to a preset value as an input value D, alpha by the random variable control module
ijAs keys E, V
j' is the output value R; in the second layer of calculation formula, V
jIs an input value D, delta
iIs the key E, V ″)
jIs an output value R; in the third layer of calculation formula, V
iBy said random variablesThe control module is fixed to a preset value as an input value D, beta
ijAs keys E, V
i' is the output value R; in the fourth layer of calculation formula, V
iIs fixed to a preset value as an input value D, gamma by the random variable control module
iAs keys E, V
i"is the output value R; in the fifth-level calculation formula,
to input a value D, η is a secret key E,
is the output value R.
Further, the UOV signature algorithm includes a second affine transformation calculation formula
x is
As a result after affine transformation, C is a matrix of n × n, d is a vector of length n;
the second affine transformation calculation formula includes a third calculation formula
And a fourth calculation formula d
i′=c
ij′+d
i;
Wherein, in the third calculation formula,
as input values D, c
ijIs a secret key E, c
ij' is the output value R; in the fourth calculation formula, c
ijIs an input value D, D
iIs a secret key E, d
i' is the output value R.
Correspondingly, an embodiment of the present invention further provides a key recovery method for UOV signatures, including:
generating N pairs of message signatures based on a UOV signature algorithm; wherein N is a positive integer greater than 2000;
acquiring power consumption curves generated in the generation process of each pair of message signature pairs to obtain N power consumption curves;
sequentially selecting calculation formulas in which all keys participate in the UOV signature generation process;
choosing GF (2) in sequencek) As guesses of the key in each chosen calculation formula;
and when each guess value is selected, sequentially obtaining the input values of the calculation formula according to the messages in the N pairs of message signatures and carrying out operation to obtain N output values, and analyzing the N power consumption curves based on the N input values and the N output values corresponding to each guess value to obtain the key in the UOV signature algorithm.
The embodiment of the invention has the following beneficial effects:
the key recovery device and method for UOV signature provided by the embodiment of the invention can generate a message signature pair and a corresponding power consumption curve, operate the UOV signature algorithm by adopting a mode of setting a key guess value, analyze the power consumption curve based on an operation result and obtain a real key, thereby realizing the quick recovery of the key in the UOV signature algorithm, finding the security problem of the UOV signature and providing technical support for protecting the UOV.
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 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 invention.
Referring to fig. 1, a schematic structural diagram of an embodiment of a UOV signed key recovery apparatus provided in the present invention includes:
the message and signature module 1 is used for generating N pairs of message signatures based on a UOV signature algorithm; wherein N is a positive integer greater than 2000;
the power consumption curve module 2 is used for collecting power consumption curves generated in the generation process of each pair of message signature pairs to obtain N power consumption curves;
the key operation module 3 is used for sequentially selecting calculation formulas in which all keys participate in the UOV signature generation process;
a key guess value module 4 for selecting GF (2) in turnk) As guesses of the key in each chosen calculation formula; and the number of the first and second groups,
and the central processing module 5 is configured to invoke the message and signature module, the power consumption curve module, the key operation module and the key guess value module, and when each guess value is selected, sequentially obtain input values of the calculation formula according to the messages in the N pairs of message signatures and perform operation to obtain N output values, and analyze the N power consumption curves based on the N input values and the N output values corresponding to each guess value to obtain a key in the UOV signature algorithm.
It should be noted that the message in the message signature pair is the message y of the UOV signature algorithm0,y1,...,ym-1The size is m bytes, y0,y1,...,ym-1Are all finite fields GF (2)k) K is a positive integer; the signature in the message signature pair is x0,x1,...,xn-1Size is n bytes, x0,x1,...,xn-1Are all finite fields GF (2)k) Of (2) is used. When a pair of message signature pairs is generated, a power consumption curve is correspondingly generated, so that N pairs of message signature pairs correspond to N power consumption curves one by one. Wherein each power consumption curve contains the power consumption generated at each time point during the generation of a single signature.
The central processing module is respectively connected with the message andthe signature module, the power consumption curve module, the key operation module and the key guess value module are connected with each other. The central processing module is used for scheduling and controlling the modules connected with the central processing module, and processing the operation in the UOV key recovery process. The message and signature module is used for generating N pairs of message signatures for the keys to be analyzed. And the key operation module is used for selecting finite field addition, multiplication and inverse operation of the key participating in the UOV signature generation. The key guess module consists of a finite field GF (2)k) All elements make up, i.e. (00.. 00)2To (11.. 11)2。
During the analysis, the key is guessed first, and the range is GF (2)k) All elements, i.e. GF (2) in turnk) The element(s) in (b) is used as a guess value for the key, and simultaneously, N input values are obtained according to N messages in the N pairs of message signatures. And based on each guess value, sequentially substituting the N input values into a calculation formula to carry out operation to obtain N output values, namely, each guess value corresponds to the N input values, the N output values and the N power consumption curves, and the N input values, the N output values and the N power consumption curves are in one-to-one correspondence. For each guess value, the Hamming distances between the N input values and the corresponding output values are respectively calculated, so that N Hamming distances are obtained, and the N Hamming distances correspond to the N power consumption curves one by one. And analyzing the N power consumption curves based on the N Hamming distances to obtain an analysis result of each guess value, and determining a true value of the key according to the analysis results of all the guess values.
Further, the key comprises a plurality of elements; choosing GF (2) in sequencek) As a guess value for each element in the key;
the central processing module comprises a controller and a processor;
the controller is used for calling the message and signature module, the power consumption curve module, the key operation module and the key guess value module;
the processor is used for calculating the Hamming distance between each input value and the corresponding output value after selecting a guess value for each element in the key for operation, and obtaining N Hamming distances corresponding to each guess value; the N Hamming distances correspond to the N power consumption curves one by one;
the controller is further used for grouping the N power consumption curves according to the Hamming distance, so that the power consumption curves with the Hamming distance larger than a preset value are in a first group, and the power consumption curves with the Hamming distance smaller than the preset value are in a second group;
the processor is also used for carrying out differential operation on the two groups of power consumption curves to obtain a curve of each guessed value;
the controller is further configured to use the maximum amplitude of each curve as an extreme value of the curve, obtain an extreme value of the curve for each guess value, use a guess value corresponding to the curve with the maximum extreme value as the element in the key, and further obtain all elements in the key to obtain the key in the calculation formula.
It should be noted that the controller is used for scheduling and controlling the modules connected to the central processing module, and the processor is used for processing the operation in the UOV key recovery process.
Further, the calculation formula of the difference operation is as follows:
where Δ is the curve of the guess, t
iIs the ith power consumption curve, T
0Is a first set of power consumption curves, T
1Is a second set of power consumption curves, | T
0L is the number of the first set of power consumption curves, | T
1L is the number of the second set of power consumption curves,
k is a positive integer, which is the hamming distance between the ith input value D and the ith output value R.
In specific application, the controller calls the message and signature module to generate N message signature pairs, calls the power consumption curve module to generate N corresponding power consumption curves, and calls the key operation module to sequentially select a calculation formula in which all keys participate in the UOV signature generation process.
The key in the calculation formula generally comprises a plurality of elements, and each element needs to be guessed and determined respectively. When analyzing a certain element in the key, the controller calls the key guess value module to select GF (2)k) The element in (1) is used as a guess value of the element in the key, and when each guess value is selected, the processor calculates N output values in one-to-one correspondence based on the N input values and based on the Hamming distance between the input value and the corresponding output value. The controller divides the N power consumption curves into two groups, namely when the Hamming distance between one input value and the corresponding output value is smaller than a preset value, the power consumption curves corresponding to the input value are divided into a first group; and when the Hamming distance between one input value and the corresponding output value is larger than or equal to a preset value, dividing the power consumption curve corresponding to the input value into a second group. The processor calculates the curve of the selected guessed value according to the two groups of power consumption curves, and the controller obtains the maximum absolute value, namely the maximum amplitude value, of the curve. After each guess value is selected in turn, the controller obtains the maximum amplitude of the curve of all guess values by maxiMarking the maximum amplitude of the curve of the ith guess to obtain a set (max)0,max1,..) to select the maximum value max in the setjThen the maximum value maxjThe guess value corresponding to the curve of (a) is used as the true value of the element in the key. By analogy, the true values of other elements in the key are obtained by the method, and then the true values of all the elements in the key are obtained, namely the key is obtained.
Further, the calculation formula of all key participation in the UOV signature generation process is
Where D is the input value, E is the key, R is the output value,
for addition or multiplication, both D, E and R are GF (2)
k) The composition of elements (A) and (B).
It should be noted that, in the UOV signature algorithm, the length of the hash of the message to be signed is m bytes, and the length of the signed message is n bytes. The private key comprises a reversible affine transformation and a central mapping transformation, and the public key is a combination of the central mapping transformation and the reversible affine transformation. Inverse reversible affine transformation L
-1In the form of
A is a matrix of size n x n, b is a vector of dimension n, and both A and b operate as private keys. The center mapping transformation F consists of m multivariate polynomials (F)
0,f
1,...,f
m-1) Is in the form of
Is a finite set of vinegar and oil variables:
is a finite set of vinegar variables, having a total of n-m vinegar variables, used as a private key;
is a finite set of oil variables, for a total of m oil variables. Multivariable polynomial f of multiple degree
0,f
1,...,f
m-1Is defined as f (O)
0,O
1,...,O
m-1)=∑α
ijO
iV
j+∑β
ijV
iV
j+∑γ
iV
i+∑δ
iO
i+η。O
i,(V
i,V
j) Respectively oil variable and vinegar variable, alpha
ij、β
ij、γ
i、δ
iAnd η is the coefficient of a multivariate quadratic polynomial and is used as a key.
For example, the message is 28 bytes in length and the signature is 56 bytes in length. UOV operates in the finite field GF (2)
8). A is a matrix of size 56 x 56, b is a vector of dimension 56, and both a and b operate as private keys. The center mapping transformation F consists of 28 multivariate polynomials (F)
0,f
1,...,f
27) Is in the form of
Is a finite set of vinegar and oil variables:
is a finite set of vinegar variables, for a total of 28 vinegar variables, used as private keys;
is a finite set of oil variables, for a total of 28 oil variables. Multivariable polynomial f of multiple degree
0,f
1,...,f
27Is defined as f (O)
0,O
1,...,O
27)=∑α
ijO
iV
j+∑β
ijV
iV
j+∑γ
iV
i+∑δ
iO
i+η。O
i,(V
i,V
j) Respectively oil variable and vinegar variable, alpha
ij、β
ij、γ
i、δ
iAnd η is the coefficient of a multivariate quadratic polynomial and is used as a key.
Further, the UOV signature algorithm includes a first affine transformation calculation formula
y is the message in the message signature pair,
as a result after the y affine transformation, a is a matrix of m × m, b is a vector of length m;
the first affine transformation calculation formula comprises a first calculation formula aij′=aij×yiAnd a second calculation formula bi′=aij′+bi,0≤i≤m-1,0≤j≤n-1;
Wherein in the first calculation formula, yiIs input with a value D, aijIs a secret key E, aij' is the output value R; in the second calculation formula, aijIs an input value D, biIs a secret key E, bi' is the output value R.
In the first calculation formula, a
ijIs an element of Key A, row i, column j, y
iIs the i-th element, a, of the message y
ij' are finite field multiplication results, all finite field GF (2)
k) Of (2) is used. Let D be y
i,R=a
ij′,E=a
ijStarting to guess the key, the range is GF (2)
k) All the elements. Since E is the guess value (known) of the key and D is an element (known) of the message, R is obtained by R ═ E × D calculation, based on
Key a is analyzed by adopting Hamming distance model
ij。
In the second calculation formula, let D ═ a
ij′,R=b
i′,E=b
iGuessing the key is started. In analyzing out the key a
ijAfter a, a
ijBy calculation of (known), b
iIs the ith element of the key b, which is the guess (known), b
i' is the result of finite field addition, and is further based on
Analyzing a secret key b by adopting a Hamming distance model
i。
Suppose 2000 pairs of message signatures and corresponding 2000 power consumption curves are generated, A is26 × 26 matrix, b is a vector of length 26, A, b, y,
The elements contained are all finite fields GF (2)
8) Of (2) is used. To calculate a
ij′=a
ij×y
iFor example, let D be y
i,R=a
ij′,E=a
ijStarting to guess the key, the range is GF (2)
8) All the elements. Since E is the guess value (known) of the key and D is an element (known) of the message, R is obtained by R ═ E × D calculation. Based on the Hamming distance between D and R
The 2000 power consumption curves are divided into two groups:
and then carrying out differential operation on the two groups of power consumption curves to obtain a curve of each guess value, taking the maximum amplitude of each curve as the extreme value of the curve, obtaining the extreme value of the curve of each guess value, and taking the guess value corresponding to the curve with the maximum extreme value as the true value of the key.
Further, the key recovery device for UOV signature also includes a random variable control module 6;
the random variable control module 6 is used for fixing random variables in the UOV signature generation process;
the controller is also used for calling the random variable control module.
Further, the UOV signature algorithm includes a central mapping calculation formula
Is composed of
The result after the inverse transformation of the center map,
the O and the V are two types of variables;
the center map calculation formula includes a plurality of multivariate equations:
the multiple multivariate equations are divided into a first layer of calculation formula V
j′=α
ijV
jThe second layer calculation formula V ″)
j=V
j′+δ
iThird layer of calculation formula V
i′=β
ijV
iFourth layer calculation formula V
i″=γ
iV
iAnd the fifth calculation formula
Wherein, in the first layer of calculation formula, V
jIs fixed to a preset value as an input value D, alpha by the random variable control module
ijAs keys E, V
j' is the output value R; in the second layer of calculation formula, V
jIs an input value D, delta
iIs the key E, V ″)
jIs an output value R; in the third layer of calculation formula, V
iIs fixed to a preset value as an input value D, beta by the random variable control module
ijAs keys E, V
i' is the output value R; in the fourth layer of calculation formula, V
iIs fixed to a preset value as an input value D, gamma by the random variable control module
iAs keys E, V
i"is the output value R; in the fifth-level calculation formula,
to input a value D, η is a secret key E,
is the output value R.
It should be noted that, in the key analysis process in the central mapping calculation formula, the controller calls the random variable control module to fix the generated random variable to a preset value, that is, the random variables are fixed to (00000001) in sequence2To (11111111)2The value of (c).
The center mapping calculation formula includes a plurality of multivariable equations divided into a plurality of layers, wherein V of a first layer is a random variable and V of a next layer is composed of O and V of an upper layer, so that the plurality of multivariable equations are reduced to a first-order polynomial with respect to O by operation, and a value of O is obtained by solving a finite field linear equation set.
In the first layer of calculation formula, let D ═ V
j,R=V
j′,E=α
ijV is controlled by a random variable control module
jFixed to a preset value based on
Analyzing the secret key alpha by adopting a Hamming distance model
ij. In the second layer calculation formula, let D ═ V
j′,R=V″
j,E=δ
iV is controlled by a random variable control module
jFixed to a preset value based on
Key delta analysis using hamming distance model
i. In the third layer of calculation formula, let D be V
i,R=V
i′,E=β
ijV is controlled by a random variable control module
iFixed to a preset value based on
Key beta analysis using hamming distance model
ij. In the fourth layer of calculation formula, let D ═ V
i,R=V
i″,E=γ
iBy random variable controlMake module V
iFixed to a preset value based on
Analyzing the secret key gamma by using Hamming distance model
i. For the fifth layer of calculation formula, let
E ═ η, calculate
Is then based on
The key η is analyzed using a hamming distance model.
Further, the UOV signature algorithm further includes a second affine transformation calculation formula
x is
As a result after affine transformation, C is a matrix of n × n, d is a vector of length n;
the second affine transformation calculation formula includes a third calculation formula
And a fourth calculation formula d
i′=c
ij′+d
i;
Wherein, in the third calculation formula,
as input values D, c
ijIs a secret key E, c
ij' is the output value R; in the fourth calculation formula, c
ijIs an input value D, D
iIs a secret key E, d
i' is the output value R.
In the third calculation formula, c is
ijIs an element of key C row i column j,
is the result of a central mapping transformation
The ith element, c
ij' are finite field multiplication results, all finite field GF (2)
k) Of (2) is used. Order to
R=c
ij′,E=c
ijStarting to guess the key, the range is GF (2)
k) All elements, since E is the guess (known) of the key, D is an element (known) of the result of the transformation of the center map, and R is obtained by calculation from R ═ E × D, and is based on
Analyzing out a secret key c by adopting a Hamming distance model
ij。
In the fourth calculation formula, let D ═ c
ij′,R=d
i′,E=d
iGuessing the key is started. Since E is the guess (known) of the key, D is calculated (known), and R is calculated from R ═ E + D, based on
Key d is analyzed by adopting Hamming distance model
i。
After all keys of the UOV signature are obtained by the method, key recovery of the UOV signature is completed.
The key recovery device for the UOV signature provided by the embodiment of the invention can generate a message signature pair and a corresponding power consumption curve, operate the UOV signature algorithm by adopting a mode of setting a key guess value, analyze the power consumption curve based on an operation result and obtain a real key, thereby realizing the quick recovery of the key in the UOV signature algorithm, finding the security problem of the UOV signature and providing technical support for protecting the UOV.
Referring to fig. 2, it is a schematic flow chart of an embodiment of the key recovery method for UOV signature provided in the invention, including:
s1, generating N pairs of message signatures based on the UOV signature algorithm; wherein N is a positive integer greater than 2000;
s2, collecting power consumption curves generated in the generation process of each pair of message signature pairs to obtain N power consumption curves;
s3, sequentially selecting calculation formulas of all key participation in the UOV signature generation process;
s4, selecting GF (2) in sequencek) As guesses of the key in each chosen calculation formula;
and S5, when each guess value is selected, sequentially obtaining the input values of the calculation formula according to the messages in the N pairs of message signatures and carrying out operation to obtain N output values, and analyzing the N power consumption curves based on the N input values and the N output values corresponding to each guess value to obtain the key in the UOV signature algorithm.
The key recovery method for the UOV signature provided by the embodiment of the invention can generate a message signature pair and a corresponding power consumption curve, operate the UOV signature algorithm by adopting a mode of setting a key guess value, analyze the power consumption curve based on an operation result and obtain a real key, thereby realizing the quick recovery of the key in the UOV signature algorithm, finding the security problem of the UOV signature and providing technical support for protecting the UOV.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.