RSA (Cryptosystem) : 1 History

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

RSA (cryptosystem)

For other uses, see RSA (disambiguation).

RSA is one of the first practicable public-key cryptosys-


tems and is widely used for secure data transmission. In
such a cryptosystem, the encryption key is public and
differs from the decryption key which is kept secret.
In RSA, this asymmetry is based on the practical diffi-
culty of factoring the product of two large prime num-
bers, the factoring problem. RSA stands for Ron Rivest,
Adi Shamir and Leonard Adleman, who first publicly de-
scribed the algorithm in 1977. Clifford Cocks, an En-
glish mathematician, had developed an equivalent system
in 1973, but it wasn't declassified until 1997.[1]
A user of RSA creates and then publishes a public key
based on the two large prime numbers, along with an
auxiliary value. The prime numbers must be kept se-
cret. Anyone can use the public key to encrypt a mes-
sage, but with currently published methods, if the pub-
lic key is large enough, only someone with knowledge of
the prime numbers can feasibly decode the message.[2]
Breaking RSA encryption is known as the RSA problem.
It is an open question whether it is as hard as the factoring
problem.

1 History Adi Shamir, one of the authors of RSA: Rivest, Shamir and
Adleman
The RSA algorithm was publicly described in 1977 by
Ron Rivest, Adi Shamir, and Leonard Adleman at MIT;
the letters RSA are the initials of their surnames, listed an encoding device and to at least one terminal
in the same order as on the paper.[3] having a decoding device. A message-to-be-
transferred is enciphered to ciphertext at the
MIT was granted U.S. Patent 4,405,829 for a “Crypto- encoding terminal by encoding the message as
graphic communications system and method” that used a number M in a predetermined set. That num-
the algorithm, on September 20, 1983. Though the patent ber is then raised to a first predetermined power
was going to expire on September 21, 2000 (the term of (associated with the intended receiver) and fi-
patent was 17 years at the time), the algorithm was re- nally computed. The remainder or residue, C,
leased to the public domain by RSA Security on Septem- is... computed when the exponentiated number
ber 6, 2000, two weeks earlier.[4] Since a paper describ- is divided by the product of two predetermined
ing the algorithm had been published in August 1977,[3] prime numbers (associated with the intended
prior to the December 1977 filing date of the patent ap- receiver).
plication, regulations in much of the rest of the world
precluded patents elsewhere and only the US patent was
granted. Had Cocks’ work been publicly known, a patent Clifford Cocks, an English mathematician working for
in the US might not have been possible, either. the UK intelligence agency GCHQ, described an equiva-
lent system in an internal document in 1973, but given the
From the DWPI's abstract of the patent, relatively expensive computers needed to implement it at
the time, it was mostly considered a curiosity and, as far
The system includes a communications as is publicly known, was never deployed. His discovery,
channel coupled to at least one terminal having however, was not revealed until 1998 due to its top-secret

1
2 2 OPERATION

classification, and Rivest, Shamir, and Adleman devised The public key consists of the modulus n and the public
RSA independently of Cocks’ work. (or encryption) exponent e. The private key consists of
the modulus n and the private (or decryption) exponent
d, which must be kept secret. p, q, and φ(n) must also be
2 Operation kept secret because they can be used to calculate d.

The RSA algorithm involves three steps: key generation, • An alternative, used by PKCS#1, is to choose d
encryption and decryption. matching de ≡ 1 (mod λ) with λ = lcm(p − 1, q −
1), where lcm is the least common multiple. Using
λ instead of φ(n) allows more choices for d. λ can
2.1 Key generation also be defined using the Carmichael function, λ(n).
• The ANSI X9.31 standard prescribes, IEEE 1363
RSA involves a public key and a private key. The public
describes, and PKCS#1 allows, that p and q match
key can be known by everyone and is used for encrypt-
additional requirements: being strong primes, and
ing messages. Messages encrypted with the public key
being different enough that Fermat factorization
can only be decrypted in a reasonable amount of time us-
fails.
ing the private key. The keys for the RSA algorithm are
generated the following way:
2.2 Encryption
1. Choose two distinct prime numbers p and q.
Alice transmits her public key (n, e) to Bob and keeps the
• For security purposes, the integers p and q private key d secret. Bob then wishes to send message M
should be chosen at random, and should be of to Alice.
similar bit-length. Prime integers can be effi-
ciently found using a primality test. He first turns M into an integer m, such that 0 ≤ m <
n by using an agreed-upon reversible protocol known as
2. Compute n = pq. a padding scheme. He then computes the ciphertext c
corresponding to
• n is used as the modulus for both the public
and private keys. Its length, usually expressed
in bits, is the key length.
c ≡ me (mod n)
3. Compute φ(n) = φ(p)φ(q) = (p − 1)(q − 1) = n - (p
+ q −1), where φ is Euler’s totient function. This can be done efficiently, even for 500-bit numbers,
using Modular exponentiation. Bob then transmits c to
4. Choose an integer e such that 1 < e < φ(n) and gcd(e, Alice.
φ(n)) = 1; i.e., e and φ(n) are coprime. Note that at least nine values of m will yield a ciphertext
• e is released as the public key exponent. c equal to m,[note 1] but this is very unlikely to occur in
practice.
• e having a short bit-length and small Hamming
weight results in more efficient encryption –
most commonly 216 + 1 = 65,537. However, 2.3 Decryption
much smaller values of e (such as 3) have been
shown to be less secure in some settings.[5] Alice can recover m from c by using her private key ex-
ponent d via computing
5. Determine d as d ≡ e−1 (mod φ(n)); i.e., d is the
multiplicative inverse of e (modulo φ(n)).
m ≡ cd (mod n)
• This is more clearly stated as:
solve for d given d⋅e ≡ 1 (mod Given m, she can recover the original message M by re-
φ(n)) versing the padding scheme.
• This is often computed using (In practice, there are more efficient methods of calculat-
the extended Euclidean algo- ing cd using the precomputed values below.)
rithm. Using the pseudocode
in the Modular integers sec-
tion, inputs a and n correspond 2.4 A worked example
to e and φ(n), respectively.
• d is kept as the private key ex- Here is an example of RSA encryption and decryption.
ponent. The parameters used here are artificially small, but one
2.5 Signing messages 3

