Great Theoretical Ideas in Computer Science Lecture 27: - - PowerPoint PPT Presentation

great theoretical ideas in computer science
SMART_READER_LITE
LIVE PREVIEW

Great Theoretical Ideas in Computer Science Lecture 27: - - PowerPoint PPT Presentation

15-251 Great Theoretical Ideas in Computer Science Lecture 27: Cryptography What is cryptography about? Adversary Eavesdropper I will cut his throat I will cut his throat What is cryptography about? loru23n8uladjkfb!#@


slide-1
SLIDE 1

15-251 Great Theoretical Ideas in Computer Science

Lecture 27: Cryptography

slide-2
SLIDE 2

What is cryptography about?

“I will cut his throat” “I will cut his throat”

Adversary Eavesdropper

slide-3
SLIDE 3

What is cryptography about?

“I will cut his throat” “loru23n8uladjkfb!#@” “loru23n8uladjkfb!#@” “loru23n8uladjkfb!#@”

encryption

“I will cut his throat”

decryption

slide-4
SLIDE 4

What is cryptography about?

Study of protocols that avoid the bad affects of adversaries.

  • Computation on encrypted data?
  • Secure online voting schemes?
  • Digital signatures.
  • Zero-Knowledge Interactive Proofs:

Can I convince you that I have proved P=NP without giving you any information about the proof?

. . .

slide-5
SLIDE 5

Reasons to like cryptography

Can do pretty cool and unexpected things. Has many important applications. Is fundamentally related to computational complexity. Uses cool math (e.g. number theory). Applications of computationally hard problems. In fact, comp. complexity revolutionized cryptography.

slide-6
SLIDE 6

The plan

First, we will review modular arithmetic. Then we’ll talk about private (secret) key crypto. Finally, we’ll talk about public key cryptography.

slide-7
SLIDE 7

Review of Modular Arithmetic

slide-8
SLIDE 8

= remainder when you divide by 0 1 2 3 4 5 6 7 8 9 10 11 12 Example … 0 1 2 3 4 0 1 2 3 4 1 2 … We write or when . Can view the universe as .

slide-9
SLIDE 9

1 2 3 0 1 2 3 + 0 1 2 3 1 2 3 0 2 3 0 1 3 0 1 2 1 3 5 7 1 3 5 7

.

1 3 5 7 3 1 7 5 5 7 1 3 7 5 3 1

behaves nicely with respect to addition behaves nicely with respect to multiplication if prime, if distinct primes,

slide-10
SLIDE 10

1 2 3 4 1 2 3 4

.

1 2 3 2 4 1 3 1 4 4 3 2 4 3 2 1

2 and 3 are called generators.

4 1 4 1 4 1 4 1 1 3 4 2 1 3 4 2 1 1 2 4 3 1 2 4 3 1 1 1 1 1 1 1 1 1 1 1

slide-11
SLIDE 11

1 2 3 4 1 2 3 4

.

1 2 3 2 4 1 3 1 4 4 3 2 4 3 2 1 4 1 4 1 4 1 4 1 1 3 4 2 1 3 4 2 1 1 2 4 3 1 2 4 3 1 1 1 1 1 1 1 1 1 1 1

slide-12
SLIDE 12

Euler’s Theorem: For any , . Fermat’s Little Theorem: Let be a prime. For any ,

… … …

slide-13
SLIDE 13

When exponentiating elements , can think of the exponent living in the universe . IMPORTANT

slide-14
SLIDE 14

Algorithms for Modular Arithmetic

slide-15
SLIDE 15

> addition > subtraction > multiplication > division > exponentiation

Do regular addition. Then take mod N.

  • B = N-B. Then do addition.

Do regular multiplication. Then take mod N. Find B . Then do multiplication.

  • -1
slide-16
SLIDE 16

> addition > subtraction > multiplication > division > exponentiation

Do regular addition. Then take mod N.

  • B = N-B. Then do addition.

Do regular multiplication. Then take mod N. Find B . Then do multiplication.

  • -1

exists iff Our modification of Euclid’s Alg. computes given B and N.

slide-17
SLIDE 17

> addition > subtraction > multiplication > division > exponentiation

Do regular addition. Then take mod N.

  • B = N-B. Then do addition.

