149
Introduction to Cryptography NYIT Vancouver — 2017 (Pooya Jaferian)

Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

  • Upload
    others

  • View
    17

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Introduction to Cryptography

NYIT Vancouver — 2017 (Pooya Jaferian)

Page 2: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Course Website

http://nyit.jaferian.com

Page 3: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Module Outline• Historical background

• Classic ciphers

• One-time pad

• The Random Oracle model

• Random functions: Hash functions

• Random generators: stream ciphers

• Random Permutations: block ciphers

Page 4: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

learning objectiveseach student should be able to:

• explain classic ciphers covered in the lectures

• encrypt and decrypt using these classic cyphers

• break classic ciphers

• explain one-time-pad and encrypt/decrypt wit it

• explain the Random Oracle Models for hash function, stream cipher, and block cipher

Page 5: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Crypto

• Cryptology ⎯ The art and science of making and breaking “secret codes”

• Cryptography ⎯ making “secret codes”

• Cryptanalysis ⎯ breaking “secret codes”

• Crypto ⎯ all of the above (and more)

Page 6: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

How to Speak Crypto• A cipher or cryptosystem is used to encrypt the plaintext

• The result of encryption is ciphertext

• We decrypt ciphertext to recover plaintext

• A key is used to configure a cryptosystem

• A symmetric key cryptosystem uses the same key to encrypt as to decrypt

• A public key cryptosystem uses a public key to encrypt and a private key to decrypt

Page 7: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

plaintext

keykey

plaintext

ciphertext

a generic use of crypto

encrypt decrypt

Crypto as Black Box

Page 8: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

basic assumptions in crypto

Page 9: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

basic assumptions in crypto

• assumptions

1. The system is completely known to the attacker

2. Only the key is secret

• Also known as Kerckhoffs Principle

• Crypto algorithms are not secret

Page 10: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Kerckhoff’s Principle

“The security of a cryptosystem must not depend on keeping secret the crypto-algorithm. The security depends only on keeping secret the key”

Auguste Kerckhoff von Nieuwenhof Dutch linguist

1883

Page 11: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

basic assumptions in crypto

Page 12: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

• Why do we make this assumption?

basic assumptions in crypto

Page 13: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

• Why do we make this assumption?

• Experience has shown that secret algorithms are weak when exposed

basic assumptions in crypto

Page 14: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

• Why do we make this assumption?

• Experience has shown that secret algorithms are weak when exposed

• Secret algorithms never remain secret

basic assumptions in crypto

Page 15: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

• Why do we make this assumption?

• Experience has shown that secret algorithms are weak when exposed

• Secret algorithms never remain secret

• Better to find weaknesses beforehand

basic assumptions in crypto

Page 16: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

two types of ciphers

• substitution

• transposition

Page 17: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

A B C D E F G H I J K L M

0 1 2 3 4 5 6 7 8 9 10 11 12

N O P Q R S T U V W X Y z

13 14 15 16 17 18 19 20 21 22 23 24 25

Letter Indices in English Alphabet

AFSHTZAJW NX FBJXTRJ

Page 18: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Caesar Cipher• Plaintext is HELLO WORLD

• Change each letter to the third letter following it (X goes to A, Y to B, Z to C)

• Key is 3, usually written as letter ‘D’

• C = P + K mod 26

• Ciphertext: KHOOR ZRUOG

Plain HELLOWORLD

Key DDDDDDDDDD

Cipher KHOORZRUOG

Page 19: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Can you break this ?

AFSHTZAJW NX FBJXTRJ

????????? ?? ???????

????????? ?? ???????

Page 20: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Can you break this ?

AFSHTZAJW NX FBJXTRJ

VANCOUVER IS AWESOME

FFFFF …

Page 21: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

a simple attack• how to attack Caesar Cipher?

Page 22: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

a simple attack• how to attack Caesar Cipher?

• exhaustive/brute-force (key) search

Page 23: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

a simple attack• how to attack Caesar Cipher?

• exhaustive/brute-force (key) search

