The script generated 4 numbers by:
for i in range(4):
x = getPrime((1<<10)-random.randint(1<<0,1<<8))
y = inverse(x,(self.p-1)*(self.q-1)//GCD(self.p-1,self.q-1))
numbers.append(y)
The vulnerabililty here is that xs' bit length is small compared to n, so lattice-based attack could exploit it.
Howgrave-Graham and Seifert’s Attack had concluded that when given 4 public exponents whose private exponents' bit length is below
The bit length of x here is about
By this relation of e and d, we can have 10 basic equations: (
The basic idea is using these equations to construct a vector-matrix equation
For the purpose that will be mentioned later, we want to choose
My choice was:
This lead to:
B=[ [1,-n,0,n^2,0,0,0,-n^3,0,0,0,0,0,0,0,n^4],
[0,e1,-e1,-e1*n,-e1,0,e1*n,e1*n^2,-e1,0,0,0,0,0,-e1*n^2,-e1*n^3],
[0,0,e2,-e2*n,0,e2*n,0,e2*n^2,0,e2*n,0,0,0,-e2*n^2,0,-e2*n^3],
[0,0,0,e1*e2,0,-e1*e2,-e1*e2,-e1*e2*n,0,-e1*e2,0,0,e1*e2,e1*e2*n,e1*e2*n,e1*e2*n^2],
[0,0,0,0,e3,-e3*n,-e3*n,e3*n^2,0,0,0,-e3*n^2,0,0,0,-e3*n^3],
[0,0,0,0,0,e1*e3,0,-e1*e3*n,0,0,e1*e3,e1*e3*n,0,0,e1*e3*n,e1*e3*n^2],
[0,0,0,0,0,0,e2*e3,-e2*e3*n,0,0,-e2*e3,e2*e3*n,-e2*e3,e2*e3*n,0,e2*e3*n^2],
[0,0,0,0,0,0,0,e1*e2*e3,0,0,0,-e1*e2*e3,0,-e1*e2*e3,-e1*e2*e3,-e1*e2*e3*n],
[0,0,0,0,0,0,0,0,e4,-e4*n,0,e4*n^2,0,e4*n^2,e4*n^2,-e4*n^3],
[0,0,0,0,0,0,0,0,0,e1*e4,-e1*e4,-e1*e4*n,-e1*e4,-e1*e4*n,0,e1*e4*n^2],
[0,0,0,0,0,0,0,0,0,0,e2*e4,-e2*e4*n,0,0,-e2*e4*n,e2*e4*n^2],
[0,0,0,0,0,0,0,0,0,0,0,e1*e2*e4,0,0,0,-e1*e2*e4*n],
[0,0,0,0,0,0,0,0,0,0,0,0,e3*e4,-e3*e4*n,-e3*e4*n,e3*e4*n^2],
[0,0,0,0,0,0,0,0,0,0,0,0,0,e1*e3*e4,0,-e1*e3*e4*n],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,e2*e3*e4,-e2*e3*e4*n],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e1*e2*e3*e4] ]
and
Every row of
To apply lattice attack, we still need
Hence we need to multiply both
diagonal_matrix([n^2,n^1.5,n^(2+delta),n,n^(2+delta),
n^(1.5+delta),n^(1.5+delta),n^0.5,
n^(2+delta),n^(1.5+delta),n^(2+2*delta),n^(1+delta),
n^(2+2*delta),n^(1+delta),n^(1+delta),1])
Now we can apply LLL algorithm to obtain
The only thing left is that we don't know the GCD of
Using the theorem, to increase the success rate of the attack, we need the volume of
By some observation, all the right hand side of the equations consists of
When choosing
We can even calculate the upperbound of bit length of