can also use OpenSSL to generate and examine a real key- the public key, we could then compute d and so acquire
pair. the private key.
Practical implementations use the Chinese remainder
1. Choose two distinct prime numbers, such as theorem to speed up the calculation using modulus of fac-
tors (mod pq using mod p and mod q).
p = 61 and q = 53
The values dp, dq and qᵢ ᵥ, which are part of the private
2. Compute n = pq giving key are computed as follows:
n = 61 × 53 = 3233
dp = d mod (p − 1) = 2753 mod (61 − 1) = 53
3. Compute the totient of the product as φ(n) = (p −
dq = d mod (q − 1) = 2753 mod (53 − 1) = 49
1)(q − 1) giving
qinv = q −1 mod p = 53−1 mod 61 = 38
φ(3233) = (61 − 1)(53 − 1) = 3120 ⇒ (qinv × q) mod p = 38 × 53 mod 61 = 1

4. Choose any number 1 < e < 3120 that is coprime to Here is how dp, dq and qᵢ ᵥ are used for efficient decryp-
3120. Choosing a prime number for e leaves us only tion. (Encryption is efficient by choice of public exponent
to check that e is not a divisor of 3120. e)

e = 17
m1 = cdp mod p = 279053 mod 61 = 4
5. Compute d, the modular multiplicative inverse of e m2 = cdq mod q = 279049 mod 53 = 12
(mod φ(n)) yielding, h = (qinv × (m1 − m2 )) mod p = (38 × −8) mod 61 = 1
d = 2753 m = m2 + h × q = 12 + 1 × 53 = 65
Worked example for the modular multi-
plicative inverse:
2.5 Signing messages
e × d mod φ(n) = 1
17 × 2753 mod 3120 = 1 Suppose Alice uses Bob's public key to send him an en-
crypted message. In the message, she can claim to be
The public key is (n = 3233, e = 17). For a padded Alice but Bob has no way of verifying that the message
plaintext message m, the encryption function is was actually 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
17
c(m) = m mod 3233 message.
Suppose Alice wishes to send a signed message to Bob.
The private key is (n = 3233, d = 2753). For an en- She can use her own private key to do so. She produces
crypted ciphertext c, the decryption function is 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
m(c) = c2753 mod 3233 receives the signed message, he uses the same hash algo-
rithm in conjunction with Alice’s public key. He raises
For instance, in order to encrypt m = 65, we calculate 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 actual hash value. If the
c = 6517 mod 3233 = 2790 two agree, he knows that the author of the message was
in possession of Alice’s private key, and that the message
To decrypt c = 2790, we calculate has not been tampered with since.

m = 27902753 mod 3233 = 65 3 Proofs of correctness


Both of these calculations can be computed efficiently
using the square-and-multiply algorithm for modular ex- 3.1 Proof using Fermat’s little theorem
ponentiation. In real-life situations the primes selected
would be much larger; in our example it would be trivial The proof of the correctness of RSA is based on Fermat’s
to factor n, 3233 (obtained from the freely available pub- little theorem. This theorem states that if p is prime and
lic key) back to the primes p and q. Given e, also from p does not divide an integer a then
4 4 PADDING

where the second-last congruence follows from the


Euler’s theorem.
ap−1 ≡ 1 (mod p)
When m is not relatively prime to n, the argument just
We want to show that (me )d ≡ m (mod pq) for every inte- given is invalid. This is highly improbable (only a pro-
ger m when p and q are distinct prime numbers and e and portion of 1/p + 1/q − 1/(pq) numbers have this property),
d are positive integers satisfying 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.
ed ≡ 1 (mod (p − 1)(q − 1)).

