Background
Coprime
Integers and are said to be coprime if
Fermat’s Little Theorem
Suppose is prime and is any integer Then
Euler’s Totient Function
Let equal the number of positive integers less than n that are coprime to n Suppose for some primes and Then
Euler’s Theorem
Suppose and are coprime positive integers Then
Textbook Definition
Suppose two parties, Alice and Bob, wish to communicate securely. Bob wants to send an encrypted message to Alice without exchanging a shared private key.
1. Key Generation
- Alice and Bob agree on suitable parameters (i.e. size of the modulus and public exponent)
- Alice chooses two distinct and large primes, and , with a large difference between the two
- She compute the modulus
- She then computes Euler’s totient function,
- With public exponent such that , Alice publishes the pair
3. Encryption
- Bob encrypts message into ciphertext like so:
- Bob sends to Alice
4. Decryption
- Alice computes the private key, , as
- By the difficulty of integer factorization, Alice is the only one who knows and is therefore the only one who can compute
- She then computes to recover Bob’s message
Attacks on Textbook RSA
1. Low Public Exponent
For small , the plaintext is trivially recovered by computing the th root of like as .
2. Non-Coprime Moduli
If the same message is encrypted twice as and where , then either or can be factored easily by computing and . can be recovered by recomputing given and .
3. Håstad’s Broadcast
If the same message is encrypted using the same but a different modulus , ciphertexts are needed to recover .
Suppose an eavesdropper Eve intercepts where each . By the Chinese Remainder Thereom (CRT), Eve may compute , followed by . However, since , then . can thus be recovered in the same manner as the low public exponent attack.
4. Common Modulus
If the same message is encrypted using a different but the same modulus , only 2 ciphertexts are needed to recover if (1) , and (2) .
Suppose an eavesdropper Eve intercepts where and , and knows each and since they are public information.
First, by Bézout’s identity, Eve knows there exist integers and such that . She solves for and using the Extended Euclidean algorithm:
- Solving for : Let and invert under
- Since ,
- Solve for : Since and are known, reorder
Second, given and , she recovers like so:
- (by Bézout’s identity)
However, as will be negative (given and ‘s numerator computes ), it will have to be applied to ‘s inverse, .
Thus, to recover , Eve computes using public information.
5. Chosen Ciphertext Attack
Let denote for illustrative purposes.
RSA is partially-homomorphic: for two messages and ,
So, the product of two ciphertexts is equal to the encryption of the product of the respective plaintexts.
Suppose an attacker is given a ciphertext, and a decryption oracle that will decrypt anything except . If the attacker were to supply for some arbitrary integer to the oracle, it would happily decrypt since . However, since the attacker chose , they can recover by simply computing .