introduction to cryptography - georgetown...

23
Introduction to Cryptography Adam O’Neill Based on http://cseweb.ucsd.edu/~mihir/cse207/

Upload: others

Post on 04-Jun-2020

21 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Introduction to Cryptography

Adam O’Neill Based on http://cseweb.ucsd.edu/~mihir/cse207/

Page 2: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Course Logistics

Instructor: Adam O’Neill, people.cs.georgetown.edu/~adam/

Grading: 3-5 homeworks (60%), final exam (40%)

Instead of final exam, can do a research project

• Should follow a conference-paper-like format and be related to course content

fa 17530

→can Collaborate & list collaborators

Page 3: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

CryptographyCommunication and computation (for data-at-rest) in the presence of an adversary

An ancient art, e.g. Julius Caesar used cryptography

Transformed into a science starting with the work of Shannon (1949)

Took off in the 1970s and 1980s

Page 4: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

UsageCryptography usage

• https invokes the TLS protocol

• TLS uses cryptography

• TLS is in ubiquitous use for secure communication: shopping,banking, Netflix, gmail, Facebook, ...

Mihir Bellare UCSD 3

Page 5: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Other UsesCryptography usage

Other uses of cryptography:

• ATM machines

• Bitcoin

• Messaging apps: whatsapp, viber, line, telegraph, goldbug,chatsecure, ...

• Google authenticator

• ...

11,748 android apps use cryptography (encryption), and 10,327 get itwrong [EBFK13]

Mihir Bellare UCSD 4

Page 6: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Classical SettingWhat is cryptography about?

Adversary: clever person with powerful computer

Security goals:

• Data privacy: Ensure adversary does not see or obtain the data(message) M.

• Data integrity and authenticity: Ensure M really originates withAlice and has not been modified in transit.

Mihir Bellare UCSD 5

Eve

Page 7: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Ideal WorldIdeal World

Cryptonium pipe: Cannot see inside or alter content.

All our goals would be achieved!

But cryptonium is only available on planet Crypton and is in short supply.

Mihir Bellare UCSD 8

Page 8: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Cryptographic SchemesCryptographic schemes

E : encryption algorithmD: decryption algorithm

Ke : encryption keyKd : decryption key

Algorithms: standardized, implemented, public!

Mihir Bellare UCSD 11

O o4algorithm AT gorilm

*

-

Kerkoff 'sPrinciple

Page 9: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Cryptographic schemes

E : encryption algorithmD: decryption algorithm

Ke : encryption keyKd : decryption key

Settings:

• public-key (assymmetric): Ke public, Kd secret

• private-key (symmetric): Ke = Kd secret

Mihir Bellare UCSD 12

Settings

←solves

P theclass

puzzle

Page 10: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Key DistributionCryptographic schemes

E : encryption algorithmD: decryption algorithm

Ke : encryption keyKd : decryption key

How do keys get distributed? Magic, for now!

Mihir Bellare UCSD 13

Computer Security & network Security

Page 11: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

ConcernsCryptographic schemes

Our concerns:

• How to define security goals?

• How to design E , D?

• How to gain confidence that E , D achieve our goals?

Mihir Bellare UCSD 14

e-

Page 12: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Why is this hard?

One cannot anticipate in advance what an adversary will do

“Testing” is not possible in this setting

Different than other areas of computer science where heuristics on “typical inputs” apply

Page 13: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Hopeful AdderADD Cx

, y ) = x +y

breaks on

Some carer

Cases .

still'

ok ?

Page 14: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Early HistoryEarly history

Substitution ciphers/Caesar ciphers:

Ke = Kd = ⇡ : ⌃ ! ⌃, a secret permutation

e.g., ⌃ = {A,B ,C , . . .} and ⇡ is as follows:

� A B C D · · ·⇡(�) E A Z U · · ·

E⇡(CAB) = ⇡(C )⇡(A)⇡(B)

= Z E A

D⇡(ZEA) = ⇡�1(Z )⇡�1(E )⇡�1(A)

= C A B

Not very secure! (Common newspaper puzzle)Mihir Bellare UCSD 18

-

Page 15: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Shannon’s WorkShannon and One-Time-Pad (OTP) Encryption

Ke = Kd = K$ {0, 1}k| {z }

K chosen at random

from {0, 1}k

For any M 2 {0, 1}k– EK (M) = K �M– DK (C ) = K � C