We can write 4 Padding

ed − 1 = h(p − 1)(q − 1) 4.1 Attacks against plain RSA

for some nonnegative integer h. There are a number of attacks against plain RSA as de-
scribed below.
To check two numbers, like med and m, are congruent
mod pq it suffices (and in fact is equivalent) to check they
• When encrypting with low encryption exponents
are congruent mod p and mod q separately. (This is part
(e.g., e = 3) and small values of the m, (i.e., m <
of the Chinese remainder theorem, although it is not the
n1/e ) the result of me is strictly less than the modulus
significant part of that theorem.) To show med ≡ m (mod
p), we consider two cases: m ≡ 0 (mod p) and m ̸≡ 0 (mod n. In this case, ciphertexts can be easily decrypted
by taking the eth root of the ciphertext over the in-
p).
tegers.
In the first case med is a multiple of p, so med ≡ 0 ≡ m
(mod p). In the second case • If the same clear text message is sent to e or more re-
cipients in an encrypted way, and the receivers share
the same exponent e, but different p, q, and there-
( p−1 )h(q−1)
ed
m =m (ed−1)
m=m h(p−1)(q−1)
m= m m ≡ 1 fore n,m
h(q−1) then
≡ itmis easy
(modto decrypt
p) the original clear text
message via the Chinese remainder theorem. Johan
where we used Fermat’s little theorem to replace mp−1 Håstad noticed that this attack is possible even if the
mod p with 1. cleartexts are not equal, but the attacker knows a lin-
ear relation between them.[6] This attack was later
The verification that med ≡ m (mod q) proceeds in a sim-
improved by Don Coppersmith.[7]
ilar way, treating separately the cases m ≡ 0 (mod q) and
m ̸≡ 0 (mod q), using Fermat’s little theorem for modulus
q in the second case. See also: Coppersmith’s Attack

This completes the proof that, for any integer m,


• Because RSA encryption is a deterministic encryp-
tion algorithm (i.e., has no random component) an
d
(me ) ≡ m (mod pq) attacker can successfully launch a chosen plaintext
attack against the cryptosystem, by encrypting likely
plaintexts under the public key and test if they are
3.2 Proof using Euler’s theorem equal to the ciphertext. A cryptosystem is called
semantically secure if an attacker cannot distinguish
Although the original paper of Rivest, Shamir, and Adle- two encryptions from each other even if the attacker
man used Fermat’s little theorem to explain why RSA knows (or has chosen) the corresponding plaintexts.
works, it is common to find proofs that rely instead on As described above, RSA without padding is not se-
Euler’s theorem. mantically secure.
We want to show that med ≡ m (mod n), where n = pq is
• RSA has the property that the product of two ci-
a product of two different prime numbers and e and d are
phertexts is equal to the encryption of the product of
positive integers satisfying ed ≡ 1 (mod φ(n)). Since e and
the respective plaintexts. That is m1 e m2 e ≡ (m1 m2 )e
d are positive, we can write ed = 1 + hφ(n) for some non-
(mod n). Because of this multiplicative property
negative integer h. Assuming that m is relatively prime to
a chosen-ciphertext attack is possible. E.g., an at-
n, we have
tacker, who wants to know the decryption of a ci-
phertext c ≡ me (mod n) may ask the holder of the
( )h private key to decrypt an unsuspicious-looking ci-
med = m1+hφ(n) = m mφ(n) ≡ m(1)h ≡ m (mod n) phertext c′ ≡ cre (mod n) for some value r chosen by
5.1 Using the Chinese remainder algorithm 5

the attacker. Because of the multiplicative property 5.1 Using the Chinese remainder algo-
c′ is the encryption of mr (mod n). Hence, if the rithm
attacker is successful with the attack, he will learn
mr (mod n) from which he can derive the message For efficiency many popular crypto libraries (like
m by multiplying mr with the modular inverse of r OpenSSL, Java and .NET) use the following optimization
modulo n. for decryption and signing based on the Chinese remain-
der theorem. The following values are precomputed and
stored as part of the private key:

4.2 Padding schemes • p and q : the primes from the key generation,

