Rivest-Shamir-Adleman algorithm (RSA algorithm)
To set up the RSA algorithm you do the following:
- You pick 2 n-bit random primes
and . - You choose
relatively prime to . - You let
and you publish the public key . - You compute your private key
(mod ).
Then to encrypt a message
- Take a public key
. - You compute
(mod ). - Then you send message
.
Lastly to decipher the message using the private key you do the following.
- You receive the message
. - You calculate
(mod ). - Revel in your secrete knowledge.
Note this works from Euler’s theorem (modular arithmetic) as
Limitations
- gcd(m,N) = 1
- Otherwise the encrypted message
and share a common factor or and they can work out and using the extended Euclidean algorithm and work out .
- Otherwise the encrypted message
- Otherwise looking at the message mod
gives the wrong message. - This is normally gotten around by breaking the message up and giving it in little chunks.
- Otherwise looking at the message mod
- Otherwise they can just calculate the
‘th root to understand the message. - If
is too small then you normally augment it by a factor and encrypt sending afterwards to let the person know they need to subtract it.
- Otherwise they can just calculate the
- Can’t send the same
and out multiple times. - If you have 3 public keys
, and then using the Chinese remainder theorem you can recover the original message .
- If you have 3 public keys
- We assume factoring
is hard. - If it was not other people would be able to recover
and calculate .
- If it was not other people would be able to recover