Theorem (Shannon): OTP is perfectly secure as long as only one messageencrypted.

“Perfect” secrecy, a notion Shannon defines, captures mathematical impossibility

of breaking an encryption scheme.

Fact: if |M| > |K |, then no scheme is perfectly secure.

Mihir Bellare UCSD 21

M¥ .

DoVemam#onetime pad scheme

-

D-

Page 16: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Some Notationx # AOC

. . ) Xs$- AC ... )4

Oracle TM mndomited

alg . randomCoins

×←A( o;# seta-

If S, & sz aresmys then

s,Hsz denotes an eaeodiy

from which S, ,Sz are Unquiet

neeoveata

Page 17: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Perfect Security

COSC531, Georgetown University, Fall 2015Instructor: Adam O’[email protected]

could be given the encryption of a message and try to guess the message, or she could be theencryption of many messages and try to guess some partial information about them NB: In anysecurity model, we always assume the scheme’s algorithms themselves are known by the adversary

(this is called Kercho↵’s Principle). Finally, we propose a candidate scheme (meaning, candidatesfor the algorithms we require) and prove that no adversary can break it in our security model. Animportant point here is that such security proofs are “computational” in nature. A typical securitytheorem looks something like this:

Theorem 1. Cryptographic scheme X above cannot be broken in security model Y with probability

more than ✏ by adversaries running in time at most t, assuming computational problem Z cannot

be solved with probability more than ✏

0by algorithms running in time t

0.

In other words, security proofs do not give absolute assurance that a scheme can’t be broken (notthat they would anyway, since they are always relative to some security model), but rather theysay that it can’t be broken by resource-bounded adversaries assuming some underlying problem ishard. Why is this?

One-Time Pad and the Need for Computational Assumptions. It turns out, if we wantsecurity against unbounded adversaries and without making computational assumptions, we can’tdo too much. To illustrate this we consider a classical encryption scheme called the one-time pad.First we define a notion of perfect secrecy due to Shannon.

Definition 0.1. A cryptosystem (K, E ,D) is perfectly secure if for all distributions D on messagesand every message g and every ciphertext c

Pr [ g = m | E(K,m) = c ] = Pr [m = g ]

where the probability is over K $K and m $D.

About notation: we use the notation x $A(. . .) to denote that x is assigned the output of

running randomized algorithm A on the elided inputs with fresh random coins. If A is deterministicwe drop the dollar sign. If S is a finite set then s $

S denotes that s is assigned a random elementfrom S, and if X is a random variable or distribution (on some set) then x $

X denotes that x isassigned an element sampled according to this distribution.

A simple scheme achieves perfect security is the one-time pad (also called a Vernam cipher).Let messages be k-bit string and define K to consist of k-bit strings as well. Algorithm K outputsa random K 2 {0, 1}k. On inputs K,m algorithm E outputs K �m (where ‘�’ denotes bit-wiseexclusive-or). Decryption is defined in the obvious way. To see that this scheme achieves perfectsecurity we can define a simpler security notion as follows.

Definition 0.2. A cryptosystem (K, E ,D) is Shannon secure if for all messages m0,m1 and cipher-texts c

Pr [ E(K,m0) = c ] = Pr [ E(K,m1) = c ]

where the probability is over K $K.

Shannon proved that these two definitions are equivalent. The proof is not di�cult and is agood excercise. Moreover, it is a good exercise to prove that the one-time pad is Shannon secure.(Showing that is perfectly secure directly is rather more complicated; the point of Shannon securityis that it is easier to work with yet equivalent to perfect security).

Finally, note that the scheme is very computationally e�cient except that it requires keys as

long as the messages. Shannon proved that this is inherent for any scheme meeting perfect security.But this is not practical, motivating the computational approach discussed above.

2

K . K K # K

Deftlycauseway

..

-a-

Condition doesn't affect pnbabilk .

Page 18: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Shannon Security

COSC531, Georgetown University, Fall 2015Instructor: Adam O’[email protected]

could be given the encryption of a message and try to guess the message, or she could be theencryption of many messages and try to guess some partial information about them NB: In anysecurity model, we always assume the scheme’s algorithms themselves are known by the adversary

(this is called Kercho↵’s Principle). Finally, we propose a candidate scheme (meaning, candidatesfor the algorithms we require) and prove that no adversary can break it in our security model. Animportant point here is that such security proofs are “computational” in nature. A typical securitytheorem looks something like this:

Theorem 1. Cryptographic scheme X above cannot be broken in security model Y with probability

more than ✏ by adversaries running in time at most t, assuming computational problem Z cannot

be solved with probability more than ✏

0by algorithms running in time t

0.

In other words, security proofs do not give absolute assurance that a scheme can’t be broken (notthat they would anyway, since they are always relative to some security model), but rather theysay that it can’t be broken by resource-bounded adversaries assuming some underlying problem ishard. Why is this?

One-Time Pad and the Need for Computational Assumptions. It turns out, if we wantsecurity against unbounded adversaries and without making computational assumptions, we can’tdo too much. To illustrate this we consider a classical encryption scheme called the one-time pad.First we define a notion of perfect secrecy due to Shannon.

Definition 0.1. A cryptosystem (K, E ,D) is perfectly secure if for all distributions D on messagesand every message g and every ciphertext c

Pr [ g = m | E(K,m) = c ] = Pr [m = g ]

where the probability is over K $K and m $D.

About notation: we use the notation x $A(. . .) to denote that x is assigned the output of

running randomized algorithm A on the elided inputs with fresh random coins. If A is deterministicwe drop the dollar sign. If S is a finite set then s $

S denotes that s is assigned a random elementfrom S, and if X is a random variable or distribution (on some set) then x $

X denotes that x isassigned an element sampled according to this distribution.

A simple scheme achieves perfect security is the one-time pad (also called a Vernam cipher).Let messages be k-bit string and define K to consist of k-bit strings as well. Algorithm K outputsa random K 2 {0, 1}k. On inputs K,m algorithm E outputs K �m (where ‘�’ denotes bit-wiseexclusive-or). Decryption is defined in the obvious way. To see that this scheme achieves perfectsecurity we can define a simpler security notion as follows.

Definition 0.2. A cryptosystem (K, E ,D) is Shannon secure if for all messages m0,m1 and cipher-texts c

Pr [ E(K,m0) = c ] = Pr [ E(K,m1) = c ]

where the probability is over K $K.

Shannon proved that these two definitions are equivalent. The proof is not di�cult and is agood excercise. Moreover, it is a good exercise to prove that the one-time pad is Shannon secure.(Showing that is perfectly secure directly is rather more complicated; the point of Shannon securityis that it is easier to work with yet equivalent to perfect security).

Finally, note that the scheme is very computationally e�cient except that it requires keys as

long as the messages. Shannon proved that this is inherent for any scheme meeting perfect security.But this is not practical, motivating the computational approach discussed above.

2

Easy to prove GTP achieves

this definition

Eedx)=kot¥ bitwise exclusive or