• with 26 keys, how many attempts on average?

Page 24: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

a simple attack• how to attack Caesar Cipher?

• exhaustive/brute-force (key) search

• with 26 keys, how many attempts on average?

• Trudy can try 240 candidates/second

Page 25: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

a simple attack• how to attack Caesar Cipher?

• exhaustive/brute-force (key) search

• with 26 keys, how many attempts on average?

• Trudy can try 240 candidates/second

• 256 -- 18 hours

Page 26: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

a simple attack• how to attack Caesar Cipher?

• exhaustive/brute-force (key) search

• with 26 keys, how many attempts on average?

• Trudy can try 240 candidates/second

• 256 -- 18 hours

• 264 -- 6 months

Page 27: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

a simple attack• how to attack Caesar Cipher?

• exhaustive/brute-force (key) search

• with 26 keys, how many attempts on average?

• Trudy can try 240 candidates/second

• 256 -- 18 hours

• 264 -- 6 months

• how to increase key space for substitution cipher?

Page 28: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Monoalphabetic Substitution Cipher

Invented by Arabs in 8th or 9th centuries

Plain HELLOWORLD

Key

Cipher AGVVYEYZVS

A B C D E F G H I J K L M N .. Z

F T W S G M P A Z C L V O D .. B

Page 29: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Frequency Analysis of English Letters

Page 30: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

0.001

0.020

0.002

0.024

0.010

0.028

0.091

0.0630.060

0.001

0.019

0.0750.067

0.024

0.040

0.0080.002

0.070

0.061

0.0200.022

0.127

0.043

0.028

0.015

0.082

Frequency Analysis of English Letters

Page 31: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Polyalphabetic Vigenère Cipher

proposed by Blaise de Vigenere from the court of Henry III of France in the sixteenth century

Like Cæsar cipher, but use a phrase

• Example

• Message: TO BE OR NOT TO BE THAT IS THE QUESTION

• Key: RELATIONS

• Encipher using Cæsar cipher for each letter:

Page 32: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Polyalphabetic Vigenère Cipher

proposed by Blaise de Vigenere from the court of Henry III of France in the sixteenth century

Like Cæsar cipher, but use a phrase

• Example

• Message: TO BE OR NOT TO BE THAT IS THE QUESTION

• Key: RELATIONS

• Encipher using Cæsar cipher for each letter:

Plain TO BE OR NOT TO BE TH AT I S THE QUESTION Key RE LA T I ONS RE LA T I ON SR ELA T I ONSREL Cipher KS ME HZ BBL KS ME MPOG AJ XSE J CSF LZSY

Page 33: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Playfair Cipher

Page 34: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

background• encrypts pairs of letters (digraphs), instead of single

letters

• ~600 possible digraphs rather than the 26 possible monographs

• was used for tactical purposes by

• British forces in the Second Boer War (in South Africa) and in World War I

• the Australians and Germans during World War II

Page 35: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

anecdotal history

source: wikipedia.org

Page 36: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

anecdotal history• invented in 1854 by Charles Wheatstone

source: wikipedia.org

Page 37: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

anecdotal history• invented in 1854 by Charles Wheatstone

• rejected by the British Foreign Office when it was developed because of its perceived complexity

source: wikipedia.org

Page 38: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

anecdotal history• invented in 1854 by Charles Wheatstone

• rejected by the British Foreign Office when it was developed because of its perceived complexity

• Wheatstone offered to demonstrate that three out of four boys in a nearby school could learn to use it in 15 minutes

source: wikipedia.org

Page 39: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

anecdotal history• invented in 1854 by Charles Wheatstone

• rejected by the British Foreign Office when it was developed because of its perceived complexity

• Wheatstone offered to demonstrate that three out of four boys in a nearby school could learn to use it in 15 minutes

• the Under Secretary of the Foreign Office responded: "That is very possible, but you could never teach it to attachés."

source: wikipedia.org

Page 40: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

anecdotal history• invented in 1854 by Charles Wheatstone