• dP = d (mod p − 1) ,
To avoid these problems, practical RSA implementa-
tions typically embed some form of structured, random- • dQ = d (mod q − 1) and
ized padding into the value m before encrypting it. This
padding ensures that m does not fall into the range of in- • qinv = q −1 (mod p) .
secure plaintexts, and that a given message, once padded,
will encrypt to one of a large number of different possible These values allow the recipient to compute the exponen-
ciphertexts. tiation m = cd (mod pq) more efficiently as follows:
Standards such as PKCS#1 have been carefully designed
to securely pad messages prior to RSA encryption. Be- • m1 = cdP (mod p)
cause these schemes pad the plaintext m with some num-
• m2 = cdQ (mod q)
ber of additional bits, the size of the un-padded message
M must be somewhat smaller. RSA padding schemes • h = qinv (m1 − m2 ) (mod p) (if m1 < m2
must be carefully designed so as to prevent sophisticated then some libraries compute h as qinv (m1 + p −
attacks which may be facilitated by a predictable message m2 ) (mod p) )
structure. Early versions of the PKCS#1 standard (up
to version 1.5) used a construction that appears to make • m = m2 + hq
RSA semantically secure. However, at Eurocrypt 2000,
Coron et al. showed that for some types of messages, this This is more efficient than computing m ≡ cd (mod pq)
padding does not provide a high enough level of security. even though two modular exponentiations have to be
Furthermore, at Crypto 1998, Bleichenbacher showed computed. The reason is that these two modular expo-
that this version is vulnerable to a practical adaptive cho- nentiations both use a smaller exponent and a smaller
sen ciphertext attack. Later versions of the standard in- modulus.
clude 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 5.2 Integer factorization and RSA prob-
should be replaced wherever possible. The PKCS#1 stan- lem
dard also incorporates processing schemes designed to
provide additional security for RSA signatures (e.g., the See also: RSA Factoring Challenge, Integer factorization
Probabilistic Signature Scheme for RSA/RSA-PSS). records and Shor’s algorithm
Secure padding schemes such as RSA-PSS are as es-
sential for the security of message signing as they are The security of the RSA cryptosystem is based on two
for message encryption. Two US patents on PSS were mathematical problems: the problem of factoring large
granted (USPTO 6266771 and USPTO 70360140); how- numbers and the RSA problem. Full decryption of an
ever, these patents expired on 24 July 2009 and 25 April RSA ciphertext is thought to be infeasible on the assump-
2010, respectively. Use of PSS no longer seems to be tion that both of these problems are hard, i.e., no effi-
encumbered by patents. Note that using different RSA cient algorithm exists for solving them. Providing secu-
key-pairs for encryption and signing is potentially more rity against partial decryption may require the addition of
secure.[8][9] a secure padding scheme.
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
5 Security and practical considera- RSA ciphertext. Currently the most promising approach
to solving the RSA problem is to factor the modulus n.
tions With the ability to recover prime factors, an attacker can
compute the secret exponent d from a public key (n, e),
6 5 SECURITY AND PRACTICAL CONSIDERATIONS

