010010010010001111111001010101100000101110011101010001010101010110101110101110011101010001010101010111010100101000111010100010101010101110101001010101010010101011100111010100010100110011101010001010101110101101010101110101001010010101010111010100101010101001010010101010010010111001110101000101010101011101010010101001101100101101

public key

Cryptography

Daniel Zhao / Analysis 2H

Cryptography is the process of communicating using encoded messages

Alice

Bob

Eve

What's it used for? A lot.

Eve

HOW CRYPTOGRAPHY WORKS

plaintext

1

2

encryption function & key

ciphertext

3

4

decryption function & key

plaintext

5

Alice

Bob

PUBLIC KEY CRYPTOgraphy:

One key is not enough.

That's why we all need two!

One is public

One is private

RSA CRYPTOgraphy:

One of the most popular forms of public key cryptography

p and q are prime numbers.

THEY're KINDA large. Like 200 digits large.

LET N = Pq

Hint: You would die first. De nada for the hint.

if you didn't know P or Q, how long would it take you to factor N?

1

2

REMEMBER 4th GRADE? Oh the good ol' days, no analysis back then.

the days when ÷ 2 = 2 R1. Well, they're back!

mod m = r

m is called the modulus

r is the remainder of a ÷ m

a ≡ b (mod m)

if a and b have the same remainder when divided by m

(not the formal definition)

3

EULER got a little bored one day.

2.718... wasn't enough, so he created the totient function.

is the number of integers less than n that are coprime with n, where n is a positive integer

\phi(n)
ϕ(n)
\phi(pq) = \phi(p)\phi(q)
ϕ(pq)=ϕ(p)ϕ(q)
\phi(p) = p-1
ϕ(p)=p1

It's multiplicative:

And if p is prime:

WE're READY for rsa.

Bob chooses two large primes p and q, and finds n = pq.

He calculates: 

\phi(N) = \phi(pq) = \phi(p)\phi(q) = (p-1)(q-1)
ϕ(N)=ϕ(pq)=ϕ(p)ϕ(q)=(p1)(q1)

He selects e within 1 < e < φ(N)

He finds the modular inverse d of e using:

de = 1 \text{ }(\text{mod } \phi(N))
de=1 (mod ϕ(N))

(N, e) is Bob's public key

(N, d) is Bob's private key

CONTINUED

Alice

Bob

wants to send a message, m, to

1

Alice encrypts her message m by finding:

(N, e) is Bob's public key

(N, d) is Bob's private key

c = m^e \text{ }(\text{mod } N)
c=me (mod N)

2

Alice sends her cryptotext c to Bob

3

Bob decrypts the message m by finding:

m = c^d \text{ }(\text{mod } N)
m=cd (mod N)
m = c^d = (m^e)^d = m^{ed}\text{ }(\text{mod } N)
m=cd=(me)d=med (mod N)

Notice:

due to the way d & e were calculated:

m = m^{ed}
m=med

why is rsa secure?

Alice

Bob

sends the encrypted message, c, to

(N, e) is Bob's public key

(N, d) is Bob's private key

Let's say Eve gets her hands on c and (N, e)

de = 1 \text{ }(\text{mod } \phi(N))
de=1 (mod ϕ(N))

She needs (N, d) to decrypt c

Couldn't she just calculate d using                             ?

YOU ASK:

NO, SHE CANNOT!

(N, e) is Bob's public key

(N, d) is Bob's private key

de = 1 \text{ }(\text{mod } \phi(N))
de=1 (mod ϕ(N))

To calculate d using                                    , Eve needs to know the value of           

\phi(N)
ϕ(N)
\phi(N) = \phi(pq) = \phi(p)\phi(q) = (p-1)(q-1)
ϕ(N)=ϕ(pq)=ϕ(p)ϕ(q)=(p1)(q1)

And in order to find           , she must use this equation and factor N into p and q, then find their totients, because N by itself is too large to calculate a totient:

\phi(N)
ϕ(N)

But N is too large to factor into p and q

So mwahaha, Eve cannot decrypt the message!

WEAKNESSES

What if someone came along and said they could factor any large number ?

THAT'S WHY CRYPTOGRApHY IS CONSTANTLY ADVANCING.

Then that invalidates the security of the entire RSA system!

Why do we EVEN NEED cryptography?

Do you want to be able to log in to your email without fearing that your house is going to be robbed the next day?

I sure do.

010010010010001111111001010101100000101110011101010001010101010110101110101110011101010001010101010111010100101000111010100010101010101110101001010101010010101011100111010100010100110011101010001010101110101101010101110101001010010101010111010100101010101001010010101010010010111001110101000101010101011101010010101001101100101101

Public Key Cryptography

By Daniel Zhao

Public Key Cryptography

  • 643