Page 19: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

An EquivalenceA scheme is perfectly Secure iff it 's ShannonSecure

.

Theorem :

Shannon Security ⇒ Perfect SecurityP=t: ✓

prTg=m|E*Cml=c]=Pr[9=mnEk(M¥4 ]m -

¥ = Prtfacmkc ]

:PrTg=m]PrFGds7e) =PvEg=m^EkCg)=c ]-# -

Prt Ehlmte ] PRTEKC mkc ]

Page 20: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence
Page 21: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Shannon’s TheoremThm : A scheme that is Perfectly Secure wsf

-

have key space as large as message - space.

Proof PerfectlySecure ⇒ Shannon Secure

Suppose 1412114then Zc*, notst . ¥ K st

.

De(E)=m*

then take m # w* and we have

*,

FK Dkcetkmt.LT#cCm)=c*)IlIEEeCm*kgtt

Page 22: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Modern Cryptography

Gets around Shannon’s Theorem by developing a computational science

Security of a practical scheme must rely not on impossibility but on computational intractability

Cryptography is full of counter-intuitive solutions to cool problems!

Page 23: Introduction to Cryptography - Georgetown Universitypeople.cs.georgetown.edu/~adam/fa17530/cs530-slides1.pdfCryptography Communication and computation (for data-at-rest) in the presence

Security TheoremsModern Cryptography: A Computational Science

Rather than:

“It is impossible to break the scheme”

We might be able to say:

“No attack using 2160 time succeeds with probability � 2�20”

I.e., Attacks can exist as long as cost to mount them is prohibitive, where

Cost = computing time/memory, $$$

Mihir Bellare UCSD 23