Clever Geek Handbook
📜 ⬆️ ⬇️

Cryptanalysis RSA

This article describes the conditions for using the RSA public key cryptographic algorithm , simplifying cryptanalytic attacks [1] , and methods for eliminating such conditions.

Content

Introduction

For 2009, an RSA-based encryption system is considered reliable, starting withn {\ displaystyle n}   in 1024 bits.

A group of scientists from Switzerland, Japan, France, the Netherlands, Germany and the United States were able to successfully calculate data encrypted using a 768-bit RSA standard cryptographic key. [2] According to the researchers, after their work, only RSA-keys with a length of 1024 bits or more can be considered as a reliable encryption system. Moreover, encryption with a key with a length of 1024 bits should be abandoned in the next three to four years. [3]

As follows from the description of the work, the calculation of key values ​​was carried out by the general method of numerical field sieve .

The first step (the choice of a pair of polynomials of degree 6 and 1) spent about six months computing on 80 processors, which was about 3% of the time spent on the main stage of the algorithm (sifting), which was performed on hundreds of computers for almost two years. If you interpolate this time for the operation of a single AMD Opteron 2.2 GHz processor with 2 GB of memory, you would get about 1500 years. Data processing after sifting for the next resource-intensive step (linear algebra) took several weeks on a small number of processors. The final step after finding non-trivial OSL solutions took no more than 12 hours.

The OSLU solution was carried out using the Wiedemann method on several separate clusters and lasted just under 4 months. The size of the sparse matrix was 192,796,550x192,795,550 with 27,795,115 920 non-zero elements (that is, an average of 144 non-zero elements per line). To store the matrix on the hard disk took about 105 gigabytes. At the same time, it took about 5 terabytes of compressed data to build this matrix.

As a result, the group was able to calculate the 232-digital key, which opens access to the encrypted data.

Researchers are confident that using their factorization method, a 1024-bit RSA key will be possible to crack within the next decade.

Knowing the decomposition of the modulen {\ displaystyle n}   on the product of two prime numbers, the enemy can easily find the secret exponentd {\ displaystyle d}   and thereby hack rsa. However, today the fastest factorization algorithm is the General Number Field Sieve sieve of the generalized number field, whose speed for a k-bit integer is

exp⁡((c+o(one))kone3log23⁡k),{\ displaystyle \ exp ((c + o (1)) k ^ {\ frac {1} {3}} \ log ^ {\ frac {2} {3}} k),}   for somec<2 {\ displaystyle c <2}   ,

does not allow decomposing a large integer in a reasonable time. We will consider possible attacks on RSA, which allow hacking this system without using direct decomposition of the module n into the product of two prime numbers.

Elementary attacks

Consider several attacks associated with improper use of the RSA algorithm.

Generating prime numbers

To random primesp {\ displaystyle p}   andq {\ displaystyle q}   the following additional constraint is imposed:

  • p{\ displaystyle p}   andq {\ displaystyle q}   should not be too close to each other, otherwise it will be possible to find them using the Fermat factorization method . However, if both are primep {\ displaystyle p}   andq {\ displaystyle q}   were generated independently, then this limitation is very likely to be automatically satisfied.

Diagram with a common module n

Initial data: To avoid generating different modulesn=p∗q {\ displaystyle n = p * q}   for each user, the secure server uses a single n to encrypt all messages. SideA {\ displaystyle A}   uses this server to receive a messageM {\ displaystyle M}  

Task: the opponent wants to decrypt the message sideA {\ displaystyle A}   .

It would seem ciphertextC=Meamodn, {\ displaystyle C = M ^ {e_ {a}} \ mod n,}   sent to the sideA {\ displaystyle A}   can not be decoded byB {\ displaystyle B}   if she does not have a secret keyda {\ displaystyle d_ {a}}   . However sideB {\ displaystyle B}   can use your exhibitorseb,db {\ displaystyle e_ {b}, d_ {b}}   to decompose the modulen {\ displaystyle n}   and after that, knowingea {\ displaystyle e_ {a}}   , calculate the secret exponentda {\ displaystyle d_ {a}}   .

Protection: for each user must use its own modulen {\ displaystyle n}   .

Attack on RSA signature in notary scheme

Initial data:(n,e) {\ displaystyle (n, e)}   - public key of the notary. Opponent gets a refusal when trying to sign a message by a notaryM∈Zn {\ displaystyle M \ in \ mathbb {Z} _ {n}}  