• rejected by the British Foreign Office when it was developed because of its perceived complexity

• Wheatstone offered to demonstrate that three out of four boys in a nearby school could learn to use it in 15 minutes

• the Under Secretary of the Foreign Office responded: "That is very possible, but you could never teach it to attachés."

• named after Lord Playfair who promoted the use of the cipher

source: wikipedia.org

Page 41: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

setting up the cipher• 5 x 5 table

• example key: “playfair example”

• drop any duplicate letters

• fill the remaining of the letters from the English alphabet / one letter (J or Q)

source: wikipedia.org

Page 42: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

encryption overview1.break the plain text into digraphs

1.split double letters with “X”, e.g., “EE” -> “EXE”

2.append “X” if odd number of characters.

3."Hide the gold in the tree stump" becomes "HI DE TH EG OL DI NT HE TR EX ES TU MP"

2.map each digraph out using the table

Page 43: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

mapping rules

If a pair forms a rectangle, replace it with letters from the opposite corners on the same row.

source: wikipedia.org

Page 44: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

mapping rules

If the letters appear on the same column of your table, replace them with the letters immediately below respectively.

source: wikipedia.org

Page 45: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ? ? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 46: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB ? ? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 47: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD ? ? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 48: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA ?? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 49: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE ? ? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 50: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE KU ? ? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 51: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE KU DM ? ? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 52: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE KU DM UI ? ? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 53: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

If the letters appear on the same row of your table, replace them with the letters immediately to right, respectively. Wrap to left, if needed.

source: wikipedia.org

Page 54: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE KU DM UI XM ? ? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 55: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE KU DM UI XM MO ? ? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 56: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE KU DM UI XM MO UV ? ? ...

P L A Y F

I R E X M

B C D G H

K N O Q S

T U V W Z

Page 57: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“BMOD ZBX DNAB EK UDM UIXMM OUVIF”

Page 58: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“BMOD ZBX DNAB EK UDM UIXMM OUVIF”

“HIDE THE GOLD IN THE TREE STUMP”

Page 59: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“BMOD ZBX DNAB EK UDM UIXMM OUVIF”

“HIDE THE GOLD IN THE TREE STUMP”

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

Page 60: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“BMOD ZBX DNAB EK UDM UIXMM OUVIF”

“HIDE THE GOLD IN THE TREE STUMP”

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE KU DM UI XM MO UV IF”

Page 61: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“BMOD ZBX DNAB EK UDM UIXMM OUVIF”

• How to decrypt it with the key?

“HIDE THE GOLD IN THE TREE STUMP”

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE KU DM UI XM MO UV IF”

Page 62: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“BMOD ZBX DNAB EK UDM UIXMM OUVIF”

• How to decrypt it with the key?• What betrays Palyfair?

“HIDE THE GOLD IN THE TREE STUMP”

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE KU DM UI XM MO UV IF”

Page 63: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

“BMOD ZBX DNAB EK UDM UIXMM OUVIF”

• How to decrypt it with the key?• What betrays Palyfair?• How can one break it?

“HIDE THE GOLD IN THE TREE STUMP”

“HI DE TH EG OL DI NT HE TR EX ES TU MP”

“BM OD ZB XD NA BE KU DM UI XM MO UV IF”

Page 64: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Double Transposition

• Plaintext: attackxatxdawn

Page 65: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Double Transposition

• Plaintext: attackxatxdawn

Page 66: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Permute rows and columns

Double Transposition

• Plaintext: attackxatxdawn

Page 67: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Permute rows and columns

Double Transposition

• Plaintext: attackxatxdawn

Page 68: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Permute rows and columns

⇒! Plaintext: attackxatxdawnx

Double Transposition

• Plaintext: attackxatxdawn

Page 69: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Permute rows and columns

⇒! Plaintext: attackxatxdawnx! Ciphertext: xtawxnattxadakc

Double Transposition

• Plaintext: attackxatxdawn

Page 70: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Permute rows and columns