Do regular multiplication. Then take mod N. Find B . Then do multiplication.

  • -1

repeatedly square and mod to compute powers of two then multiply those mod n as neccessary

slide-18
SLIDE 18

> addition > subtraction > multiplication > division > exponentiation

Do regular addition. Then take mod N.

  • B = N-B. Then do addition.

Do regular multiplication. Then take mod N. Find B . Then do multiplication.

  • -1

repeatedly square and mod to compute powers of two then multiply those mod n as neccessary

What about roots and logarithms?

slide-19
SLIDE 19

Arithmetic in Two inverse functions: too big ??? ???

slide-20
SLIDE 20

Arithmetic in Two inverse functions: too big easy easy

slide-21
SLIDE 21

In easy

(1881676371789154860897069, 3) 123456789

easy

(48519278097689642681155855396759336072749841943521979872827, 3)

123

(do binary search and exponentiation) (keep dividing by B)

slide-22
SLIDE 22

Arithmetic in easy ??? ??? Two inverse functions:

slide-23
SLIDE 23

Arithmetic in easy seems hard seems hard Two inverse functions: Question: Why do the algorithms from the setting

  • f do not work in ?
slide-24
SLIDE 24

Two inverse functions: easy seems hard seems hard One-way function: easy to compute, hard to invert. seems to be one-way. Arithmetic in

slide-25
SLIDE 25

Private Key Cryptography

slide-26
SLIDE 26

Private key cryptography

Parties must agree on a key pair beforehand.

slide-27
SLIDE 27

Private key cryptography

there must be a secure way of exchanging the key

slide-28
SLIDE 28

Private key cryptography

Dec

Enc should be “one-way”. Try to ensure it using the secrecy of the key.

(plaintext) Enc (ciphertext)

slide-29
SLIDE 29

Completely knows the algorithms Enc and Dec . Assume the adversary knows everything except the key(s) and the message: Completely sees cipher text .

A note about security

Better to consider worst-case conditions.

slide-30
SLIDE 30

Caesar shift

(similarly for capital letters) a b c d e f g h i j k l m n

  • p

q r s t u v w x y z a b c d e f g h i j k l m n

  • p

q r s t u v w x y z Example: shift by 3

“Dear Math, please grow up and solve your own problems.” “Ghdu Pdwk, sohdvh jurz xs dqg vroyh brxu rzq sureohpv.”

: the shift number Easy to break.

slide-31
SLIDE 31

Substitution cipher

a b c d e f g h i j k l m n

  • p

q r s t u v w x y z a b c d e f g h i j k l m n

  • p

q r s t u v w x y z : permutation of the alphabet Easy to break by looking at letter frequencies.

slide-32
SLIDE 32

Enigma

A much more complex cipher.

slide-33
SLIDE 33

One-time pad

For all i: C[i] = M[i] + K[i] (mod 2)

01011010111010100000111

M = K = 11001100010101111000101 C = + C = M + K (bit-wise XOR)

10010110101111011000010

Encryption: M = message K = key C = encrypted message

(everything in binary)

slide-34
SLIDE 34

One-time pad

01011010111010100000111

M = K =

11001100010101111000101

C = +

10010110101111011000010

Decryption: (because K + K = 0) M = message K = key C = encrypted message

(everything in binary)

C = M + K C + K = (M + K) + K = M + (K + K) = M Encryption: Decryption:

slide-35
SLIDE 35

One-time pad

01011010111010100000111

M = K = 11001100010101111000101 C = +

10010110101111011000010

One-time pad is perfectly secure: For any M, if K is chosen uniformly at random, then C is uniformly at random. So adversary learns nothing about M by seeing C. But the shared key has to be as long as the message! Could we reuse the key?

slide-36
SLIDE 36

One-time pad

01011010111010100000111

M = K = 11001100010101111000101 C = +

10010110101111011000010

Could we reuse the key? Suppose you encrypt two messages M and M with K C = M + K

1 1

C = M + K

2 2

Then C + C = M + M

1 2 1 2

One-time only:

1 2

slide-37
SLIDE 37

Shannon’s Theorem

Is it possible to have a secure system like one-time pad with a smaller key size? Shannon proved “no”. An adversary with unlimited computational power can learn some information about M. If K is shorter than M:

