Week 2 - RSA Flashcards
What is RSA?
used to generate a public + private key pair
what is the first step?
Identify 2 large distinct prime numbers P and Q
What is Step 2 (calculate n)?
n = p * q
What is Euler’s function ϕ(n), and how is it calculated for RSA?
number of positive integers up to value of n, co prime with n
ϕ(n)=(p−1)(q−1)
what is the public key in RSA?
e
e must be < ϕ(n) (euler’s function) and a COPRIME (prime and not a factor)
e is paired with n (e,n) <- public key
How is the private key
D calculated in RSA?
d = e^-1 mod (ϕ(n) )
(d,n) <- private key
hat are the RSA encryption and decryption formulas?
Encryption=(plaintext)^e mod n
Decryption= (ciphertext)^d mod (n)
Toy example
p = 5 q = 11
n = 5 * 11 = 55
ϕ(n)=(5−1)(11−1)
= 4 * 10
= 40
e < 40 & e must be a prime and not be a factor
e = 7
d = 7 ^-1 mod (40)
7 d= 1 mod (40)
d = 23
public key = (7,55)
private key = (23,55)
Encryption (public key)
p = 2
2^7 mod 55 = 18
Decryption (privatekey)
C = 18
18^23 mod 55 = 2