Transcript Lecture 9

Introduction to
Cryptography
Lecture 9
Public – Key Cryptosystems
Each participant has a public key and
a private key.
 It should be infeasible to determine the
private key from knowledge of the
public key.

Public – Key Cryptosystems
message
Alice
Bob
Bob encrypts message using Alice’s
public key
 Alice decrypt message using her
private key

Prime Numbers
Definition: A prime number is an integer
number that has only two divisors: one
and itself.
Example: 1, 2,17, 31.
 Prime numbers distributed irregularly
among the integers
 There are infinitely many prime numbers
Factoring
The Fundamental Theorem of Arithmetic
tells us that every positive integer can
be written as a product of powers of
primes in essentially one way.
Example: 6647  17 2  23

90  2  3  5
2
The RSA Public – Key Cryptosystem
In 1978, Ronald Rives, Adi Shamir, and
Leonard Adelman wrote a paper called “A
Method for Obtaining Digital Signatures
and Public Key Cryptosystem”.
 They described a cipher system in which
senders encrypt message using a method
and a key that are publicly distributed.

The RSA Public – Key Cryptosystem
Alice:
 Selects two prime numbers p and q.
 Calculates m = pq and n = (p - 1)(q - 1).
 Selects number e relatively prime to n
 Finds inverse of e modulo n
 Publishes e and m
The RSA Public – Key Cryptosystem
To encrypt the message x:
e
y

x
mod m .
 Bob computes:
 Bob sends y to Alice.
To Decrypt the message y:
d
 Alice computes: x  y mod m .
The RSA Public – Key Cryptosystem
Example:
 p =127, q = 223.
 Then m = 28321 and n = 27972
 Let e = 5623, check gcd(n,e) = 1.
 Then using Extended Euclidean Algorithm
d = 22495.
 Public Key: (5623, 28321).
The RSA Public – Key Cryptosystem
Example:
 Let the message be x = 3620.
5623
y

3620
mod 28321  27845.
 Then
 Alice gets one and decrypts it
22495
mod 28321  3620.
 Then x  27845
The RSA Public – Key Cryptosystem

Why does this method work?
y d  ( x e mod m) d  ( x e ) d mod m  x ed mod m  x.

Last step is a little bit more complicate
How secure is RSA?
 Can opponent deduce d and n from (m,e)?


The opponent can find n and d only if he can
factor m.
Factoring
Problem of factoring a number is very hard
 Fermat’s factoring method sometimes can
be used to find any large factors of a
number fair quickly (pg.251)
 Want to make sure Fermat’s factoring
method does not work for your key
 p and q should be at least 155 decimal
digits each

Homework
Read pg.286-293.
 Exercises: 2(a), 4(c), 5(a) on pg.294.
 Those questions will be a part of your
collected homework.
