The Ray Attack on RSA Cryptosystems’, in R
Total Page:16
File Type:pdf, Size:1020Kb
The ray attack, an inefficient trial to break RSA cryptosystems∗ Andreas de Vries† FH S¨udwestfalen University of Applied Sciences, Haldener Straße 182, D-58095 Hagen Abstract The basic properties of RSA cryptosystems and some classical attacks on them are described. Derived from geometric properties of the Euler functions, the Euler function rays, a new ansatz to attack RSA cryptosystemsis presented. A resulting, albeit inefficient, algorithm is given. It essentially consists of a loop with starting value determined by the Euler function ray and with step width given by a function ωe(n) being a multiple of the order ordn(e), where e denotes the public key exponent and n the RSA modulus. For n = pq and an estimate r < √pq for the smaller prime factor p, the running time is given by T (e,n,r)= O((r p)lnelnnlnr). − Contents 1 Introduction 1 2 RSA cryptosystem 2 2.1 Properties of an RSA key system . ... 4 2.2 ClassicalRSAattacks. 5 3 The Euler function ray attack 7 3.1 The ω-function and the order of a number modulo n ............... 7 3.2 Properties of composed numbers n = pq ..................... 10 3.3 Thealgorithm................................... 13 arXiv:cs/0307029v1 [cs.CR] 11 Jul 2003 4 Discussion 15 A Appendix 15 A.1 Euler’sTheorem.................................. 15 A.2 The Carmichael function and Carmichael’s Theorem . ......... 16 1 Introduction Since the revolutionary idea of asymmetric cryptosystems was born in the 1970’s, due to Diffie and Hellman [4] and Rivest, Shamir and Adleman [9], public key technology became an in- dispensable part of contemporary electronically based communication. Its applications range ∗This paper is a slight modification of [10] †e-Mail: [email protected] 1 from authentication to digital signatures and are widely considered to be an essential of future applications for e-commerce. The most popular cryptosystem is RSA. There has been numerous, more or less unsuc- cessful, attacks on RSA. The strongness of RSA bases on the difficulty to factorize integers as well as to compute the discrete logarithm. For more details, see e.g. [1, 2, 3, 6]; cf. also http://www.math-it.org 2 RSA cryptosystem The RSA cryptosystem, named after its inventors Ron Rivest, Adi Shamir, and Len Adleman (1978), was the first public key cryptosystem and is still the most important one. It is based on the dramatic difference between the ease of finding large prime numbers and computing modular powers on the one hand, and the difficulty of factorizing a product of large prime numbers as well as inverting the modular exponentiation. Generally, in a public key system, each participant has both a public key and a private key, which is held secret. Each key is a piece of information. In the RSA cryptosystem, each key consists of a group of integers. The participants are traditionally called Alice and Bob, and we denote their public and secret keys as PA, SA for Alice and PB, SB for Bob. All participants create their own pair of public and private keys. Each keeps his private key secret, but can reveal his public key to anyone or can even publish it. It is very convenient that everyone’s public key is available in a public directory, so that any participant can easily obtain the public key of any other participant, just like we nowadays can get anyones phone number from a public phone book. In the RSA cryptosystem, each participant creates his public and private keys with the fol- lowing procedure. 1. Select at random two large prime numbers p and q, p = q. (The primes might be more 6 than 200 digits each, i.e. more than 660 bits.) 2. Compute n = pq and the Carmichael function λ(n)= lcm(p 1,q 1). − − 3. Select an integer d relatively prime to λ(n). (d should be of the magnitude of n, i.e., d / λ(n).) 4. Compute e as the multiplicative inverse of d modulo λ(n), such that ed = 1 mod λ(n). This is done efficiently by the extended Euclidean algorithm. 5. Publish the pair P = (e,n) as the public key. 6. Keep secret the pair S = (d,n) as the private or secret key. For this procedure, the domain of the messages is Zn. For each participant of a cryptosystem, the four-tuple (e,d, p,q) N4 is called (individual) RSA key system. The key parameter e is also called the encryption∈ exponent, d the decryption exponent, and n the RSA modulus. The encryption of a message m Zn associated with a public key P = (e,n) is performed ∈ by the function E : Zn Zn, → E(m)= me mod n. (1) 2 The decryption of a ciphertext c Zn associated with the private key S = (d,n) is done by the ∈ mapping D : Zn Zn, → D(c)= cd mod n. (2) The procedure where Alice sends an encrypted message to Bob is schematically shown in Figure 1. A qualitatively new possibility offered by public key systems (and being unimple- Figure 1: Alice sends an encrypted message m to Bob, using his public RSA key PB. mentable with symmetric key systems) is the procedure of digital signature. How an RSA cryptosystem enables Alice to digitally sign a message and how Bob can verify that it is signed by Alice is sketched in Figure 2. As a matter of course, this verification in fact is possible only if the authenticity of Alice’s public key PA is guaranteed such that Bob can assume that it is her key (and not a third person’s one) which he uses. This guarantee is the job of so-called trust centers. Figure 2: Alice sends a digitally signed message to Bob; Bob uses Alice’s public key to decrypt the message and to verify this way that Alice has signed it with her private key. The correctness of RSA, i.e., the fact that E and D define inverse functions on Zn (D E = ◦ E D = idZ ) relies on the simple fact that ◦ n ed m = m mod n for m Zn, (3) ∈ which is immediately proved by the corollary of Carmichael A.7, p. 18. For details see, e.g., [1, 2, 3]. 3 Remark 2.1 Often one finds the definition of RSA cryptosystems based on the Euler function ϕ rather than on the Carmichael function λ, cf. [3]. However, since ϕ(pq) = (p 1)(q 1), − − both function values ϕ(pq) and λ(pq) share the same divisors. Therefore, a possible key parameter d relatively prime to λ(pq) is also relatively prime to ϕ(pq), and vice versa. Only the resulting counter key e may differ. To be more precise, any possible RSA key pair of a system based on the Euler function is a possible key pair with respect to the Carmichael function, whereas the reverse is not generally true. (Proof: Since λ(n) ϕ(n), the equality | ed = 1 mod ϕ(n) implies ed = 1 mod λ(n).) Using the Euler function ϕ, the correctness of RSA is shown with the Euler theorem A.2 on p. 16, instead of the corollary of Carmichael. 2.1 Properties of an RSA key system Theorem 2.2 Let p, q N be two primes, p,q > 1, p = q. Then the number νpq of all possible ∈ 6 key pairs (P,S) = ((e, pq),(d, pq)) is given by νpq = ϕ(λ(pq)). (4) The (trivial) keys with e = d = 1 and with e = d = λ(pq) 1 are always possible, and − (p 1)(q 1) 2 < ν < − − . (5) pq gcd (p 1,q 1) − − Proof. Since ed = 1 mod λ(pq), without restriction to generality we have 0 < e,d < λ(pq). Moreover, gcd(d,λ(pq)) = gcd(e,λ(pq)) = 1, because for an arbitrary integer a with gcd(a, λ N λ Z (pq)) > 1 there exists no b such that ab = 1 mod (pq). Therefore, e,d λ∗ (pq). In Z ∈ λ ∈ Z turn, to any a λ∗ (pq) there exists an integer b such that ab = 1 mod (pq), since λ∗ (pq) is a ∈ Z ϕ λ group. But the order of λ∗ (pq) is exactly ( (pq)). It is clear that 1 1 = 1 mod λ(n), so e = d = 1 are always possible as key parameters. · If e = d = λ(pq) 1, we have ed = λ 2(pq) 2λ(pq) + 1 = 1 mod λ(pq), so e and d are − − always possible, too. By (47), λ(pq) is even and (by pq ≧ 6) greater than 2, so νpq > 2. The maximum number of elements on the other hand is λ(pq) 1. − The plot of all possible RSA key parameters (e,d) reveals general symmetries in the (e,d)- plane. First we observe that if P = (e,n), S = (d,n) is a possible RSA key pair, then trivially also P′ = (d,n), S′ = (e,n) is possible, because ed = de = 1 mod λ(n). Furthermore, if ed = 1 mod λ(n) and 0 < e,d < λ(n)/2, then e′ = λ(n) e, d′ = λ(n) d (6) − − satisfy λ(n)/2 < e′,d′ < λ(n) as well as 2 e′d′ = λ (n) λ(n)(e + d)+ ed = ed mod λ(n). − Therefore, P′ = (e′,n) and S′ = (d′,n) are possible RSA keys, too. To sum up, all possible RSA key parameters (e,d), plotted in the square lattice [0,λ(n) − 1]2 N2 with edges ranging from 0 to λ(n) 1, form a pattern which is symmetric to both the principal⊂ and the secondary square diagonals,− see Figure 3.