⇒! Plaintext: attackxatxdawnx! Ciphertext: xtawxnattxadakc ! Key: matrix size and permutations

(3,5,1,4,2) and (1,3,2)

Double Transposition

• Plaintext: attackxatxdawn

Page 71: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Try Double Transposition

we are all together

• row (1,2,3,4)—> (2,4,1,3)

• column (1,2,3,4)—> (3,1,2,4)

Page 72: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Try Double Transposition

w e a r

e a l l

t o g e

t h e r

• row (1,2,3,4)—> (2,4,1,3) column (1,2,3,4)—> (3,1,2,4)

Page 73: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Try Double Transposition

l e a l

e t h r

a w e r

g t o e

Page 74: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Cryptanalysis: Terminology

Page 75: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Cryptanalysis: Terminology

• Cryptosystem is secure if best known attack is to try all keys

Page 76: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Cryptanalysis: Terminology

• Cryptosystem is secure if best known attack is to try all keys

• Cryptosystem is insecure if any shortcut attack is known

Page 77: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Cryptanalysis: Terminology

• Cryptosystem is secure if best known attack is to try all keys

• Cryptosystem is insecure if any shortcut attack is known

• By this definition, an insecure system might be harder to break than a secure system! Why?

Page 78: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

one-time pad (OTP)

Page 79: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

One-Time Pad

Page 80: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

One-Time Pad

A Vigenère cipher with a random key at least as long as the message

Page 81: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

One-Time Pad

A Vigenère cipher with a random key at least as long as the message

• Provably unbreakable

Page 82: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

One-Time Pad

A Vigenère cipher with a random key at least as long as the message

• Provably unbreakable

• Why?

Page 83: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

One-Time Pad

A Vigenère cipher with a random key at least as long as the message

• Provably unbreakable

• Why?

Plain text D O I T D O N T

Key A J I Y A J D Y

Cipher text D X Q R D X Q R

Page 84: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

One-Time Pad

A Vigenère cipher with a random key at least as long as the message

• Provably unbreakable

• Why?

Plain text D O I T D O N T

Key A J I Y A J D Y

Cipher text D X Q R D X Q R

! Warning: keys must be random, or you can attack the cipher by trying to regenerate the key

Page 85: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

More formally …

Page 86: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

One-time pad

Page 87: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

One-time pad

Page 88: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

One-time pad

Page 89: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

One-time pad

• Perfect secrecy

• Creating large set of truly random keys is challenging

• Hard to distribute large keys on networks

Page 90: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Little Bit of History

• about 95 years ago, January 19, 1917 …

Page 91: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Codebook

Page 93: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Codebook• Literally, a book filled with “codewords”

• Zimmerman Telegram encrypted via codebook

Page 94: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Codebook• Literally, a book filled with “codewords”

• Zimmerman Telegram encrypted via codebook

Februar 13605

Page 95: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Codebook• Literally, a book filled with “codewords”

• Zimmerman Telegram encrypted via codebook

Februar 13605

fest 13732

Page 96: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Codebook• Literally, a book filled with “codewords”

• Zimmerman Telegram encrypted via codebook

Februar 13605

fest 13732

finanzielle 13850

Page 97: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Codebook• Literally, a book filled with “codewords”

• Zimmerman Telegram encrypted via codebook

Februar 13605

fest 13732

finanzielle 13850

folgender 13918

Page 98: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Codebook• Literally, a book filled with “codewords”

• Zimmerman Telegram encrypted via codebook

Februar 13605

fest 13732

finanzielle 13850

folgender 13918

Frieden 17142

Page 99: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Codebook• Literally, a book filled with “codewords”

• Zimmerman Telegram encrypted via codebook

Februar 13605

fest 13732

finanzielle 13850

folgender 13918

Frieden 17142

Friedenschluss 17149

Page 100: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Codebook• Literally, a book filled with “codewords”

• Zimmerman Telegram encrypted via codebook

Februar 13605

fest 13732

finanzielle 13850

folgender 13918

Frieden 17142

Friedenschluss 17149

