Public key cryptography and RSA Flashcards

1
Q

What is a one-way function?

A

Easy to compute f(x) given x, but computationally hard to compute f^-1(y) = x given y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Name 2 one-way functions

A

Multiplication of large primes: inverse is integer factorisation

Exponentiation: Inverse if taking discrete logarithms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a trap-door one-way function?

A

A one-way function, that given some additional information it is easy to compute f^-1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe public key cryptography

A

Asymmetric

enc/dec uses different keys

Enc: public
Dec: Private

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are some benefits of public key cryptography?

A

Simplified key management - don’t need key sharing

Digital signatures can be obtained

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does public key work?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a downside of public key encryption?

A

Computatinally much more expensive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe hybrid encryption

A

Use public key cryptography to encrypt random key for a symmetric-key encryption algorithm

Encrypt the M using this symmetric key

  1. B chooses random symmetric K, finds A’s public key PKa, computes C1 = E(K, PKa)
  2. B computes C2 = E_symmetric(M, K)
  3. B sends (C1, C2) to A
  4. A recovers k=Dec(C1, SKa) and then M=Ds(C2, k)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is RSA?

A

Public-key cryptosystem and digital signature scheme

Based on integer factorisation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How are keys generated in RSA?

A
  1. Pick p, q randomly from a set of primes of a certain size
  2. n=pq
  3. Select e randomly with gcd(e, Ø(n)) = 1
    Ø(n) = (p-1)(q-1)
  4. Compute d = e^-1 mod Ø(n)
  5. Public: (n, e)
  6. Private: (p, q, d)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Describe RSA encryption

A

K_E = (n, e): public key

  1. Input: M, 0 < M < n
    2 . C = E(M, K_E) = M^e mod n
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Describe RSA decryption

A

K_D = d: private key

  1. D(C, K_D) = C^d mod n = M
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are some applications of RSA?

A

Digital signatures

Key distribution for symmetric-key encryption (hybrid encryption)

Authentication

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are some issues RSA need to handle?

A
  1. Key generation (choice of e, generating large primes)
  2. enc- and dec-algorithms (fast exponentiation, CRT for decryption)
  3. formatting data (padding)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How are primes generated for RSA?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the prime number theorem say?

A

The primes thin out as the numbers get larger

p(x) is all prime numbers less than.
The theorem says that the ratio of p(x) and x/ln(x) tends to 1 as x gets large.

This can be used to have a rule of thumb saying that the proportion of prime numbers up to size x is ln(x)

17
Q

How should e be selected in RSA?

A

Chosen at random

A smaller value of e can have a large effect on efficiency, though have possible security problems

18
Q

How is d selected in RSA?

A

To avoid known attacks, d should be at least square(n)

19
Q

What is fast exponentiation?

A

Basic idea behind it is square and multiply algorithm

20
Q

What is the square and multiply algorithm?

A

e in binary representation (ei are bits):
e = e02^0 + e12^1 + … + ek*2^k

Use the bits of e (ei)

M^e = m^e0 * (m^2)^e1 * (m^4)^e2(m^2^k)^ek

21
Q

Why is padding used in RSA?

A

RSA with messages encoded as numbers without padding is weak.

Possible attacks:
- dictionary of known plaintext
- Guess plain, check if it encrypts to cipher
- Håstads attack

Padding is used to prepare for encryption. Padding includes redundancy and randomness

22
Q

What is Håstad’s attack?

A

Same message is encrypted without padding to multiple (3) recipients

Suppose the public exponent e=3 is used by all recipients

The cryptanalysis has 3 ciphertexts:
c1 = m^3 mod n1
c2 = m^3 mod n2
c3 = m^3 mod n3

These can be solved using CRT to obtain m^3

23
Q

Name 2 types of padding

A

PKCS #1

OAEP: Optimal Asymmetric Encryption Padding

24
Q

What is the PKCS #1 block format?

A

00 02 PS 00 D

00 and 02: bytes
PS: Pseudo random string of non-zero bytes (min 8 bytes)
D: Data to be encrypted

blocklength: Same as modulus

25
Q

What is the OAEP format?

A

OAEP is an encoding algorithm

The scheme includes k0 bits of randomness and k1 bits of redundancy into the message before encryption

2 hash functions G and H are used

26
Q

What is Miller theorem?

A

Determining d from e and n is as hard as factorising n

27
Q

What is Miller’s algorithm?

A

Define u,v such that ed-1 = 2^v * u, u is odd

consider the sequence a^u, a^2u,…,a^(2^vu), a^((2^v)u) mod n, a is random and 0 < a < n

there exist a square root of 1 somewhere in this sequence

With probability at least 0.5 the sequence contains a non-trivial square root of 1 mod n, thereby revealing the factors of n

if not, choose a new a and repeat

28
Q

What are 3 types of side channel attacks?

A

Timing attacks, power analysis, fault analysis

29
Q

What are timing attacks?

A

Use timing of private key operations to obtain info about the key.

For square-and-multiply:
Performs either a squaring or a square+multiplication in each step

Multiplication included when exponent bit is 1

These steps takes around twice as long

30
Q

What are power analysis?

A

Uses power usage profile of the private key operations to obtain info about the private key

31
Q

What are fault analysis?

A

Measure the effect of interfering with the private key operations to obtain information about the private key

32
Q

What are some countermeasures to side channel attacks?

A

Compute in constant time: when ei=0, run dummy multiplication

Montgomery ladder: Makes every operation depend on the key to avoid som fault attacks

Randomising the RSA message - mitigates “differential” attacks by preventing multiple timings on the same operation

33
Q

Summarize RSA

A

Should always use standardised padding

Factorisation of the modulus is the best known attack, in case where standardised padding is used

Finding private key from public is as hard as factorising the modulus

It is an open problem wether there is another way of breaking, besides factorising

34
Q

How secure is RSA?

A

An adversary would need to find the prime factors p and q of n.

From these, the attacker would be able to recover the private key d.

RSA is as hard to break as the RSA-problem.

It is as hard to find the private key from the public key, as it is factorising the modulus.