then decrypt c using the standard procedure. To accom- values of p or q should therefore be discarded as well.
plish this, an attacker factors n into p and q, and computes It is important that the private key d be large enough.
(p − 1)(q − 1) which allows the determination of d from Michael J. Wiener showed[14] that if p is between q and
e. No polynomial-time method for factoring large inte- 2q (which is quite typical) and d < n1/4 /3, then d can be
gers on a classical computer has yet been found, but it computed efficiently from n and e.
has not been proven that none exists. See integer factor-
ization for a discussion of this problem. Rivest, Shamir There is no known attack against small public exponents
and Adleman note[2] that Miller has shown that – assum- such as e = 3, provided that proper padding is used.
ing the Extended Riemann Hypothesis – finding d from n Coppersmith’s Attack has many applications in attacking
and e is as hard as factoring n into p and q (up to a poly- RSA specifically if the public exponent e is small and if
nomial time difference).[10] However, Rivest, Shamir and the encrypted message is short and not padded. 65537 is a
Adleman note (in section IX / D of their paper) that they commonly used value for e; this value can be regarded as
have not found a proof that inverting RSA is equally hard a compromise between avoiding potential small exponent
as factoring. attacks and still allowing efficient encryptions (or signa-
ture verification). The NIST Special Publication on Com-
As of 2010, the largest factored RSA number was 768 puter Security (SP 800-78 Rev 1 of August 2007) does
bits long (232 decimal digits, see RSA-768). Its factor- not allow public exponents e smaller than 65537, but does
ization, by a state-of-the-art distributed implementation, not state a reason for this restriction.
took around fifteen hundred CPU years (two years of real
time, on many hundreds of computers). This means that,
at this date, no larger RSA key has been factored. In prac-
tice, RSA keys are typically 1024 to 2048 bits long. Some 5.4 Importance of strong random number
experts believe that 1024-bit keys may become break- generation
able in the near future (though this is disputed); few see
any way that 4096-bit keys could be broken in the fore- A cryptographically strong random number generator,
seeable future. Therefore, it is generally presumed that which has been properly seeded with adequate entropy,
RSA is secure if n is sufficiently large. If n is 300 bits must be used to generate the primes p and q. An anal-
or shorter, it can be factored in a few hours on a personal ysis comparing millions of public keys gathered from
computer, using software already freely available. Keys the Internet was carried out in early 2012 by Arjen K.
of 512 bits have been shown to be practically breakable in Lenstra, James P. Hughes, Maxime Augier, Joppe W.
1999 when RSA-155 was factored by using several hun- Bos, Thorsten Kleinjung and Christophe Wachter. They
dred computers and are now factored in a few weeks us- were able to factor 0.2% of the keys using only Euclid’s
[15][16]
ing common hardware.[11] Exploits using 512-bit code- algorithm.
signing certificates that may have been factored were re- They exploited a weakness unique to cryptosystems based
ported in 2011.[12] A theoretical hardware device named on integer factorization. If n = pq is one public key and
TWIRL and described by Shamir and Tromer in 2003 n′ = p′q′ is another, then if by chance p = p′ (but q is
called into question the security of 1024 bit keys. It is cur- not equal to q'), then a simple computation of gcd(n,n′) =
rently recommended that n be at least 2048 bits long.[13] p factors both n and n′, totally compromising both keys.
In 1994, Peter Shor showed that a quantum computer (if Lenstra et al. note that this problem can be minimized
one could ever be practically created for the purpose) by using a strong random seed of bit-length twice the
would be able to factor in polynomial time, breaking intended security level, or by employing a deterministic
RSA; see Shor’s algorithm. function to choose q given p, instead of choosing p and q
independently.
Nadia Heninger was part of a group that did a similar
5.3 Faulty key generation experiment. They used an idea of Daniel J. Bernstein to
compute the GCD of each RSA key n against the product
See also: Coppersmith’s Attack and Wiener’s Attack of all the other keys n′ they had found (a 729 million digit
number), instead of computing each gcd(n,n′) separately,
Finding the large primes p and q is usually done by test- thereby achieving a very significant speedup since after
ing random numbers of the right size with probabilistic one large division the GCD problem is of normal size.
primality tests which quickly eliminate virtually all non- Heninger says in her blog that the bad keys occurred al-
primes. most entirely in embedded applications, including “fire-
Numbers p and q should not be 'too close', lest the Fermat walls, routers, VPN devices, remote server administra-
factorization for n be successful, if p − q, for instance is tion devices, printers, projectors, and VOIP phones”
less than 2n1/4 (which for even small 1024-bit values of n from over 30 manufacturers. Heninger explains that the
is 3×1077 ) solving for p and q is trivial. Furthermore, if one-shared-prime problem uncovered by the two groups
either p − 1 or q − 1 has only small prime factors, n can be results from situations where the pseudorandom number
factored quickly by Pollard’s p − 1 algorithm, and these generator is poorly seeded initially and then reseeded be-
5.7 Side-channel analysis attacks 7

tween the generation of the first and second primes. Us- 5.7 Side-channel analysis attacks
ing seeds of sufficiently high entropy obtained from key
stroke timings or electronic diode noise or atmospheric A side-channel attack using branch prediction analysis
noise from a radio receiver tuned between stations should (BPA) has been described. Many processors use a branch
solve the problem.[17] predictor to determine whether a conditional branch in
the instruction flow of a program is likely to be taken or
Strong random number generation is important through-
not. Often these processors also implement simultaneous
out every phase of public key cryptography. For instance,
multithreading (SMT). Branch prediction analysis attacks
if a weak generator is used for the symmetric keys that are
use a spy process to discover (statistically) the private key
being distributed by RSA, then an eavesdropper could by-
when processed with these processors.
pass the RSA and guess the symmetric keys directly.
Simple Branch Prediction Analysis (SBPA) claims to im-
prove BPA in a non-statistical way. In their paper, “On
5.5 Timing attacks the Power of Simple Branch Prediction Analysis”,[19] the
authors of SBPA (Onur Aciicmez and Cetin Kaya Koc)
Kocher described a new attack on RSA in 1995: if the at- claim to have discovered 508 out of 512 bits of an RSA
tacker Eve knows Alice’s hardware in sufficient detail and key in 10 iterations.
is able to measure the decryption times for several known
A power fault attack on RSA implementations has been
ciphertexts, she can deduce the decryption key d quickly.
described in 2010.[20] The authors recovered the key by
This attack can also be applied against the RSA signature
varying the CPU power voltage outside limits; this caused
scheme. In 2003, Boneh and Brumley demonstrated a
multiple power faults on the server.
more practical attack capable of recovering RSA factor-
izations over a network connection (e.g., from a Secure
Socket Layer (SSL)-enabled webserver)[18] This attack
takes advantage of information leaked by the Chinese re- 6 See also
mainder theorem optimization used by many RSA imple-
mentations. • trapdoor function
One way to thwart these attacks is to ensure that the de- • Public-key cryptography
cryption operation takes a constant amount of time for ev-
ery ciphertext. However, this approach can significantly • Key exchange
reduce performance. Instead, most RSA implementa-
tions use an alternate technique known as cryptographic • Diffie–Hellman key exchange
blinding. RSA blinding makes use of the multiplicative • Key management
property of RSA. Instead of computing cd (mod n), Alice
first chooses a secret random value r and computes (re c)d • Cryptographic key length
(mod n). The result of this computation after applying
Euler’s Theorem is rcd (mod n) and so the effect of r can • Computational complexity theory
be removed by multiplying by its inverse. A new value • Acoustic cryptanalysis
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.
7 Notes
5.6 Adaptive chosen ciphertext attacks [1] Namely, the values of m which are equal to −1, 0, or 1
modulo p while also equal to −1, 0, or 1 modulo q. There
In 1998, Daniel Bleichenbacher described the first prac- will be more values of m having c = m if p − 1 or q − 1
has other divisors in common with e − 1 besides 2 because
tical adaptive chosen ciphertext attack, against RSA-
this gives more values of m such that me−1 (mod p) = 1
encrypted messages using the PKCS #1 v1 padding or me−1 (mod q) = 1 respectively.
scheme (a padding scheme randomizes and adds struc-
ture 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 8 References
to mount a practical attack against RSA implementations
of the Secure Socket Layer protocol, and to recover ses- [1] “Dr Clifford Cocks CB”. Bristol University. Retrieved
sion keys. As a result of this work, cryptographers now 2011-08-14.
recommend the use of provably secure padding schemes [2] Rivest, R.; Shamir, A.; Adleman, L. (1978). “A Method
such as Optimal Asymmetric Encryption Padding, and for Obtaining Digital Signatures and Public-Key Cryp-
RSA Laboratories has released new versions of PKCS #1 tosystems”. Communications of the ACM 21 (2): 120–
that are not vulnerable to these attacks. 126. doi:10.1145/359340.359342.
8 10 EXTERNAL LINKS

[3] Robinson, Sara (June 2003). “Still Guarding Secrets after 10 External links
Years of Attacks, RSA Earns Accolades for its Founders”.
SIAM News 36 (5). • The Original RSA Patent as filed with the U.S.
[4] RSA Security Releases RSA Encryption Algorithm into Patent Office by Rivest; Ronald L. (Belmont, MA),
Public Domain at the Wayback Machine (archived June Shamir; Adi (Cambridge, MA), Adleman; Leonard
21, 2007) M. (Arlington, MA), December 14, 1977, U.S.
[5] Boneh, Dan (1999). “Twenty Years of attacks on the RSA Patent 4,405,829.
Cryptosystem”. Notices of the American Mathematical So-
• PKCS #1: RSA Cryptography Standard (RSA Lab-
ciety 46 (2): 203–213.
oratories website)
[6] Håstad, Johan (1986). “On using RSA with Low Expo-
nent in a Public Key Network”. Advances in Cryptology • The PKCS #1 standard “provides recommenda-
— CRYPTO ’85 Proceedings. Lecture Notes in Computer tions for the implementation of public-key cryp-
Science 218. pp. 403–408. doi:10.1007/3-540-39799- tography based on the RSA algorithm, covering
X_29. the following aspects: cryptographic primitives;
encryption schemes; signature schemes with ap-
[7] Coppersmith, Don (1997). “Small Solutions to Poly-
nomial Equations, and Low Exponent RSA Vulnera- pendix; ASN.1 syntax for representing keys and
bilities”. Journal of Cryptology 10 (4): 233–260. for identifying the schemes”.
doi:10.1007/s001459900030.
• Explanation of RSA using colored lamps on
[8] http://stackoverflow.com/questions/5133246/ YouTube
what-is-the-purpose-of-using-separate-key-pairs-for-signing-and-encryption
• Thorough walk through of RSA
[9] http://www.di-mgt.com.au/rsa_alg.html#weaknesses
• Prime Number Hide-And-Seek: How the RSA Ci-
[10] Gary L. Miller, “Riemann’s Hypothesis and Tests for Pri-
mality” pher Works

[11] 518-bit GNFS with msieve • Onur Aciicmez, Cetin Kaya Koc, Jean-Pierre
Seifert: On the Power of Simple Branch Prediction
[12] RSA-512 certificates abused in-the-wild
Analysis
[13] Has the RSA algorithm been compromised as a result of
Bernstein’s Paper? What key size should I be using? • A New Vulnerability In RSA Cryptography, CAcert
NEWS Blog
[14] Wiener, Michael J. (May 1990). “Cryptanalysis of short
RSA secret exponents”. Information Theory, IEEE Trans- • Example of an RSA implementation with PKCS#1
actions on 36 (3): 553–558. doi:10.1109/18.54902. padding (GPL source code)
[15] Markoff, John (February 14, 2012). “Flaw Found in an • Kocher’s article about timing attacks
Online Encryption Method”. New York Times.
[16] “Ron was wrong, Whit is right”.
• An animated explanation of RSA with its mathe-
matical background by CrypTool
[17] https://freedom-to-tinker.com/blog/nadiah/
• A spreadsheet implementing RSA
new-research-theres-no-need-panic-over-factorable-keys-just-mind-your-ps-and-qs
[18] Remote timing attacks are practical. . SSYM'03 Proceed- • Hacking Secret Ciphers with Python, Chapter 24,
ings of the 12th conference on USENIX Security Sympo- Public Key Cryptography and the RSA Cipher
sium.
• Grime, James. “RSA Encryption”. Numberphile.
[19] http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.
1.1.80.1438&rep=rep1&type=pdf
Brady Haran.

[20] FaultBased Attack of RSA Authentication

9 Further reading
• Menezes, Alfred; van Oorschot, Paul C.; Vanstone,
Scott A. (October 1996). Handbook of Applied
Cryptography. CRC Press. ISBN 0-8493-8523-7.
• 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 0-262-03293-7.
9

11 Text and image sources, contributors, and licenses


11.1 Text
• RSA (cryptosystem) Source: http://en.wikipedia.org/wiki/RSA_(cryptosystem)?oldid=629909399 Contributors: Damian Yerrick, Axel-
Boldt, NathanBeach, LC, Lee Daniel Crocker, CYD, Mav, Tarquin, Dachshund, Arvindn, Ben-Zin, Heron, Willguzzo, Spiff, Nealmcb,
D, Michael Hardy, Booyabazooka, Axeloide, Ixfd64, Chinju, Cyde, Cameron Dewe, CesarB, Haakon, Darkwind, Julesd, Jll, Ci-
phergoth, Michael Shields, Zarius, Mydogategodshat, Timwi, Dcoetzee, Ww, Jitse Niesen, The Anomebot, Jogloran, DJ Clayworth,
ThomasStrohmann, Tg, Olathe, Pakaran, Frazzydee, Chuunen Baka, Robbot, Pfortuny, Jaredwf, Fredrik, Jredmond, Donreed, Securiger,
Rorro, Bkell, Ungvichian, Katmaikni, Lzur, Diberri, Jleedev, Superm401, Giftlite, Lunkwill, ShaunMacPherson, Wolfkeeper, Inkling,
Ianhowlett, Jason Quinn, Kravietz, Matt Crypto, Jackol, Pne, Edcolins, Neilc, Utcursch, Pgan002, CryptoDerk, B.d.mills, Urhixidur,
Shadypalm88, Doomstars, Mormegil, Perey, CALR, Limeheadnyc, Discospinster, Guanabot, Wrp103, ArnoldReinhold, Mani1, DonDiego,
Dmeranda, Bender235, TerraFrost, Xed, Longhair, .:Ajvol:., BenediktWildenhain, Sasquatch, Franl, Davidgothberg, Jakew, ClementSeveil-
lac, Jumbuck, OoberMick, Gargaj, Eric Kvaalen, Jeltz, Ciphergoth2, Bart133, Snowolf, MoraSique, Sivar, TheCoffee, Ceyockey, Kenyon,
Zntrip, Feezo, OwenX, Mindmatrix, Faithtear, Shreevatsa, LOL, Uncle G, Jok2000, Birge, Mckoss, Sneakums, Graham87, Neoeinstein,
Haikupoet, Ash211, Allenc28, Ligulem, FlaBot, KarlFrei, Admp, Elmer Clark, Ramiki, Krun, Pandas, Alvin-cs, Tylerl, Bgwhite, Jp-
kotta, Siddhant, YurikBot, Hawaiian717, Laurentius, Fgrieu, Hairy Dude, Wolfmankurd, RussBot, Tyler.szabo, Smerity, Zelmerszoetrop,
Rsrikanth05, Bullzeye, Accurrent, Wiki alf, Mipadi, Jmobarak, JoeBruno, RFBailey, Sdsouza, Mikeblas, Scs, Shiroi Hane, Maddog Bat-
tie, Fang Aili, Rlove, Peyna, HereToHelp, ArielGold, Johnpseudo, Marlasdad, Allens, BigaZon, GrinBot, Luk, Bigcheesegs, SmackBot,
Mmernex, Rljacobson, Kalebdf, F, Andres Agudelo, Bigbluefish, Unyoyega, Nomad421, Rouenpucelle, Eskimbot, Nil Einne, CTC1000,
Jushi, Bluebot, Comfortably Paranoid, Octahedron80, DHN-bot, Audriusa, Joerite, Madman91, Frap, KaiserbBot, Addshore, UU, Tinc-
torius, Moonrabbit, Daniel.Cardenas, Dririan, MOO, Andrei Stroe, SashatoBot, Nishkid64, Avuasku, DO11.10, J. Finkelstein, Ami-
Daniel, MagnaMopus, Trou, Stefan2, Goodnightmush, Michael miceli, Skatastic, Wikidrone, Stuidge, Big Smooth, MTSbot, Caiaffa,
MrDolomite, Possum, Kencf0618, IW-Bot-as, Ohad.cohen, Protoclysm, Twas Now, GDallimore, Freelance Intellectual, Tawkerbot2,
CmdrObot, Jngnyc, Geremia, Aherunar, PegArmPaul, Velle, Jesse Viviano, Shreyasjoshis, Tim1988, Cydebot, Ntsimp, Trevjos, Gogo
Dodo, Phildm, Cryptonaut, TGOO, Etienne.navarro, HermanFinster, Jameboy, Perogi, Kumar.varanasi, Thijs!bot, Jenovazero, Nuesken,
Uiteoi, RobHar, Escarbot, Mentifisto, AntiVandalBot, Thematrixeatsyou, Jq4bagiq, Awesomepenguin, GiM, Clamster5, Insrisg, Ran-
dom user 8384993, Yellowdesk, Kuteni, Paulcheffers, Deflective, QuantumEngineer, Gert7, Magioladitis, VoABot II, Catgut, Goodef-
fort, Rfellows, Ali'i, Papadopa, ANONYMOUS COWARD0xC0DE, DerHexer, AllenDowney, Stolsvik, Astgtciv, Ricardv46, Fluteflute,
Stealthound, MartinBot, DMJ001, Shmoolik, Trusilver, Silverxxx, Maurice Carbonaro, Cspan64, Josisb, Arronax50, DarkFalls, Mauro-
giachero, Ale2006, VolkovBot, CWii, Trevor Goodyear, Philip Trueman, JuneGloom07, NPrice, JhsBot, Leafyplant, Seb az86556, Ray
andrew, Museerouge, Bryanclair, Dirkbb, Endo999, Anna512, Jethro 82, Meuston, Chenzw, LittleBenW, Ishboyfay, Burgercat, SieBot, Ni-
hil novi, Yintan, Garde, Happysailor, Quest for Truth, Jariola, Oxymoron83, Steven Zhang, Mjacobsz, Svm1 63, Skippydo, OKBot, Danc-
ingPhilosopher, Svick, Tuntable, ClueBot, Annie Yousar, The Thing That Should Not Be, Jdgilbey, LizardJr8, Shannon bohle, Rockfang,
Acyclopedic, Alexbot, Heyjune1407, Alexanderwdark, Stealth500, Tyler, ChrisHodgesUK, Apparition11, Alastair Carnegie, DumZiBoT,
XLinkBot, Baudway, Willy411432, HotType918, StewieK, Dsimic, ColtM4, Addbot, Mortense, RPHv, Melab-1, Ronhjones, Frobitz,
Farbicky, ChenzwBot, Lightbot, Gail, Suwa, Legobot, Yobot, MarioS, Kilom691, Elsurexiste, THEN WHO WAS PHONE?, Anon117,
Jeffz1, Fleminggatan, AnomieBOT, Jim1138, JackieBot, AdjustShift, Materialscientist, Citation bot, RokerHRO, Papppfaffe, Arctic
Fox, Shinojvsekharan, S7evyn, Gensanders, Srich32977, AlSweigart, Kernel.package, Sissssou, FrescoBot, Nageh, TLange, Mido41854,
Cprivers, HamburgerRadio, I dream of horses, 10metreh, Foobarnix, Full-date unlinking bot, Toolnut, Capt. James T. Kirk, Vanished
user aoiowaiuyr894isdik43, Daftblight, TankMiche, JoachimSchipper, Shafaet, Saucam, Daniele.cordano, Kapilab, EmausBot, Skysmurf,
Immunize, Fly by Night, Ddas1989, ZéroBot, White Trillium, Fæ, AvicAWB, Quondum, D.Lazard, Doeboy278x, Erianna, FrankFlana-
gan, Mkooy, Donner60, JohSpaeth, Orange Suede Sofa, Rocketrod1960, Ebehn, Petrb, Mikhail Ryazanov, ClueBot NG, Samaraga, Andrei
S, Wiener’s Attack, Nedaljo, Braincricket, O.Koslowski, Widr, Dsperlich, Vibhijain, HMSSolent, BG19bot, Goodies4uall, Debastein,
Maartenvanrooijen, Alexwell, Mikelam98, Digital Brains, Kkkhaha, Rileychilds, Raj70, Purdygb, Aidalgol, Luisgrangeia, Yehudalindell,
Kodip, TwoTwoHello, Cmkrish555, Shweta1245, I-copeland, Razibot, Janra, Далайхүү, MortenEspensen, Yelnatz, Paulo Jorge Tomé,
Fa.famo1364, Lucy1982, Claw of Slime, Hdfjkghs, Kremlin tkol, Monkbot, Dsrana1212, Lurchikorpe, Brunosan12345, YowImTheTroll,
Hhamza82, Garfield Garfield, Pariah24, Dominic.Carlyle, Jwbouman and Anonymous: 746

11.2 Images
• File:Adi_Shamir_2009_crop.jpg Source: http://upload.wikimedia.org/wikipedia/commons/0/06/Adi_Shamir_2009_crop.jpg License:
CC-BY-SA-2.0 Contributors: http://www.flickr.com/photos/38872520@N00/3814143223/ Original artist: Ira Abramov from Even
Yehuda, Israel

11.3 Content license


• Creative Commons Attribution-Share Alike 3.0

You might also like