B’s setup:

  • choose two n-digit prime numbers at random
  • B’s PK (public key) is pair where
  • e is a small integer relatively prime to
  • Private: computes d st.

public key private key - needs to keep private.

A (sender):

  • connects message into an integer m
  • looks up B’s public key
  • computes
  • sends encrypted y

B (decrypt): computes

Questions we should ask

  1. Is this correct? Does ?
  2. Can we do the steps efficiently?
  3. Why do we think this is secure?

Question 1: Correctness

Fermat's Little Theorem

If p is prime and , then

Given: Want to show:

Therefore is divisible by N. Therefore is divisible by p and Z

by definition of congruence

Therefore is divisible by p and by q.

How do you compute d st. using Extended Euclidean Algorithm?

Bob picks n-digit x at random 
tests if x prime
	if yes, log x
	if no, pick another random until success
  1. How likely is it for x to be prime?
  2. How do you test it?

For #2, to test if x is prime

  • pick a < x at random
  • Compute
  • if y = 1, true
  • if y != 1, false

If x is true, accept (Fermat’s Little Theorem)

There are some composite x’s (not prime numbers) that always pass the test - Charmichael Numbers These can still be tested for

Randomized Algorithm

Why is the system secure?