RSA

What
RSA is a public key cryptosystem that relies on a one-way trapdoor function to ensure security

Multiplicative Property
$$(m_1 \times m_2)^e \equiv m_1^e \times m_2^e \equiv c_1^e \times c_2^e (modN)$$

Vulnerabilities
The basic RSA definition is vulnerable in the following way

Chosen Ciphertext Attack
If we assume that the attacker has the standard set of resources available during a chosen ciphertext attack, then we get a decryption service. If we capture a ciphertext $$c$$ that we want decrypted, then we just pass $$r^ec$$ to our decryption box where $$r$$ is a random number and it should give us $$c^d \equiv rm(modN)$$. We then divide this result modulo $$r$$ and we obtain the original plaintext message

Key Generation

 * 1) Pick prime numbers $$p$$ and $$q$$
 * 2) Compute $$n = pq$$
 * 3) Compute $$\phi(n) = (p-1)(q-1)$$
 * 4) Pick $$e$$ coprime to $$\phi(n)$$
 * 5) compute $$d^{-1}=e(mod\phi(n))$$
 * 6) Publish $$(N, e)$$ as the public key and keep $$d$$ as the private key.

Encryption
Given the message $$m$$, we can compute the ciphertext by computing:

$$c = m^e(mod(n))$$

Decryption
Given the ciphertext $$c$$, we can compute the plaintext by computing:

$$m = c^d(mod(n))$$