Task: the enemy wants to get the notary's signature on the messageM∈Zn {\ displaystyle M \ in \ mathbb {Z} _ {n}}   .

Opponent chooses arbitraryr∈Zn, {\ displaystyle r \ in \ mathbb {Z} _ {n},}   calculatesM′=reMmodn {\ displaystyle M '= r ^ {e} M \ mod n}   and sends this message to the notary for signature.

If the notary signs this message:

S′=(M′)dmodn{\ displaystyle S '= (M') ^ {d} \ mod n}  

then the opponent by calculatingS=S′/rmodn {\ displaystyle S = S '/ r \ mod n}   receives the signature of the messageM {\ displaystyle M}   .

Really,Se=(S′)e/re=(M′)ed/re≡M′/re=M(modn) {\ displaystyle S ^ {e} = (S ') ^ {e} / r ^ {e} = (M') ^ {ed} / r ^ {e} \ equiv M '/ r ^ {e} = M (\ mod n)}  

Protection: when signing, add a random number to the message (for example, time).

Small secret exponent values

Initial data: To increase the speed of decryption (or creating a digital signature), the number of non-zero bits of the binary representation of the secret exponent was reduced.d {\ displaystyle d}   (see the speed of the RSA algorithm ).

Task: calculate the secret exponentd {\ displaystyle d}   .

In 1990, Michael Wiener (Michael J. Wiener) showed that in the case of small valuesd {\ displaystyle d}   possible hacking of the RSA system, namely:

Wiener's theorem:

  Let be 
         n=pq{\ displaystyle n = pq}  whereq<p<2q{\ displaystyle q <p <2q} d<one3nonefour{\ displaystyle d <{\ frac {1} {3}} n ^ {\ frac {1} {4}}} 
Then, if known(n,e){\ displaystyle (n, e)}  whereed=onemodφ(n){\ displaystyle ed = 1 \ mod \ varphi (n)}  ,
then there is an efficient way to calculated{\ displaystyle d}  .

Protection: So ifn {\ displaystyle n}   has a size of 1024 bits, it is necessary thatd {\ displaystyle d}   was at least 256 bits long.

Small values ​​of the open exponent

To increase the speed of encryption and verification of digital signatures , use small values ​​of the open exponente {\ displaystyle e}   . The smallest of theme=3 {\ displaystyle e = 3}   . However, in order to increase the cryptostability of the RSA algorithm, it is recommended to use

e=2sixteen+one=65537{\ displaystyle e = 2 ^ {16} + 1 = 65537}   .

Attack of Hastada

Initial conditions: PartyB {\ displaystyle B}   sends an encrypted messageM {\ displaystyle M}   usersPone,P2,...Pk {\ displaystyle P_ {1}, P_ {2}, ... P_ {k}}   . Each user has his own public key.(ni,ei) {\ displaystyle (n_ {i}, e_ {i})}   , andM<ni,∀i {\ displaystyle M <n_ {i}, \ forall i}   . SideB {\ displaystyle B}   encrypts the message using each user's alternately public key and sends it to the appropriate recipient. Opponent listens to the transmission channel and collectsk {\ displaystyle k}   transmitted ciphertexts.

Task: the opponent wants to restore the messageM {\ displaystyle M}   .

Setei=3,∀i {\ displaystyle e_ {i} = 3, \ forall i}   then the enemy can recoverM {\ displaystyle M}   if ak⩾3 {\ displaystyle k \ geqslant 3}   .

Evidence

Indeed, if the enemy receivedCone,C2,C3 {\ displaystyle C_ {1}, C_ {2}, C_ {3}}   where

Cone=M3modnone{\ displaystyle C_ {1} = M ^ {3} \ mod n_ {1}}  
C2=M3modn2{\ displaystyle C_ {2} = M ^ {3} \ mod n_ {2}}  
C3=M3modn3{\ displaystyle C_ {3} = M ^ {3} \ mod n_ {3}}  

We assume thatnone,n2,n3 {\ displaystyle n_ {1}, n_ {2}, n_ {3}}   are mutually simple, otherwise the greatest common divisor other than one means that the divisor of one ofn {\ displaystyle n}   . Applying the Chinese remainder theorem toCone,C2,C3 {\ displaystyle C_ {1}, C_ {2}, C_ {3}}   getC′∈Znonen2n3 {\ displaystyle C '\ in \ mathbb {Z} _ {n_ {1} n_ {2} n_ {3}}}   ,

C′=M3modnonen2n3{\ displaystyle C '= M ^ {3} \ mod n_ {1} n_ {2} n_ {3}}  

Insofar asM<ni,∀i {\ displaystyle M <n_ {i}, \ forall i}   thenM3<nonen2n3,∀i {\ displaystyle M ^ {3} <n_ {1} n_ {2} n_ {3}, \ forall i}   and

C′=M3{\ displaystyle C '= M ^ {3}}  

Ie the adversary can recover the messageM {\ displaystyle M}   calculating the cubic root ofC′ {\ displaystyle C '}   .

In general, if all open exponents are equale {\ displaystyle e}   , the enemy can recoverM {\ displaystyle M}   atk⩾e {\ displaystyle k \ geqslant e}   .

Consider the simplest defense against this attack. Let the messageMi {\ displaystyle M_ {i}}   for each user is some fixed permutation of the original messageM {\ displaystyle M}   .For example

Mi=i2m+M{\ displaystyle M_ {i} = i2 ^ {m} + M}   - message for i-th user.

Hustad (Johan Hastad) showed that even in this case, the enemy can recover the messageM {\ displaystyle M}   with enough users.

Protection: This attack is possible only with a small value of the open exponent.e {\ displaystyle e}   In this case, the cryptographic strength of the RSA system can be achieved using an arbitrary permutation, rather than a fixed one, an example of which was given above.

Franklin-Reiter Attack

Initial conditions :

There are two messages.Mone,M2∈Zn {\ displaystyle M_ {1}, M_ {2} \ in \ mathbb {Z} _ {n}}   , and

Mone=f(M2)modn,{\ displaystyle M_ {1} = f (M_ {2}) \ mod n,}   Wheref∈Zn[x] {\ displaystyle f \ in \ mathbb {Z} _ {n} [x]}   some open polynomial.

SideA {\ displaystyle A}   with public key(n,e) {\ displaystyle (n, e)}   receives these messages from the sideB {\ displaystyle B}   which simply encrypts messagesMone,M2 {\ displaystyle M_ {1}, M_ {2}}   and passes the received ciphertextsCone,C2 {\ displaystyle C_ {1}, C_ {2}}   .

Task: Opponent, knowing(n,e,Cone,C2,f) {\ displaystyle (n, e, C_ {1}, C_ {2}, f)}   , wants to recoverMone,M2 {\ displaystyle M_ {1}, M_ {2}}   .

Matthew K. Franklin and Michael K. Reiter proved the following statement:

  Let be    
      one) (n,e){\ displaystyle (n, e)}  - the public key of the RSA system, ande=3{\ displaystyle e = 3} 
2)Mone≠M2∈Zn{\ displaystyle M_ {1} \ neq M_ {2} \ in \ mathbb {Z} _ {n}}  andMone=f(M2)modN{\ displaystyle M_ {1} = f (M_ {2}) \ mod N}  ,
for some linear polynomialf=ax+b∈Zn[x]{\ displaystyle f = ax + b \ in \ mathbb {Z} _ {n} [x]}  ,b≠0{\ displaystyle b \ neq 0} 
Then knowing(n,e,Cone,C2,f){\ displaystyle (n, e, C_ {1}, C_ {2}, f)}  , the enemy can recoverMone,M2{\ displaystyle M_ {1}, M_ {2}} 
Evidence

Indeed, for arbitrarye {\ displaystyle e}   :

Cone=Meonemodn→M2{\ displaystyle C_ {1} = {M ^ {e}} _ {1} \ mod n ~~~~ \ rightarrow ~~~~ M_ {2}}   , is the root of a polynomial

gone(x)=f(x)e-Cone∈Zn[x]{\ displaystyle g_ {1} (x) = f (x) ^ {e} -C_ {1} \ in \ mathbb {Z} _ {n} [x]}  

but,M2 {\ displaystyle M_ {2}}   is also the root of a polynomial

g2(x)=xe-C2∈Zn[x]{\ displaystyle g_ {2} (x) = x ^ {e} -C_ {2} \ in \ mathbb {Z} _ {n} [x]}   .

In this way(x-M2) {\ displaystyle (x-m_ {2})}   divides both polynomials. And the adversary can use the Euclidean algorithm to calculate the gcd(gone,g2) {\ displaystyle (g_ {1}, g_ {2})}   . If the result is a linear polynomial, thenM2 {\ displaystyle M_ {2}}   will be found.

Whene=3 {\ displaystyle e = 3}   NOD(gone,g2) {\ displaystyle (g_ {1}, g_ {2})}   is a linear polynomial, and therefore the adversary can effectively compute messagesMone,M2 {\ displaystyle M_ {1}, M_ {2}}   .

Protection: whene>3 {\ displaystyle e> 3}   RSA hacking time is proportionale2 {\ displaystyle e ^ {2}}   Therefore, this attack can be used only for small values ​​of the open exponent.

Attack by partially known secret exponent

Initial conditions :

The adversary knows part of the binary representation of the secret exponent.d {\ displaystyle d}   .

Task: recoverd {\ displaystyle d}   .

It turns out that:

Let be(n,d) {\ displaystyle (n, d)}   - the secret key of the RSA system, wheren=pq {\ displaystyle n = pq}   has a sizeη {\ displaystyle \ eta}   bits.
Then knowingη/four {\ displaystyle \ eta / 4}   low bits of the numberd {\ displaystyle d}   , the enemy can recoverd {\ displaystyle d}   in time proportionalelog2⁡e {\ displaystyle e \ log _ {2} e}  

The possibility of breaking the RSA system in the case when an open exhibitore {\ displaystyle e}   small, is also evident from the following reasoning:

from the definitione {\ displaystyle e}   andd {\ displaystyle d}   :
ed-kφ(n)=ed-k(n-p-q+one)=one{\ displaystyle ed-k \ varphi (n) = ed-k (np-q + 1) = 1}  
Insofar asd<φ(n) {\ displaystyle d <\ varphi (n)}   then obvious0<k⩽e {\ displaystyle 0 <k \ leqslant e}   .
With a givenk {\ displaystyle k}   the enemy can easily calculate
d^=b(kn+one)/ec{\ displaystyle {\ hat {d}} = {\ mathcal {b}} (kn + 1) / e {\ mathcal {c}}}  
Then atq<p<2q {\ displaystyle q <p <2q}  
|d^-d|⩽k(p+q)/e⩽3kn/e<3n{\ displaystyle | {\ hat {d}} - d | \ leqslant k (p + q) / e \ leqslant 3k {\ sqrt {n}} / e <3 {\ sqrt {n}}}  
In this way,d^ {\ displaystyle {\ hat {d}}}   is a good approximation whend {\ displaystyle d}   .
Since only possiblee {\ displaystyle e}   different meaningsk {\ displaystyle k}   an adversary can build a row containinge {\ displaystyle e}   members for which the binary representation of one of its elements coincides with the upper half of the binary representation of the secret exponentd {\ displaystyle d}   .

Protection: increase in open exhibitorse {\ displaystyle e}   .

Quantum Computer Attack

Using a quantum computer , if it is built, it will be possible to crack RSA, since Shore’s quantum algorithm allows factorizing large numbers in a fairly short time. By decomposing the module n into prime factors (this can be done in timeO(log2⁡nlog3⁡(log⁡n)) {\ displaystyle {\ textstyle {O (\ log ^ {2} n \ log ^ {3} (\ log n))}}}   using O (log n ) logical Q-bits ), it will be possible to calculate the secret exponent d.

Attacks related to the implementation of the RSA system

Runtime Attack

Initial conditions:

Consider a smart card whose microprocessor signs messages using the built-in RSA secret key.

Task: the enemy wants to get a secret exhibitord {\ displaystyle d}   .

Paul Kocher, suggested an attack based on high-precision measurements of the execution time of the smart card by the encoder . Consider this attack on the example of the RSA system, using the algorithm of rapid exponentiation :

Opponent receives smart card signatures for a large number of random messages.Mone,M2,...,Mk∈Zn {\ displaystyle M_ {1}, M_ {2}, ..., M_ {k} \ in \ mathbb {Z} _ {n}}   and measures the generation time of their signatures.Ti {\ displaystyle T_ {i}}   .

During the attack the value of the secret exponentd {\ displaystyle d}   recovered bitwise, starting with the least significant bit:

  • d{\ displaystyle d}   odd, therefored0=one {\ displaystyle d_ {0} = 1}   .
  • if adone=one {\ displaystyle d_ {1} = 1}   then the smart card microprocessor needs to perform three multiplications modulon {\ displaystyle n}   as opposed to the two needed whendone=0 {\ displaystyle d_ {1} = 0}   (see algorithm of rapid exponentiation ). We denoteti {\ displaystyle t_ {i}}   - CPU time for reportingMi {\ displaystyle M_ {i}}   .
Kocher testified that whendone=one {\ displaystyle d_ {1} = 1}   two ensemblesftig {\ displaystyle {\ mathcal {f}} t_ {i} {\ mathcal {g}}}   andfTig {\ displaystyle {\ mathcal {f}} T_ {i} {\ mathcal {g}}}   correlate. however in the casedone=0 {\ displaystyle d_ {1} = 0}   they are independent. Thus, by resorting to correlation analysis , the adversary can determinedone {\ displaystyle d_ {1}}   .
  • similarly, you can defined2,d3... {\ displaystyle d_ {2}, d_ {3} ...}   .

Note that in the case of a small open exponente {\ displaystyle e}   an attack on a partially open secret exponent can be applied. In this case, it is sufficient to recover half of the bits of the secret exponentd {\ displaystyle d}   .

Protection: it is necessary to add the appropriate delay so that each step of the fast exponentiation algorithm takes a fixed period of time.

Attack on a failed RSA hardware implementation

Initial conditions:

Consider a smart card whose microprocessor signs messages using the built-in RSA secret key. The card microprocessor uses the Chinese theorem on residuals in order to speed up the signature procedure. The adversary is trying to cause a failure in the microprocessor calculations.

Task: the opponent wants to calculate the modulen {\ displaystyle n}   .

The use of the Chinese remainder theorem increases the speed of creating a digital signature.

Indeed, calculating
σp=Mdpmodp{\ displaystyle \ sigma _ {p} = M ^ {d_ {p}} \ mod p}   wheredp=dmod(p-one)(a) {\ displaystyle d_ {p} = d \ mod (p-1) ~~~~ (a)}  
σq=Mdqmodq{\ displaystyle \ sigma _ {q} = M ^ {d_ {q}} \ mod q}   wheredq=dmod(q-one)(b) {\ displaystyle d_ {q} = d \ mod (q-1) ~~~~ (b)}  
can get a signature
σ=Toneσp+T2σq(modn){\ displaystyle \ sigma = T_ {1} \ sigma _ {p} + T_ {2} \ sigma _ {q} ({\ bmod {n}})}   whereTone=fonemodp,0modqg {\ displaystyle T_ {1} = {\ mathcal {f}} 1 \ mod p, 0 \ mod q {\ mathcal {g}}}  
T2=f0modp,onemodqg{\ displaystyle T_ {2} = {\ mathcal {f}} 0 \ mod p, 1 \ mod q {\ mathcal {g}}}  
Obviously computing(a),(b) {\ displaystyle (a), (b)}   much faster exponentiation modulon {\ displaystyle n}   .

Let the actions of the enemy caused a failure, which caused the defect of one bit of the signature. Then at least one ofσp {\ displaystyle \ sigma _ {p}}   orσq {\ displaystyle \ sigma _ {q}}   calculated incorrectly. We put the defect contained inσq^ {\ displaystyle {\ hat {\ sigma _ {q}}}}   .

In this case

σe^≠Mmodn{\ displaystyle {\ hat {\ sigma ^ {e}}} \ neq M \ mod n}  
σe^≠Mmodq{\ displaystyle {\ hat {\ sigma ^ {e}}} \ neq M \ mod q}  

but

σe^=Mmodp{\ displaystyle {\ hat {\ sigma ^ {e}}} = M \ mod p}  

Thus, the enemy can find decompositionn {\ displaystyle n}   as search result(n,σe^-m) {\ displaystyle (n, {\ hat {\ sigma _ {e}}} - m)}   .

Protection:

  • when signing, add a random number to the message (for example, time).
  • check the signature before sending it.

Notes

  1. ↑ Yan S. Y. RSA Cryptanalysis. - M.-Izhevsk: SRC "Regular and chaotic dynamics", Izhevsk Institute of Computer Research, 2011. - 312 p.
  2. ↑ Announcement of factoring RSA-768 (English)
  3. ↑ Factoring RSA-768 (English)
Source - https://ru.wikipedia.org/w/index.php?title= Cryptanalysis RSA&oldid = 79195197


More articles:

  • Shraffirovka (heraldry)
  • Tomaro, Tomasz
  • Rozherio Santana Alves
  • Railway Transport in Paraguay
  • HMS Royal Sovereign (1786)
  • Wing
  • Sloboda (Vinogradov district)
  • Sinkevich, Lucas
  • giFT
  • TNS Energo Nizhny Novgorod

All articles

Clever Geek | 2019