Public key cryptography and RSA Flashcards
What is a one-way function?
Easy to compute f(x) given x, but computationally hard to compute f^-1(y) = x given y
Name 2 one-way functions
Multiplication of large primes: inverse is integer factorisation
Exponentiation: Inverse if taking discrete logarithms
What is a trap-door one-way function?
A one-way function, that given some additional information it is easy to compute f^-1
Describe public key cryptography
Asymmetric
enc/dec uses different keys
Enc: public
Dec: Private
What are some benefits of public key cryptography?
Simplified key management - don’t need key sharing
Digital signatures can be obtained
How does public key work?
A stores public key PKa
Anyone can use this to encrypt a message:
Enc(M, PKa)
Only A can decrypt the message using the private key SKa:
Dec(C, SKa)
What is a downside of public key encryption?
Computatinally much more expensive
Describe hybrid encryption
Use public key cryptography to encrypt random key for a symmetric-key encryption algorithm
Encrypt the M using this symmetric key
- B chooses random symmetric K, finds A’s public key PKa, computes C1 = E(K, PKa)
- B computes C2 = E_symmetric(M, K)
- B sends (C1, C2) to A
- A recovers k=Dec(C1, SKa) and then M=Ds(C2, k)
What is RSA?
Public-key cryptosystem and digital signature scheme
Based on integer factorisation
How are keys generated in RSA?
- Pick p, q randomly from a set of primes of a certain size
- n=pq
- Select e randomly with gcd(e, Ø(n)) = 1
Ø(n) = (p-1)(q-1) - Compute d = e^-1 mod Ø(n)
- Public: (n, e)
- Private: (p, q, d)
Describe RSA encryption
K_E = (n, e): public key
- Input: M, 0 < M < n
2 . C = E(M, K_E) = M^e mod n
Describe RSA decryption
K_D = d: private key
- D(C, K_D) = C^d mod n = M
What are some applications of RSA?
Digital signatures
Key distribution for symmetric-key encryption (hybrid encryption)
Authentication
What are some issues RSA need to handle?
- Key generation (choice of e, generating large primes)
- enc- and dec-algorithms (fast exponentiation, CRT for decryption)
- formatting data (padding)
How are primes generated for RSA?
p and q should be random and of a chosen length (recommended to at least 1024 bits)
Simple method of selecting a random prime:
1. Select random odd number of required length
2. Check if prime (i.e. Miller-Rabin)
2.1: yes - output this number
2.2: no - increment r by 2 and go to previous step