: :

Page 101: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Codebook• Literally, a book filled with “codewords”

• Zimmerman Telegram encrypted via codebook

Februar 13605

fest 13732

finanzielle 13850

folgender 13918

Frieden 17142

Friedenschluss 17149

: :

• Modern block ciphers are codebooks!

Page 102: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Zimmerman Telegram

• One of most famous codebook ciphers ever

• Led to US entry in WWI

• Ciphertext shown here…

Arthur Zimmermann (1854-1940) German Foreign Secretary

Page 103: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

! British had recovered partial codebook

! Able to fill in missing parts

Zimmerman Telegram Decrypted

Page 104: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Oracle ModelRead: Anderson 5.3

https://www.cl.cam.ac.uk/~rja14/Papers/SEv2-c05.pdf

Page 105: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

What is Random Oracle Model?

Page 106: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

What is Random Oracle Model?

Page 107: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Queries

What is Random Oracle Model?

Page 108: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Queries

Responses

What is Random Oracle Model?

Page 109: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Queries

Responses

What is Random Oracle Model?

Page 110: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Queries

Responses

What is Random Oracle Model?

Page 111: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Queries

Responses

What is Random Oracle Model?

Page 112: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Queries

Responses

source of randomness

What is Random Oracle Model?

Page 113: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Queries

Responses

source of randomness

What is Random Oracle Model?

Page 114: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Queries

Responses

source of randomness

infinite storage

What is Random Oracle Model?

Page 115: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Function as Random Oracle

Queries

Responses

Page 116: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Function as Random Oracle

• In: string of any length

Queries

Responses

Page 117: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Function as Random Oracle

• In: string of any length

• Out: random string of fixed length

Queries

Responses

Page 118: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Function as Random Oracle

• In: string of any length

• Out: random string of fixed length

• Applications:Queries

Responses

Page 119: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Function as Random Oracle

• In: string of any length

• Out: random string of fixed length

• Applications:

• One-way functions Queries

Responses

Page 120: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Function as Random Oracle

• In: string of any length

• Out: random string of fixed length

• Applications:

• One-way functions

• Hash functions

Queries

Responses

Page 121: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Function as Random Oracle

• In: string of any length

• Out: random string of fixed length

• Applications:

• One-way functions

• Hash functions

• Message digests

Queries

Responses

Page 122: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Function as Random Oracle

• In: string of any length

• Out: random string of fixed length

• Applications:

• One-way functions

• Hash functions

• Message digests

• Time stamping

Queries

Responses

Page 123: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Function as Random Oracle

Queries

ResponsesProperties

• efficiency -- easy to compute h(x) for any x.

• one-way -- given any y, it’s infeasible to find x, s.t., h(x) = y

• weak collision resistance -- given x and h(x), it’s infeasible to y != x, s.t. h(y) == h(x)

• strong collision resistance -- infeasible to find any x != y, s.t., h(x) == h(y)

Page 124: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Generator (Stream Cipher) as Random Oracle

Queries

Responses

Page 125: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Generator (Stream Cipher) as Random Oracle

• In: Queries

Responses

Page 126: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Generator (Stream Cipher) as Random Oracle

• In:

• short string (key)Queries

Responses

Page 127: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Generator (Stream Cipher) as Random Oracle

• In:

• short string (key)

• length of the output

Queries

Responses

Page 128: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Generator (Stream Cipher) as Random Oracle

• In:

• short string (key)

• length of the output

• Out: long random stream of bits (keystream)

Queries

Responses

Page 129: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Generator (Stream Cipher) as Random Oracle

• In:

• short string (key)

• length of the output

• Out: long random stream of bits (keystream)

• Applications:

Queries

Responses

Page 130: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Generator (Stream Cipher) as Random Oracle

• In:

• short string (key)

• length of the output

• Out: long random stream of bits (keystream)

• Applications:

• Communications encryption

Queries

Responses

Page 131: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Generator (Stream Cipher) as Random Oracle

• In:

• short string (key)