slide-38
SLIDE 38

Secret Key Sharing

slide-39
SLIDE 39

Secret Key Sharing

slide-40
SLIDE 40

Diffie-Hellman key exchange

Whitfield Diffie Martin Hellman 1976

slide-41
SLIDE 41

Diffie-Hellman key exchange

In easy seems hard

Want to make sure for the inputs we pick, is hard.

e.g. we don’t want Much better to have a generator .

slide-42
SLIDE 42

Diffie-Hellman key exchange

In easy seems hard We’ll pick so that it is a generator. We’ll pick a prime number. (This ensures there is a generator in .)

slide-43
SLIDE 43

Diffie-Hellman key exchange

Compute Pick prime Pick generator Pick random Pick random Compute

slide-44
SLIDE 44

Diffie-Hellman key exchange

Compute Pick prime Pick generator Pick random Pick random Compute

This is what the adversary sees. If he can compute we are screwed!

slide-45
SLIDE 45

Secure?

Adversary sees: Hopefully he can’t compute from . (our hope is that is hard) Bad news: Proving that it cannot be computed efficiently is at least as hard as the P vs NP problem. Diffie-Hellman assumption: Computing from is hard. Decisional Diffie-Hellman assumption: You actually learn no information about . Good news: No one knows how to compute efficiently.

slide-46
SLIDE 46

One can use: Diffie-Hellman (to share a secret key)

+

One-time Pad

This is as secure as its weakest link, i.e. Diffie-Hellman.

Note for secure message transmissions

slide-47
SLIDE 47

Question

What if we relax the assumption that the adversary is computationally unbounded? We can get rid of the secret key sharing part. We can find a way to share a random secret key. (over an insecure channel) (public key cryptography)

slide-48
SLIDE 48

Public Key Cryptography

slide-49
SLIDE 49

Public Key Cryptography

public private

slide-50
SLIDE 50

Public Key Cryptography

Can be used to lock. But can’t be used to unlock. public private

slide-51
SLIDE 51

Public key cryptography

Enc Dec

Enc should be “one-way”. Try to ensure it using computational complexity.

slide-52
SLIDE 52

RSA crypto system

Ron Rivest Adi Shamir Leonard Adleman 1977

slide-53
SLIDE 53

RSA crypto system

Clifford Cocks Discovered RSA system 3 years before them. Remained secret until 1997. (classified information)

slide-54
SLIDE 54

RSA crypto system

In easy seems hard What if we encode using ? ( ) Public key can be . Enc assume and

slide-55
SLIDE 55

RSA crypto system

Dec

Private key should allow us to invert EXP. i.e. compute ROOT E

slide-56
SLIDE 56

RSA crypto system

Dec

slide-57
SLIDE 57

RSA crypto system

Dec

slide-58
SLIDE 58

RSA crypto system

Dec

lives in . We want to have an inverse. So we choose

slide-59
SLIDE 59

RSA crypto system

slide-60
SLIDE 60

RSA crypto system

Why is N = PQ (product of distinct primes)? What if, say, N = P ?

slide-61
SLIDE 61

How to choose N

If the adversary can compute , we are screwed! Computing is easy if you know Adversary sees . Can he compute ? We believe this is computationally hard. How does Margaery compute ? She knows and , so . If the adversary can factor efficiently, he can also compute

slide-62
SLIDE 62

RSA crypto system

slide-63
SLIDE 63

Secure?

The advantage Margaery has over the adversary is that she can compute (and therefore ) If the adversary can factor efficiently, he can also compute (and therefore )

slide-64
SLIDE 64

Concluding remarks

From , if we can efficiently compute , we can crack RSA. If we can factor , we can compute . Is this the only way to crack RSA? We don’t know! A variant of this is widely used in practice. So we are really hoping it is secure. Quantum computers can factor efficiently.

slide-65
SLIDE 65

Study Guide

Modular Arithmetic:

  • fast exponentiation
  • generators
  • hardness of root and

logarithm (mod n)

  • exp as a one-way func.

Cryptographic Algorithms:

  • Cesar Cypher
  • One Time Pad
  • Diffie Hellman

(Secure Key Exchange)

  • RSA

(Public Key Encryption)