RSA ( Rivest – Shamir – Adleman ) es un criptosistema de clave pública que se utiliza ampliamente para la transmisión segura de datos. También es uno de los más antiguos. El acrónimo RSA proviene de los apellidos de Ron Rivest , Adi Shamir y Leonard Adleman , quienes describieron públicamente el algoritmo en 1977. Un sistema equivalente fue desarrollado en secreto, en 1973 en GCHQ (la agencia británica de inteligencia de señales ), por el matemático inglés Clifford Cocks. . Ese sistema fue desclasificado en 1997. [1]
General | |
---|---|
Diseñadores | Ron Rivest , Adi Shamir y Leonard Adleman |
Publicado por primera vez | 1977 |
Certificación | PKCS # 1 , ANSI X9.31 , IEEE 1363 |
Detalle de cifrado | |
Tamaños de clave | 2.048 a 4.096 bits típicos |
Rondas | 1 |
Mejor criptoanálisis público | |
Tamiz de campo numérico general para ordenadores clásicos; Algoritmo de Shor para computadoras cuánticas. Se ha roto una clave de 829 bits . |
En un criptosistema de clave pública , la clave de cifrado es pública y distinta de la clave de descifrado , que se mantiene secreta (privada). Un usuario de RSA crea y publica una clave pública basada en dos números primos grandes , junto con un valor auxiliar. Los números primos se mantienen en secreto. Cualquier persona puede cifrar los mensajes a través de la clave pública, pero solo puede decodificarlos alguien que conozca los números primos. [2]
La seguridad de RSA se basa en la dificultad práctica de factorizar el producto de dos números primos grandes , el " problema de factorización ". Romper el cifrado RSA se conoce como el problema RSA . Si es tan difícil como el problema de la factorización es una pregunta abierta. [3] No existen métodos publicados para anular el sistema si se utiliza una clave lo suficientemente grande.
RSA es un algoritmo relativamente lento. Debido a esto, no se usa comúnmente para cifrar directamente los datos del usuario. Más a menudo, RSA se utiliza para transmitir claves compartidas para criptografía de clave simétrica , que luego se utilizan para cifrado-descifrado masivo.
Historia
La idea de un criptosistema asimétrico de clave pública-privada se atribuye a Whitfield Diffie y Martin Hellman , quienes publicaron este concepto en 1976. También introdujeron firmas digitales e intentaron aplicar la teoría de números. Su formulación utilizó una clave secreta compartida creada a partir de la exponenciación de algún número, módulo un número primo. Sin embargo, dejaron abierto el problema de realizar una función unidireccional, posiblemente porque la dificultad de factorizar no estaba bien estudiada en ese momento. [4]
Ron Rivest , Adi Shamir y Leonard Adleman en el Instituto de Tecnología de Massachusetts , hicieron varios intentos en el transcurso de un año para crear una función unidireccional que era difícil de invertir. Rivest y Shamir, como informáticos, propusieron muchas funciones potenciales, mientras que Adleman, como matemático, fue responsable de encontrar sus debilidades. Probaron muchos enfoques, incluidos " polinomios basados en mochila " y "polinomios de permutación". Durante un tiempo, pensaron que lo que querían lograr era imposible debido a requisitos contradictorios. [5] En abril de 1977, pasaron la Pascua en la casa de un estudiante y bebieron mucho vino de Manischewitz antes de regresar a sus hogares alrededor de la medianoche. [6] Rivest, incapaz de dormir, se acostó en el sofá con un libro de texto de matemáticas y comenzó a pensar en su función unidireccional. Pasó el resto de la noche formalizando su idea y tenía gran parte del papel listo para el amanecer. El algoritmo ahora se conoce como RSA: las iniciales de sus apellidos en el mismo orden que su papel. [7]
Clifford Cocks , un matemático inglés que trabajaba para la Sede de Comunicaciones del Gobierno de la agencia de inteligencia británica (GCHQ), describió un sistema equivalente en un documento interno en 1973. [8] Sin embargo, dadas las computadoras relativamente caras necesarias para implementarlo en ese momento, fue considerado principalmente una curiosidad y, hasta donde se sabe públicamente, nunca se desplegó. Su descubrimiento, sin embargo, no fue revelado hasta 1997 debido a su clasificación de alto secreto.
Kid-RSA (KRSA) es un cifrado de clave pública simplificado publicado en 1997, diseñado con fines educativos. Algunas personas sienten que aprender Kid-RSA brinda información sobre RSA y otros cifrados de clave pública, análogos a DES simplificado . [9] [10] [11] [12] [13]
Patentar
El 20 de septiembre de 1983 se concedió al MIT una patente que describe el algoritmo RSA : Patente estadounidense 4.405.829 "Sistema y método de comunicaciones criptográficas". Del resumen de la patente de DWPI :
El sistema incluye un canal de comunicaciones acoplado a al menos un terminal que tiene un dispositivo de codificación y al menos un terminal que tiene un dispositivo de decodificación. Un mensaje a transferir se cifra en texto cifrado en el terminal de codificación codificando el mensaje como un número M en un conjunto predeterminado. Luego, ese número se eleva a una primera potencia predeterminada (asociada con el receptor previsto) y finalmente se calcula. El resto o residuo, C, se ... calcula cuando el número exponenciado se divide por el producto de dos números primos predeterminados (asociados con el receptor previsto).
Una descripción detallada del algoritmo fue publicado en agosto de 1977, en la revista Scientific American 's juegos matemáticos columna. [7] Esto precedió a la fecha de presentación de la patente de diciembre de 1977. En consecuencia, la patente no tenía valor legal fuera de los Estados Unidos . Si el trabajo de Cocks hubiera sido conocido públicamente, una patente en los Estados Unidos tampoco habría sido legal.
Cuando se emitió la patente, la duración de la patente era de 17 años. La patente estaba a punto de expirar el 21 de septiembre de 2000, cuando RSA Security lanzó el algoritmo al dominio público, el 6 de septiembre de 2000. [14]
Operación
El algoritmo RSA implica cuatro etapas: clave de generación, distribución de claves de cifrado, y el descifrado.
Un principio básico detrás de RSA es la observación de que es práctico encontrar tres enteros positivos muy grandes e , d y n , de manera que con exponenciación modular para todos los enteros m (con 0 ≤ m < n ):
y que el conocimiento de correo y n , o incluso m , puede ser extremadamente difícil encontrar d . La barra triple (≡) aquí denota congruencia modular .
Además, para algunas operaciones es conveniente que se pueda cambiar el orden de las dos exponenciaciones y que esta relación también implique:
RSA implica una clave pública y una clave privada . La clave pública puede ser conocida por todos y se utiliza para cifrar mensajes. La intención es que los mensajes cifrados con la clave pública solo se puedan descifrar en un período de tiempo razonable utilizando la clave privada. La clave pública está representado por los números enteros n y E ; y, la clave privada, por el entero d (aunque n también se usa durante el proceso de descifrado, por lo que también podría considerarse parte de la clave privada). m representa el mensaje (preparado previamente con una técnica determinada que se explica a continuación).
Generación de claves
Las claves para el algoritmo RSA se generan de la siguiente manera:
- Elija dos distintos números primos p y q .
- Por razones de seguridad, los enteros p y q deben ser elegidos al azar, y deben ser similares en magnitud, pero difieren en longitud por unos pocos dígitos para hacer más difícil la factorización. [2] Los números primos se pueden encontrar de manera eficiente usando una prueba de primalidad .
- p y q se mantienen en secreto.
- Calcule n = pq .
- n se utiliza como módulo para las claves pública y privada. Su longitud, generalmente expresada en bits, es la longitud de la clave .
- n se libera como parte de la clave pública.
- Calcule λ ( n ), donde λ es la función totiente de Carmichael . Desde n = pq , λ ( n ) = lcm ( λ ( p ), λ ( q )), y puesto que p y q son primos, λ ( p ) = φ ( p ) = p - 1 y del mismo modo λ ( q ) = q - 1. Por lo tanto, λ ( n ) = lcm ( p - 1, q - 1).
- λ ( n ) se mantiene en secreto.
- El mcm se puede calcular mediante el algoritmo euclidiano , ya que lcm ( a , b ) = | ab | / mcd ( a , b ).
- Elija un número entero e tal que 1 < e < λ ( n ) y mcd ( e , λ ( n )) = 1 ; es decir, e y λ ( n ) son coprimos .
- e que tiene un corto bit de longitud y pequeñas de peso de Hamming resultados en el cifrado más eficiente - el valor más comúnmente elegido para e es 2 16 + 1 = 65.537 . El valor más pequeño (y más rápido) posible para e es 3, pero se ha demostrado que un valor tan pequeño para e es menos seguro en algunos entornos. [15]
- e se libera como parte de la clave pública.
- Determine d como d ≡ e −1 (mod λ ( n )) ; es decir, d es el inverso multiplicativo modular de e módulo λ ( n ).
- Esto significa: resuelva para d la ecuación d ⋅ e ≡ 1 (mod λ ( n )) ; d se puede calcular de manera eficiente utilizando el algoritmo Euclidiano Extendido , ya que, gracias a que e y λ ( n ) son coprimos, dicha ecuación es una forma de identidad de Bézout , donde d es uno de los coeficientes.
- d se mantiene en secreto como exponente de clave privada .
La clave pública consta del módulo ny el exponente público (o cifrado) e . La clave privada consta del exponente privado (o descifrado) d , que debe mantenerse en secreto. p , q y λ ( n ) también deben mantenerse en secreto porque se pueden usar para calcular d . De hecho, todos pueden descartarse después de que se haya calculado d . [dieciséis]
En el documento de RSA original, [2] el Euler función totient φ ( n ) = ( p - 1) ( q - 1) se utiliza en lugar de λ ( n ) para el cálculo del exponente privado d . Dado que φ ( n ) siempre es divisible por λ ( n ), el algoritmo también funciona. El hecho de que se pueda utilizar la función totient de Euler también puede verse como una consecuencia del teorema de Lagrange aplicado al grupo multiplicativo de enteros módulo pq . Por lo tanto, cualquier d que satisfaga d ⋅ e ≡ 1 (mod φ ( n )) también satisface d ⋅ e ≡ 1 (mod λ ( n )) . Sin embargo, calcular d módulo φ ( n ) a veces producirá un resultado mayor de lo necesario (es decir, d > λ ( n ) ). La mayoría de las implementaciones de RSA aceptarán exponentes generados usando cualquiera de los métodos (si usan el exponente privado d , en lugar de usar el método de descifrado optimizado basado en el teorema del resto chino que se describe a continuación), pero algunos estándares como FIPS 186-4 puede requerir que d < λ ( n ) . Cualquier exponente privado "sobredimensionado" que no cumpla con ese criterio siempre puede reducirse módulo λ ( n ) para obtener un exponente equivalente más pequeño.
Dado que cualquier factor común de ( p - 1) y ( q - 1) está presente en la factorización de n - 1 = pq - 1 = ( p - 1) ( q - 1) + ( p - 1) + ( q - 1) , [17] se recomienda que ( p - 1) y ( q - 1) tengan solo factores comunes muy pequeños, si los hay además de los necesarios 2. [2] [18] [19] [20]
Nota: Los autores del artículo RSA original llevan a cabo la generación de claves eligiendo dy luego calculando e como el inverso multiplicativo modular de d módulo φ ( n ), mientras que la mayoría de las implementaciones actuales de RSA, como las que siguen a PKCS # 1 , lo hacen lo contrario (elija ey calcule d ). Dado que la clave elegida puede ser pequeña, mientras que la clave calculada normalmente no lo es, el algoritmo del papel RSA optimiza el descifrado en comparación con el cifrado, mientras que el algoritmo moderno optimiza el cifrado. [2] [21]
Distribución de claves
Suponga que Bob quiere enviar información a Alice . Si deciden usar RSA, Bob debe conocer la clave pública de Alice para cifrar el mensaje y Alice debe usar su clave privada para descifrar el mensaje.
Para permitir que Bob envíe sus mensajes cifrados, Alice transmite su clave pública ( n , e ) a Bob a través de una ruta confiable, pero no necesariamente secreta. La clave privada de Alice ( d ) nunca se distribuye.
Cifrado
Una vez que Bob obtiene la clave pública de Alice, puede enviar un mensaje M a Alice.
Para hacerlo, primero convierte M (estrictamente hablando, el texto plano sin relleno) en un entero m (estrictamente hablando, el texto plano relleno), de modo que 0 ≤ m < n mediante el uso de un protocolo reversible acordado conocido como relleno esquema . Luego calcula el texto cifrado c , usando la clave pública e de Alice , correspondiente a
Esto se puede hacer razonablemente rápido, incluso para números muy grandes, usando exponenciación modular . Bob luego transmite c a Alice.
Descifrado
Alice puede recuperar m de c utilizando su exponente de clave privada d calculando
Dado m , puede recuperar el mensaje original M invirtiendo el esquema de relleno.
Ejemplo
A continuación, se muestra un ejemplo de cifrado y descifrado RSA. Los parámetros utilizados aquí son artificialmente pequeños, pero también se puede utilizar OpenSSL para generar y examinar un par de claves real .
- Elija dos números primos distintos, como
- y
- Calcule n = pq dando
- Calcule la función totient de Carmichael del producto como λ ( n ) = lcm ( p - 1, q - 1) dando
- Elija cualquier número 1 < e <780 que sea coprimo de 780. Elegir un número primo para e nos deja solo para verificar que e no es un divisor de 780.
- Dejar
- Calcule d , el inverso multiplicativo modular de e (mod λ ( n )) dando,como
La clave pública es ( n = 3233 , e = 17 ). Para un mensaje de texto plano relleno m , la función de cifrado es
La clave privada es ( n = 3233 , d = 413 ). Para un texto cifrado c , la función de descifrado es
Por ejemplo, para cifrar m = 65 , calculamos
Para descifrar c = 2790 , calculamos
Ambos cálculos se pueden calcular de manera eficiente utilizando el algoritmo de multiplicar y cuadrar para exponenciación modular . En situaciones de la vida real, los números primos seleccionados serían mucho mayores; en nuestro ejemplo sería trivial al factor n , 3233 (obtenido de la clave pública de libre acceso) de nuevo al primos p y q . e , también de la clave pública, se invierte para obtener d , adquiriendo así la clave privada.
Las implementaciones prácticas usan el teorema del resto chino para acelerar el cálculo usando el módulo de factores (mod pq usando mod p y mod q ).
Los valores d p , d q y q inv , que forman parte de la clave privada se calculan de la siguiente manera:
Here is how dp, dq and qinv are used for efficient decryption. (Encryption is efficient by choice of a suitable d and e pair)
Signing messages
Suppose Alice uses Bob's public key to send him an encrypted message. In the message, she can claim to be Alice, but Bob has no way of verifying that the message was from Alice since anyone can use Bob's public key to send him encrypted messages. In order to verify the origin of a message, RSA can also be used to sign a message.
Suppose Alice wishes to send a signed message to Bob. She can use her own private key to do so. She produces a hash value of the message, raises it to the power of d (modulo n) (as she does when decrypting a message), and attaches it as a "signature" to the message. When Bob receives the signed message, he uses the same hash algorithm in conjunction with Alice's public key. He raises the signature to the power of e (modulo n) (as he does when encrypting a message), and compares the resulting hash value with the message's hash value. If the two agree, he knows that the author of the message was in possession of Alice's private key, and that the message has not been tampered with since being sent.
This works because of exponentiation rules:
Thus, the keys may be swapped without loss of generality, that is a private key of a key pair may be used either to:
- Decrypt a message only intended for the recipient, which may be encrypted by anyone having the public key (asymmetric encrypted transport).
- Encrypt a message which may be decrypted by anyone, but which can only be encrypted by one person; this provides a digital signature.
Pruebas de corrección
Proof using Fermat's little theorem
The proof of the correctness of RSA is based on Fermat's little theorem, stating that ap − 1 ≡ 1 (mod p) for any integer a and prime p, not dividing a.
We want to show that
for every integer m when p and q are distinct prime numbers and e and d are positive integers satisfying ed ≡ 1 (mod λ(pq)).
Since λ(pq) = lcm(p − 1, q − 1) is, by construction, divisible by both p − 1 and q − 1, we can write
for some nonnegative integers h and k.[note 1]
To check whether two numbers, such as med and m, are congruent mod pq, it suffices (and in fact is equivalent) to check that they are congruent mod p and mod q separately. [note 2]
To show med ≡ m (mod p), we consider two cases:
- If m ≡ 0 (mod p), m is a multiple of p. Thus med is a multiple of p. So med ≡ 0 ≡ m (mod p).
- If m 0 (mod p),
- where we used Fermat's little theorem to replace mp−1 mod p with 1.
The verification that med ≡ m (mod q) proceeds in a completely analogous way:
- If m ≡ 0 (mod q), med is a multiple of q. So med ≡ 0 ≡ m (mod q).
- If m 0 (mod q),
This completes the proof that, for any integer m, and integers e, d such that ed ≡ 1 (mod λ(pq)),
Notes:
- ^ In particular, the statement above holds for any e and d that satisfy ed ≡ 1 (mod (p − 1)(q − 1)), since (p − 1)(q − 1) is divisible by λ(pq), and thus trivially also by p − 1 and q − 1. However, in modern implementations of RSA, it is common to use a reduced private exponent d that only satisfies the weaker, but sufficient condition ed ≡ 1 (mod λ(pq)).
- ^ This is part of the Chinese remainder theorem, although it is not the significant part of that theorem.
Proof using Euler's theorem
Although the original paper of Rivest, Shamir, and Adleman used Fermat's little theorem to explain why RSA works, it is common to find proofs that rely instead on Euler's theorem.
We want to show that med ≡ m (mod n), where n = pq is a product of two different prime numbers and e and d are positive integers satisfying ed ≡ 1 (mod φ(n)). Since e and d are positive, we can write ed = 1 + hφ(n) for some non-negative integer h. Assuming that m is relatively prime to n, we have
where the second-last congruence follows from Euler's theorem.
More generally, for any e and d satisfying ed ≡ 1 (mod λ(n)), the same conclusion follows from Carmichael's generalization of Euler's theorem, which states that mλ(n) ≡ 1 (mod n) for all m relatively prime to n.
When m is not relatively prime to n, the argument just given is invalid. This is highly improbable (only a proportion of 1/p + 1/q − 1/(pq) numbers have this property), but even in this case, the desired congruence is still true. Either m ≡ 0 (mod p) or m ≡ 0 (mod q), and these cases can be treated using the previous proof.
Relleno
Attacks against plain RSA
There are a number of attacks against plain RSA as described below.
- When encrypting with low encryption exponents (e.g., e = 3) and small values of the m, (i.e., m < n1/e) the result of me is strictly less than the modulus n. In this case, ciphertexts can be decrypted easily by taking the eth root of the ciphertext over the integers.
- If the same clear text message is sent to e or more recipients in an encrypted way, and the receivers share the same exponent e, but different p, q, and therefore n, then it is easy to decrypt the original clear text message via the Chinese remainder theorem. Johan Håstad noticed that this attack is possible even if the cleartexts are not equal, but the attacker knows a linear relation between them.[22] This attack was later improved by Don Coppersmith (see Coppersmith's attack).[23]
- Because RSA encryption is a deterministic encryption algorithm (i.e., has no random component) an attacker can successfully launch a chosen plaintext attack against the cryptosystem, by encrypting likely plaintexts under the public key and test if they are equal to the ciphertext. A cryptosystem is called semantically secure if an attacker cannot distinguish two encryptions from each other, even if the attacker knows (or has chosen) the corresponding plaintexts. As described above, RSA without padding is not semantically secure.[24]
- RSA has the property that the product of two ciphertexts is equal to the encryption of the product of the respective plaintexts. That is m1em2e ≡ (m1m2)e (mod n). Because of this multiplicative property a chosen-ciphertext attack is possible. E.g., an attacker who wants to know the decryption of a ciphertext c ≡ me (mod n) may ask the holder of the private key d to decrypt an unsuspicious-looking ciphertext c′ ≡ cre (mod n) for some value r chosen by the attacker. Because of the multiplicative property c′ is the encryption of mr (mod n). Hence, if the attacker is successful with the attack, they will learn mr (mod n) from which they can derive the message m by multiplying mr with the modular inverse of r modulo n.[citation needed]
- Given the private exponent d one can efficiently factor the modulus n = pq. And given factorization of the modulus n = pq, one can obtain any private key (d',n) generated against a public key (e',n).[15]
Padding schemes
To avoid these problems, practical RSA implementations typically embed some form of structured, randomized padding into the value m before encrypting it. This padding ensures that m does not fall into the range of insecure plaintexts, and that a given message, once padded, will encrypt to one of a large number of different possible ciphertexts.
Standards such as PKCS#1 have been carefully designed to securely pad messages prior to RSA encryption. Because these schemes pad the plaintext m with some number of additional bits, the size of the un-padded message M must be somewhat smaller. RSA padding schemes must be carefully designed so as to prevent sophisticated attacks that may be facilitated by a predictable message structure. Early versions of the PKCS#1 standard (up to version 1.5) used a construction that appears to make RSA semantically secure. However, at Crypto 1998, Bleichenbacher showed that this version is vulnerable to a practical adaptive chosen ciphertext attack. Furthermore, at Eurocrypt 2000, Coron et al.[25] showed that for some types of messages, this padding does not provide a high enough level of security. Later versions of the standard include Optimal Asymmetric Encryption Padding (OAEP), which prevents these attacks. As such, OAEP should be used in any new application, and PKCS#1 v1.5 padding should be replaced wherever possible. The PKCS#1 standard also incorporates processing schemes designed to provide additional security for RSA signatures, e.g. the Probabilistic Signature Scheme for RSA (RSA-PSS).
Secure padding schemes such as RSA-PSS are as essential for the security of message signing as they are for message encryption. Two USA patents on PSS were granted (USPTO 6266771 and USPTO 70360140); however, these patents expired on 24 July 2009 and 25 April 2010, respectively. Use of PSS no longer seems to be encumbered by patents.[original research?] Note that using different RSA key-pairs for encryption and signing is potentially more secure.[26]
Consideraciones prácticas y de seguridad
Using the Chinese remainder algorithm
For efficiency many popular crypto libraries (such as OpenSSL, Java and .NET) use the following optimization for decryption and signing based on the Chinese remainder theorem. The following values are precomputed and stored as part of the private key:
- and : the primes from the key generation,
- ,
- and
- .
These values allow the recipient to compute the exponentiation m = cd (mod pq) more efficiently as follows:
- (if then some[clarification needed] libraries compute h as )
This is more efficient than computing exponentiation by squaring even though two modular exponentiations have to be computed. The reason is that these two modular exponentiations both use a smaller exponent and a smaller modulus.
Integer factorization and RSA problem
The security of the RSA cryptosystem is based on two mathematical problems: the problem of factoring large numbers and the RSA problem. Full decryption of an RSA ciphertext is thought to be infeasible on the assumption that both of these problems are hard, i.e., no efficient algorithm exists for solving them. Providing security against partial decryption may require the addition of a secure padding scheme.[27]
The RSA problem is defined as the task of taking eth roots modulo a composite n: recovering a value m such that c ≡ me (mod n), where (n, e) is an RSA public key and c is an RSA ciphertext. Currently the most promising approach to solving the RSA problem is to factor the modulus n. With the ability to recover prime factors, an attacker can compute the secret exponent d from a public key (n, e), then decrypt c using the standard procedure. To accomplish this, an attacker factors n into p and q, and computes lcm(p − 1, q − 1) that allows the determination of d from e. No polynomial-time method for factoring large integers on a classical computer has yet been found, but it has not been proven that none exists. See integer factorization for a discussion of this problem.
Multiple polynomial quadratic sieve (MPQS) can be used to factor the public modulus n.
The first RSA-512 factorization in 1999 used hundreds of computers and required the equivalent of 8,400 MIPS years, over an elapsed time of approximately seven months.[28] By 2009, Benjamin Moody could factor an RSA-512 bit key in 73 days using only public software (GGNFS) and his desktop computer (a dual-core Athlon64 with a 1,900 MHz cpu). Just less than five gigabytes of disk storage was required and about 2.5 gigabytes of RAM for the sieving process.
Rivest, Shamir, and Adleman noted [2] that Miller has shown that – assuming the truth of the Extended Riemann Hypothesis – finding d from n and e is as hard as factoring n into p and q (up to a polynomial time difference).[29] However, Rivest, Shamir, and Adleman noted, in section IX/D of their paper, that they had not found a proof that inverting RSA is as hard as factoring.
As of 2020[update], the largest publicly known factored RSA number was 829 bits (250 decimal digits, RSA-250).[30] Its factorization, by a state-of-the-art distributed implementation, took approximately 2700 CPU years. In practice, RSA keys are typically 1024 to 4096 bits long. In 2003, RSA Security estimated that 1024-bit keys were likely to become crackable by 2010.[31] As of 2020, it is not known whether such keys can be cracked, but minimum recommendations have moved to at least 2048 bits.[32] It is generally presumed that RSA is secure if n is sufficiently large, outside of quantum computing.
If n is 300 bits or shorter, it can be factored in a few hours in a personal computer, using software already freely available. Keys of 512 bits have been shown to be practically breakable in 1999 when RSA-155 was factored by using several hundred computers, and these are now factored in a few weeks using common hardware. Exploits using 512-bit code-signing certificates that may have been factored were reported in 2011.[33] A theoretical hardware device named TWIRL, described by Shamir and Tromer in 2003, called into question the security of 1024 bit keys.[31]
In 1994, Peter Shor showed that a quantum computer – if one could ever be practically created for the purpose – would be able to factor in polynomial time, breaking RSA; see Shor's algorithm.
Faulty key generation
Finding the large primes p and q is usually done by testing random numbers of the correct size with probabilistic primality tests that quickly eliminate virtually all of the nonprimes.
The numbers p and q should not be "too close", lest the Fermat factorization for n be successful. If p − q is less than 2n1/4 (n = p * q, which even for small 1024-bit values of n is 3×1077) solving for p and q is trivial. Furthermore, if either p − 1 or q − 1 has only small prime factors, n can be factored quickly by Pollard's p − 1 algorithm, and hence such values of p or q should be discarded.
It is important that the private exponent d be large enough. Michael J. Wiener showed that if p is between q and 2q (which is quite typical) and d < n1/4/3, then d can be computed efficiently from n and e.[34]
There is no known attack against small public exponents such as e = 3, provided that the proper padding is used. Coppersmith's Attack has many applications in attacking RSA specifically if the public exponent e is small and if the encrypted message is short and not padded. 65537 is a commonly used value for e; this value can be regarded as a compromise between avoiding potential small exponent attacks and still allowing efficient encryptions (or signature verification). The NIST Special Publication on Computer Security (SP 800-78 Rev 1 of August 2007) does not allow public exponents e smaller than 65537, but does not state a reason for this restriction.
In October 2017, a team of researchers from Masaryk University announced the ROCA vulnerability, which affects RSA keys generated by an algorithm embodied in a library from Infineon known as RSALib. A large number of smart cards and trusted platform modules (TPMs) were shown to be affected. Vulnerable RSA keys are easily identified using a test program the team released.[35]
Importance of strong random number generation
A cryptographically strong random number generator, which has been properly seeded with adequate entropy, must be used to generate the primes p and q. An analysis comparing millions of public keys gathered from the Internet was carried out in early 2012 by Arjen K. Lenstra, James P. Hughes, Maxime Augier, Joppe W. Bos, Thorsten Kleinjung and Christophe Wachter. They were able to factor 0.2% of the keys using only Euclid's algorithm.[36][37]
They exploited a weakness unique to cryptosystems based on integer factorization. If n = pq is one public key and n′ = p′q′ is another, then if by chance p = p′ (but q is not equal to q′), then a simple computation of gcd(n,n′) = p factors both n and n′, totally compromising both keys. Lenstra et al. note that this problem can be minimized by using a strong random seed of bit-length twice the intended security level, or by employing a deterministic function to choose q given p, instead of choosing p and q independently.
Nadia Heninger was part of a group that did a similar experiment. They used an idea of Daniel J. Bernstein to compute the GCD of each RSA key n against the product of all the other keys n′ they had found (a 729 million digit number), instead of computing each gcd(n,n′) separately, thereby achieving a very significant speedup since after one large division, the GCD problem is of normal size.
Heninger says in her blog that the bad keys occurred almost entirely in embedded applications, including "firewalls, routers, VPN devices, remote server administration devices, printers, projectors, and VOIP phones" from more than 30 manufacturers. Heninger explains that the one-shared-prime problem uncovered by the two groups results from situations where the pseudorandom number generator is poorly seeded initially, and then is reseeded between the generation of the first and second primes. Using seeds of sufficiently high entropy obtained from key stroke timings or electronic diode noise or atmospheric noise from a radio receiver tuned between stations should solve the problem.[38]
Strong random number generation is important throughout every phase of public key cryptography. For instance, if a weak generator is used for the symmetric keys that are being distributed by RSA, then an eavesdropper could bypass RSA and guess the symmetric keys directly.
Timing attacks
Kocher described a new attack on RSA in 1995: if the attacker Eve knows Alice's hardware in sufficient detail and is able to measure the decryption times for several known ciphertexts, Eve can deduce the decryption key d quickly. This attack can also be applied against the RSA signature scheme. In 2003, Boneh and Brumley demonstrated a more practical attack capable of recovering RSA factorizations over a network connection (e.g., from a Secure Sockets Layer (SSL)-enabled webserver)[39] This attack takes advantage of information leaked by the Chinese remainder theorem optimization used by many RSA implementations.
One way to thwart these attacks is to ensure that the decryption operation takes a constant amount of time for every ciphertext. However, this approach can significantly reduce performance. Instead, most RSA implementations use an alternate technique known as cryptographic blinding. RSA blinding makes use of the multiplicative property of RSA. Instead of computing cd (mod n), Alice first chooses a secret random value r and computes (rec)d (mod n). The result of this computation, after applying Euler's Theorem, is rcd (mod n) and so the effect of r can be removed by multiplying by its inverse. A new value of r is chosen for each ciphertext. With blinding applied, the decryption time is no longer correlated to the value of the input ciphertext, and so the timing attack fails.
Adaptive chosen ciphertext attacks
In 1998, Daniel Bleichenbacher described the first practical adaptive chosen ciphertext attack, against RSA-encrypted messages using the PKCS #1 v1 padding scheme (a padding scheme randomizes and adds structure to an RSA-encrypted message, so it is possible to determine whether a decrypted message is valid). Due to flaws with the PKCS #1 scheme, Bleichenbacher was able to mount a practical attack against RSA implementations of the Secure Sockets Layer protocol, and to recover session keys. As a result of this work, cryptographers now recommend the use of provably secure padding schemes such as Optimal Asymmetric Encryption Padding, and RSA Laboratories has released new versions of PKCS #1 that are not vulnerable to these attacks.
Side-channel analysis attacks
A side-channel attack using branch prediction analysis (BPA) has been described. Many processors use a branch predictor to determine whether a conditional branch in the instruction flow of a program is likely to be taken or not. Often these processors also implement simultaneous multithreading (SMT). Branch prediction analysis attacks use a spy process to discover (statistically) the private key when processed with these processors.
Simple Branch Prediction Analysis (SBPA) claims to improve BPA in a non-statistical way. In their paper, "On the Power of Simple Branch Prediction Analysis",[40] the authors of SBPA (Onur Aciicmez and Cetin Kaya Koc) claim to have discovered 508 out of 512 bits of an RSA key in 10 iterations.
A power fault attack on RSA implementations was described in 2010.[41] The author recovered the key by varying the CPU power voltage outside limits; this caused multiple power faults on the server.
Implementaciones
Some cryptography libraries that provide support for RSA include:
- Botan
- Bouncy Castle
- cryptlib
- Crypto++
- Libgcrypt
- Nettle
- OpenSSL
- wolfCrypt
- GnuTLS
- mbed TLS
- LibreSSL
Ver también
- Acoustic cryptanalysis
- Computational complexity theory
- Cryptographic key length
- Diffie–Hellman key exchange
- Key exchange
- Key management
- Elliptic-curve cryptography
- Public-key cryptography
- Trapdoor function
Referencias
- ^ Smart, Nigel (February 19, 2008). "Dr Clifford Cocks CB". Bristol University. Retrieved August 14, 2011.
- ^ a b c d e f Rivest, R.; Shamir, A.; Adleman, L. (February 1978). "A Method for Obtaining Digital Signatures and Public-Key Cryptosystems" (PDF). Communications of the ACM. 21 (2): 120–126. CiteSeerX 10.1.1.607.2677. doi:10.1145/359340.359342. S2CID 2873616.
- ^ Casteivecchi, Davide, Quantum-computing pioneer warns of complacency over Internet security, Nature, October 30, 2020 interview of Peter Shor
- ^ Diffie, W.; Hellman, M.E. (November 1976). "New directions in cryptography". IEEE Transactions on Information Theory. 22 (6): 644–654. CiteSeerX 10.1.1.37.9720. doi:10.1109/TIT.1976.1055638. ISSN 0018-9448.
- ^ Rivest, Ronald. "The Early Days of RSA -- History and Lessons" (PDF).
- ^ Calderbank, Michael (2007-08-20). "The RSA Cryptosystem: History, Algorithm, Primes" (PDF).
- ^ a b Robinson, Sara (June 2003). "Still Guarding Secrets after Years of Attacks, RSA Earns Accolades for its Founders" (PDF). SIAM News. 36 (5).
- ^ Cocks, C.C. (20 November 1973). "A Note on Non-Secret Encryption" (PDF). www.gchq.gov.uk. Retrieved 2017-05-30.
- ^ Jim Sauerberg "From Private to Public Key Ciphers in Three Easy Steps".
- ^ Margaret Cozzens and Steven J. Miller. "The Mathematics of Encryption: An Elementary Introduction". p. 180.
- ^ Alasdair McAndrew. "Introduction to Cryptography with Open-Source Software". p. 12.
- ^ Surender R. Chiluka. "Public key Cryptography".
- ^ Neal Koblitz. "Cryptography As a Teaching Tool". Cryptologia, Vol. 21, No. 4 (1997).
- ^ "RSA Security Releases RSA Encryption Algorithm into Public Domain". Archived from the original on June 21, 2007. Retrieved 2010-03-03.
- ^ a b Boneh, Dan (1999). "Twenty Years of attacks on the RSA Cryptosystem". Notices of the American Mathematical Society. 46 (2): 203–213.
- ^ Applied Cryptography, John Wiley & Sons, New York, 1996. Bruce Schneier, p. 467
- ^ McKee, James; Pinch, Richard (1998). "Further Attacks on Server-Aided RSA Cryptosystems". CiteSeerX 10.1.1.33.1333. Cite journal requires
|journal=
(help) - ^ A Course in Number Theory and Cryptography, Graduate Texts in Math. No. 114, Springer-Verlag, New York, 1987. Neal Koblitz, Second edition, 1994. p. 94
- ^ Dukhovni, Viktor (July 31, 2015). "common factors in (p − 1) and (q − 1)". openssl-dev (Mailing list).
- ^ Dukhovni, Viktor (August 1, 2015). "common factors in (p − 1) and (q − 1)". openssl-dev (Mailing list).
- ^ Johnson, J.; Kaliski, B. (February 2003). Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1. Network Working Group. doi:10.17487/RFC3447. RFC 3447. Retrieved 9 March 2016.
- ^ Håstad, Johan (1986). "On using RSA with Low Exponent in a Public Key Network". Advances in Cryptology — CRYPTO '85 Proceedings. Lecture Notes in Computer Science. 218. pp. 403–408. doi:10.1007/3-540-39799-X_29. ISBN 978-3-540-16463-0.
- ^ Coppersmith, Don (1997). "Small Solutions to Polynomial Equations, and Low Exponent RSA Vulnerabilities" (PDF). Journal of Cryptology. 10 (4): 233–260. CiteSeerX 10.1.1.298.4806. doi:10.1007/s001459900030. S2CID 15726802.
- ^ S. Goldwasser and S. Micali, Probabilistic encryption & how to play mental poker keeping secret all partial information, Annual ACM Symposium on Theory of Computing, 1982.
- ^ Coron, Jean-Sébastien; Joye, Marc; Naccache, David; Paillier, Pascal (2000). Preneel, Bart (ed.). "New Attacks on PKCS#1 v1.5 Encryption". Advances in Cryptology — EUROCRYPT 2000. Lecture Notes in Computer Science. Berlin, Heidelberg: Springer. 1807: 369–381. doi:10.1007/3-540-45539-6_25. ISBN 978-3-540-45539-4.
- ^ "RSA Algorithm".
- ^ Machie, Edmond K. (29 March 2013). Network security traceback attack and react in the United States Department of Defense network. p. 167. ISBN 978-1466985742.
- ^ Lenstra, Arjen; et al. (Group) (2000). "Factorization of a 512-bit RSA Modulus" (PDF). Eurocrypt.
- ^ Miller, Gary L. (1975). "Riemann's Hypothesis and Tests for Primality" (PDF). Proceedings of Seventh Annual ACM Symposium on Theory of Computing. pp. 234–239.
- ^ Zimmermann, Paul (2020-02-28). "Factorization of RSA-250". Cado-nfs-discuss.
- ^ a b Kaliski, Burt (2003-05-06). "TWIRL and RSA Key Size". RSA Laboratories. Archived from the original on 2017-04-17. Retrieved 2017-11-24.
- ^ Barker, Elaine; Dang, Quynh (2015-01-22). "NIST Special Publication 800-57 Part 3 Revision 1: Recommendation for Key Management: Application-Specific Key Management Guidance" (PDF). National Institute of Standards and Technology: 12. doi:10.6028/NIST.SP.800-57pt3r1. Retrieved 2017-11-24. Cite journal requires
|journal=
(help) - ^ Sandee, Michael (November 21, 2011). "RSA-512 certificates abused in-the-wild". Fox-IT International blog.
- ^ Wiener, Michael J. (May 1990). "Cryptanalysis of short RSA secret exponents" (PDF). IEEE Transactions on Information Theory. 36 (3): 553–558. doi:10.1109/18.54902.
- ^ Nemec, Matus; Sys, Marek; Svenda, Petr; Klinec, Dusan; Matyas, Vashek (November 2017). "The Return of Coppersmith's Attack: Practical Factorization of Widely Used RSA Moduli" (PDF). Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security. CCS '17. doi:10.1145/3133956.3133969.
- ^ Markoff, John (February 14, 2012). "Flaw Found in an Online Encryption Method". The New York Times.
- ^ Lenstra, Arjen K.; Hughes, James P.; Augier, Maxime; Bos, Joppe W.; Kleinjung, Thorsten; Wachter, Christophe (2012). "Ron was wrong, Whit is right" (PDF). Cite journal requires
|journal=
(help) - ^ Heninger, Nadia (February 15, 2012). "New research: There's no need to panic over factorable keys–just mind your Ps and Qs". Freedom to Tinker.
- ^ Brumley, David; Boneh, Dan (2003). "Remote timing attacks are practical" (PDF). Proceedings of the 12th Conference on USENIX Security Symposium. SSYM'03.
- ^ Acıiçmez, Onur; Koç, Çetin Kaya; Seifert, Jean-Pierre (2007). "On the power of simple branch prediction analysis". Proceedings of the 2nd ACM Symposium on Information, Computer and Communications Security. ASIACCS '07. pp. 312–320. CiteSeerX 10.1.1.80.1438. doi:10.1145/1229285.1266999 (inactive 2021-05-25).CS1 maint: DOI inactive as of May 2021 (link)
- ^ Pellegrini, Andrea; Bertacco, Valeria; Austin, Todd (2010). "Fault-Based Attack of RSA Authentication" (PDF). Cite journal requires
|journal=
(help)
Otras lecturas
- Menezes, Alfred; van Oorschot, Paul C.; Vanstone, Scott A. (October 1996). Handbook of Applied Cryptography. CRC Press. ISBN 978-0-8493-8523-0.
- Cormen, Thomas H.; Leiserson, Charles E.; Rivest, Ronald L.; Stein, Clifford (2001). Introduction to Algorithms (2nd ed.). MIT Press and McGraw-Hill. pp. 881–887. ISBN 978-0-262-03293-3.
enlaces externos
- The Original RSA Patent as filed with the U.S. Patent Office by Rivest; Ronald L. (Belmont, MA), Shamir; Adi (Cambridge, MA), Adleman; Leonard M. (Arlington, MA), December 14, 1977, U.S. Patent 4,405,829.
- PKCS #1: RSA Cryptography Standard (RSA Laboratories website)
- The PKCS #1 standard "provides recommendations for the implementation of public-key cryptography based on the RSA algorithm, covering the following aspects: cryptographic primitives; encryption schemes; signature schemes with appendix; ASN.1 syntax for representing keys and for identifying the schemes".
- Explanation of RSA using colored lamps on YouTube
- Thorough walk through of RSA
- Prime Number Hide-And-Seek: How the RSA Cipher Works
- Onur Aciicmez, Cetin Kaya Koc, Jean-Pierre Seifert: On the Power of Simple Branch Prediction Analysis
- Example of an RSA implementation with PKCS#1 padding (GPL source code)
- Kocher's article about timing attacks
- An animated explanation of RSA with its mathematical background by CrypTool
- Grime, James. "RSA Encryption". Numberphile. Brady Haran.
- How RSA Key used for Encryption in real world