• length of the output

• Out: long random stream of bits (keystream)

• Applications:

• Communications encryption

• Storage encryption

Queries

Responses

Page 132: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Generator (Stream Cipher) as Random Oracle

• In:

• short string (key)

• length of the output

• Out: long random stream of bits (keystream)

• Applications:

• Communications encryption

• Storage encryption

Queries

Responses

Properties ! Should not reuse

• Use seed

Page 133: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

cristalmet

Page 134: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

From: https://en.wikipedia.org/wiki/A5/1

Example: A5 stream cipher for GSM

Page 135: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Permutation (Block Cipher) as Random Oracle

Queries

Responses

Page 136: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Permutation (Block Cipher) as Random Oracle

• In Queries

Responses

Page 137: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Permutation (Block Cipher) as Random Oracle

• In

• fixed size short string (plaintext) M,

Queries

Responses

Page 138: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Permutation (Block Cipher) as Random Oracle

• In

• fixed size short string (plaintext) M,

• DES -- 64 bits

Queries

Responses

Page 139: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Permutation (Block Cipher) as Random Oracle

• In

• fixed size short string (plaintext) M,

• DES -- 64 bits

• Key K

Queries

Responses

Page 140: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Permutation (Block Cipher) as Random Oracle

• In

• fixed size short string (plaintext) M,

• DES -- 64 bits

• Key K

• Out

Queries

Responses

Page 141: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Permutation (Block Cipher) as Random Oracle

• In

• fixed size short string (plaintext) M,

• DES -- 64 bits

• Key K

• Out

• same fixed size short string (ciphertext) C

Queries

Responses

Page 142: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Permutation (Block Cipher) as Random Oracle

• In

• fixed size short string (plaintext) M,

• DES -- 64 bits

• Key K

• Out

• same fixed size short string (ciphertext) C

Queries

Responses

K1

Page 143: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Permutation (Block Cipher) as Random Oracle

• In

• fixed size short string (plaintext) M,

• DES -- 64 bits

• Key K

• Out

• same fixed size short string (ciphertext) C

Queries

Responses

K1

K2

Page 144: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Random Permutation (Block Cipher) as Random Oracle

• In

• fixed size short string (plaintext) M,

• DES -- 64 bits

• Key K

• Out

• same fixed size short string (ciphertext) C

Queries

Responses

Notation ! C = { M }K

! M = { C }K

Properties ! Invertible

K1

K2

Page 145: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Public Key Encryption and Trap-door One-Way Permutation as Random Oracle

• Public Key Encryption Scheme:

• Key pair (KR, KR-1) generation function from random string R

• KR → KR-1 is infeasible

• C = {M} KR

• M = {C} KR-1 • In:

• fixed size short string (plaintext) M,

• Key KR

• Out: fixed size short string (ciphertext) C

Queries

Responses

H(K1) K1

H(K2) K2

Page 146: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Digital Signature as Random Oracle

• Public Key Signature Scheme:

• Key pair (σR, VR) generation function

• VR → σR is infeasible

• S = Sig σR(M)

• {True, False} = VerVR(S)

Queries

Responses

H(K1) K1

H(K2) K2

Signing Verifying

Input Any string M + σR S + VR

Output S = hash(M) | cipher block “True” or “False”

Page 147: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Summary

Page 148: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Summary• Historical background

• Caesar, Vigenère, Palyfair, and Double Transpositionciphers

• One-time pad

• One-way functions

• Asymmetric cryptosystems

Page 149: Introduction to Cryptography - Jaferianjaferian.com/nyit/2-intro_to_crypto.pdf• Cryptography ⎯ making “secret codes” • Cryptanalysis ⎯ breaking “secret codes” • Crypto

Summary• Historical background

• Caesar, Vigenère, Palyfair, and Double Transpositionciphers

• One-time pad

• One-way functions

• Asymmetric cryptosystems

• The Random Oracle model • Random functions: Hash functions

• Random generators: stream ciphers

• Random Permutations: block ciphers