90
Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato ence of cryptography = Art of keeping secr

Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Embed Size (px)

Citation preview

Page 1: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Keeping your bits private!

Tony C Smith

Dept. Computer Science

University of Waikato

Science of cryptography = Art of keeping secrets

Page 2: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

terminology

plaintext (the message)

Page 3: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

terminology

plaintext

sender (cryptographer)

Page 4: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

terminology

plaintext

sender receiver

Page 5: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

terminology

plaintext

sender

encrypt

receiver

ciphertext

(transmission)

Page 6: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

terminology

plaintext

sender

encrypt decrypt

receiver

ciphertext

plaintext

Page 7: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

terminology

is insecure!Transmission medium

Page 8: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

terminology

plaintext

sender

encrypt decrypt

receiver

plaintextcryptanalyst

Page 9: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

goal: deciphering the ciphertext is ashard as just guessing the plaintext message.

encryption process: transform plaintext into ciphertext

Page 10: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

plaintext and ciphertext are in 27 letter English:

26 letters of the alphabet, plus space

also, letters can be treated as numbers:

space is 0A is 1B is 2C is 3

…Z is 26

Page 11: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

because we can treat letters as numbers, we can do arithmetic with them:

B + C = E2 + 3 = 5

if the sum of two numbers goes beyond 26 thenwe wrap around back to the beginning of the alphabet

W + H = ? 23 + 8 = 31

Z + E = ?26 + 5 = 31

… same as ...

five letters beyond the end = fifth from start

… so, W + H = E

Page 12: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

plaintext

sender

encrypt decrypt

receiver

plaintextcryptanalyst

Page 13: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

plaintext

encrypt decrypt

plaintextknows the encryption scheme

key keyguessing the key is as hard as

guessing the message

Page 14: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Caesar Cipher

Used by Julius Caesar to communicate with his army.

Thought to be the first general use of encryption, 75 B.C..

replace each letter with the k-th letter after it in the alphabet

Page 15: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Caesar Cipher

E.g. k = 3

space + 3 = C A + 3 = D B + 3 = E … W + 3 = Z X + 3 = space Y + 3 = A Z + 3 = B

ATTACK AT DAWN … becomes ...

DWWDFNCDWCGDZQciphertext:

Page 16: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

plaintext

encrypt decrypt

plaintextknows the encryption scheme

key keyguessing the key is as hard as

guessing the message

Page 17: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Caesar Cipher

Easily attacked!

Simply try every possible value for k … from 1 to 26

Page 18: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Caesar Cipher

Easily attacked!

Simply try every possible value for k … from 1 to 26

ciphertext = DWWDFNCDWCGDZQ

Page 19: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Caesar Cipher

Easily attacked!

Simply try every possible value for k … from 1 to 26

k = 1 ? CVVCEMBCVBFCYP

DWWDFNCDWCGDZQ

Page 20: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Caesar Cipher

Easily attacked!

Simply try every possible value for k … from 1 to 26

k = 1 ? CVVCEMBCVBFCYP

k = 2 ? BUUBDLABUAEBXO

DWWDFNCDWCGDZQ

Page 21: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Caesar Cipher

Easily attacked!

Simply try every possible value for k … from 1 to 26

k = 1 ? CVVCEMBCVBFCYP

k = 2 ? BUUBDLABUAEBXO

k = 3 ? ATTACK AT DAWN

DWWDFNCDWCGDZQ

Page 22: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Keyed Substitution

A more general substitution scheme.

Page 23: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Keyed Substitution

A more general substitution scheme.

Replaces each letter with another.

Page 24: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Keyed Substitution

A more general substitution scheme.

Replaces each letter with another.

Any letter can stand in for any other letter.

Page 25: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Keyed Substitution

A more general substitution scheme.

Replaces each letter with another.

Any letter can stand in for any other letter.

Each letter in ciphertext resolves to a unique letter in plaintext.

plaintext: _ABCDEFGHIJKLMNOPQRSTUVWXYZ

Page 26: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Keyed Substitution

A more general substitution scheme.

Replaces each letter with another.

Any letter can stand in for any other letter.

Each letter in ciphertext resolves to a unique letter in plaintext.

plaintext: _ABCDEFGHIJKLMNOPQRSTUVWXYZsubstitution: SJKEIOAHWDPMGRNVT_QLZBFYCXU

Page 27: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Keyed Substitution

A random substitution is hard to remember or validate.

Solution? Use a key phrase to set the substitution alphabet.

Write down each unique letter of the key phrase in order, thenappend the rest of the unused letters of the alphabet.

plaintext: _ABCDEFGHIJKLMNOPQRSTUVWXYZsubstitution: THE_QUICKBROWNFXJMPDAGLSVYZ

E.g. key phrase = THE QUICK BROWN FOX JUMPED

Page 28: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Keyed Substitution

Security?Any letter can stand for any other letter. Thus there

are 27! possible different substitutions schema.

27 * 26 * 25 * … * 3 * 2 = 1029

At one permutation tested per second, it would takea million, million, million centuries to test them all.

Seems pretty secure …….. but ...

Page 29: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WSCZSDZHAKVSHQZAKZKE_ZDXXKZVHZKEXZBSHCQZSDZGSLXZOXZTXXKZEXAJ ZSPJZLSVYXQZOXZXHKJXAKZWSCZCXD XHCZSPJZDJXXZGAHCZ

Page 30: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WSCZSDZHAKVSHQZAKZKE_ZDXXKZVHZKEXZBSHCQZSDZGSLXZOXZTXXKZEXAJ ZSPJZLSVYXQZOXZXHKJXAKZWSCZCXD XHCZSPJZDJXXZGAHCZ

letter frequency:

Z 23

Page 31: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WSCZSDZHAKVSHQZAKZKE_ZDXXKZVHZKEXZBSHCQZSDZGSLXZOXZTXXKZEXAJ ZSPJZLSVYXQZOXZXHKJXAKZWSCZCXD XHCZSPJZDJXXZGAHCZ

letter frequency:

Z 23

probability in English:

space .20

Page 32: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WSC SD HAKVSHQ AK KE_ DXXK VH KEX BSHCQ SD GSLX OX TXXK EXAJ SPJ LSVYXQ OX XHKJXAK WSC CXD XHC SPJ DJXX GAHC

letter frequency:

Z 23

probability in English:

space .20

Page 33: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WSC SD HAKVSHQ AK KE_ DXXK VH KEX BSHCQ SD GSLX OX TXXK EXAJ SPJ LSVYXQ OX XHKJXAK WSC CXD XHC SPJ DJXX GAHC

letter frequency:

Z 23X 16

probability in English:

space .20

Page 34: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WSC SD HAKVSHQ AK KE_ DXXK VH KEX BSHCQ SD GSLX OX TXXK EXAJ SPJ LSVYXQ OX XHKJXAK WSC CXD XHC SPJ DJXX GAHC

letter frequency:

Z 23X 16

probability in English:

space .20 e .15

Page 35: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WSC SD HAKVSHQ AK KE_ DeeK VH KEe BSHCQ SD GSLe Oe TeeK EeAJ SPJ LSVYeQ Oe eHKJeAK WSC CeD eHC SPJ DJee GAHC

letter frequency:

Z 23X 16

probability in English:

space .20 e .15

Page 36: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WSC SD HAKVSHQ AK KE_ DeeK VH KEe BSHCQ SD GSLe Oe TeeK EeAJ SPJ LSVYeQ Oe eHKJeAK WSC CeD eHC SPJ DJee GAHC

letter frequency:

Z 23X 16S 10

probability in English:

space .20 e .15

Page 37: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WSC SD HAKVSHQ AK KE_ DeeK VH KEe BSHCQ SD GSLe Oe TeeK EeAJ SPJ LSVYeQ Oe eHKJeAK WSC CeD eHC SPJ DJee GAHC

letter frequency:

Z 23X 16S 10

probability in English:

space .20 e .15 o .09

Page 38: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WoC oD HAKVoHQ AK KE_ DeeK VH KEe BoHCQ oD GoLe Oe TeeK EeAJ oPJ LoVYeQ Oe eHKJeAK WoC CeD eHC oPJ DJee GAHC

letter frequency:

Z 23X 16S 10

probability in English:

space .20 e .15 o .09

Page 39: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WoC oD HAKVoHQ AK KE_ DeeK VH KEe BoHCQ oD GoLe Oe TeeK EeAJ oPJ LoVYeQ Oe eHKJeAK WoC CeD eHC oPJ DJee GAHC

letter frequency:

Z 23X 16S 10K 8

probability in English:

space .20 e .15 o .09

Page 40: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WoC oD HAKVoHQ AK KE_ DeeK VH KEe BoHCQ oD GoLe Oe TeeK EeAJ oPJ LoVYeQ Oe eHKJeAK WoC CeD eHC oPJ DJee GAHC

letter frequency:

Z 23X 16S 10K 8

probability in English:

space .20 e .15 o .09 t .08

Page 41: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WoC oD HAtVoHQ At tE_ Deet VH tEe BoHCQ oD GoLe Oe Teet EeAJ oPJ LoVYeQ Oe eHtJeAt WoC CeD eHC oPJ DJee GAHC

letter frequency:

Z 23X 16S 10K 8

probability in English:

space .20 e .15 o .09 t .08

Page 42: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WoC oD HAtVoHQ At tE_ Deet VH tEe BoHCQ oD GoLe Oe Teet EeAJ oPJ LoVYeQ Oe eHtJeAt WoC CeD eHC oPJ DJee GAHC

letter frequency:

Z 23X 16S 10K 8H 7

probability in English:

space .20 e .15 o .09 t .08

Page 43: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WoC oD nAtVonQ At tE_ Deet Vn tEe BonCQ oD GoLe Oe Teet EeAJ oPJ LoVYeQ Oe entJeAt WoC CeD enC oPJ DJee GAnC

letter frequency:

Z 23X 16S 10K 8H 7

probability in English:

space .20 e .15 o .09 t .08 n .07

Page 44: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

WoC oD nAtVonQ At tE_ Deet Vn tEe BonCQ oD GoLe Oe Teet EeAJ oPJ LoVYeQ Oe entJeAt WoC CeD enC oPJ DJee GAnC

letter frequency:

Z 23X 16S 10K 8H 7C 6

probability in English:

space .20 e .15 o .09 t .08 n .07

Page 45: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod oD nAtVonQ At tE_ Deet Vn tEe BondQ oD GoLe Oe Teet EeAJ oPJ LoVYeQ Oe entJeAt Wod deD end oPJ DJee GAnd

letter frequency:

Z 23X 16S 10K 8H 7C 6

probability in English:

space .20 e .15 o .09 t .08 n .07 d .06

Page 46: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod oD nAtVonQ At tE_ Deet Vn tEe BondQ oD GoLe Oe Teet EeAJ oPJ LoVYeQ Oe entJeAt Wod deD end oPJ DJee GAnd

Page 47: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod oD nAtVonQ At tE_ Deet Vn tEe BondQ oD GoLe Oe Teet

EeAJ oPJ LoVYeQ Oe entJeAt Wod deDend oPJ DJee GAnd

Page 48: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod oD nAtVonQ At tE_ Deet Vn tEe BondQ oD GoLe Oe Teet

EeAJ oPJ LoVYeQ Oe entJeAt Wod deDend oPJ DJee GAnd

Page 49: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod of nAtVonQ At tE_ feet Vn tEe BondQ of GoLe Oe Teet

EeAJ oPJ LoVYeQ Oe entJeAt Wod defend oPJ fJee GAnd

Page 50: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod of nAtVonQ At tE_ feet Vn tEe BondQ of GoLe Oe Teet

EeAJ oPJ LoVYeQ Oe entJeAt Wod defend oPJ fJee GAnd

Page 51: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod of nAtVonQ At tE_ feet Vn tEe BondQ of GoLe Oe Teet

EeAr oPr LoVYeQ Oe entreAt Wod defend oPr free GAnd

Page 52: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod of nAtVonQ At tE_ feet Vn tEe BondQ of GoLe Oe Teet

EeAr oPr LoVYeQ Oe entreAt Wod defend oPr free GAnd

Page 53: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod of natVonQ at tE_ feet Vn tEe BondQ of GoLe Oe Teet

Eear oPr LoVYeQ Oe entreat Wod defend oPr free Gand

Page 54: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod of natVonQ at tE_ feet Vn tEe BondQ of GoLe Oe Teet

Eear oPr LoVYeQ Oe entreat Wod defend oPr free Gand

Page 55: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod of nations at th_ feet in the Bonds of GoLe Oe Teet

hear oPr LoiYes Oe entreat Wod defend oPr free Gand

Page 56: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

Wod of nations at th_ feet in the Bonds of GoLe Oe Teet

hear oPr LoiYes Oe entreat Wod defend oPr free Gand

Page 57: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

ciphertext:

God of nations at th_ feet in the bonds of love we meet

hear our voices we entreat God defend our free land

Page 58: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

plaintext:

God of nations at thy feet in the bonds of love we meet

hear our voices we entreat God defend our free land

Page 59: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Strangely enough, it wasn’t until around the time ofQueen Elizabeth I that general substitution codes werefound breakable (1580).

The catalyst was a plot by Queen Mary of Scotland andher loyal friends to depose Elizabeth and seize theEnglish throne. Mary was using a very clever substitutioncode which included “nulls” … irrelevant symbolsintroduced to alter the statistics of English.

The idea that language exhibited conspicuous statisticalregularities was just beginning to be exploited.

Page 60: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

The Vigenere Cipher (1600)

One way to alter the statistics of the ciphertext is tochange the substitution code often during encryption.

Instead of using a key phrase to create one substitution,use it to create many substitutions and rotate through themas each letter of the plaintext is encrypted.

Page 61: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

The Vigenere Cipher

plaintext: ATTACK AT DAWN

key: ABC

Page 62: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

The Vigenere Cipher

plaintext: ATTACK AT DAWN

key: ABC

ABCABCABCABCAB

Page 63: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

The Vigenere Cipher

plaintext: ATTACK AT DAWN +

key: ABC

ABCABCABCABCAB

BVWBENACWAFDXPciphertext:

Page 64: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

The Vigenere Cipher

plaintext: ATTACK AT DAWN

key: ABC

ABCABCABCABCAB

BVWBENACWAFDXPciphertext:

Notice that the same letter can encode differently.

Page 65: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

The Vigenere Cipher

plaintext: ATTACK AT DAWN

key: ABC

ABCABCABCABCAB

BVWBENACWAFDXPciphertext:

While A occurs four times and T three times in themessage, nothing occurs more than twice in the cipher.

Page 66: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Attacking the Vigenere Cipher

ciphertext:

HQGAQIAPDUKROUCBVCUJAAHHFVCJPCUJHADROFVAQIANRWGCXGCNGHUBKFCUAQXSBYPKFFUCXGCFPWSGDUBJPFCEGIFPGAQXSBISGHANDOF

Page 67: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Attacking the Vigenere Cipher

ciphertext:

HQGAQIAPDUKROUCBVCUJAAHHFVCJPCUJHADROFVAQIANRWGCXGCNGHUBKFCUAQXSBYPKFFUCXGCFPWSGDUBJPFCEGIFPGAQXSBISGHANDOF

Guess the length of key phrase and apply a statisticaltest to letters separated by that distance.

Page 68: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Attacking the Vigenere Cipher

ciphertext:

HQGAQIAPDUKROUCBVCUJAAHHFVCJPCUJHADROFVAQIANRWGCXGCNGHUBKFCUAQXSBYPKFFUCXGCFPWSGDUBJPFCEGIFPGAQXSBISGHANDOF

Guess the length of key phrase and apply a statisticaltest to letters separated by that distance.

k = 3 ?

Page 69: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Attacking the Vigenere Cipher

ciphertext:

HQGAQIAPDUKROUCBVCUJAAHHFVCJPCUJHADROFVAQIANRWGCXGCNGHUBKFCUAQXSBYPKFFUCXGCFPWSGDUBJPFCEGIFPGAQXSBISGHANDOF

Guess the length of key phrase and apply a statisticaltest to letters separated by that distance.

k = 3 ? A occurs 9 times

Page 70: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Attacking the Vigenere Cipher

ciphertext:

HQG QI PDUKROUCBVCUJA HHFVCJPCUJH DROFV QI NRWGCXGCNGHUBKFCU QXSBYPKFFUCXGCFPWSGDUBJPFCEGIFPG QXSBISGH NDOF

Guess the length of key phrase and apply a statisticaltest to letters separated by that distance.

k = 3 ? A occurs 9 times = space?

Page 71: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Attacking the Vigenere Cipher

ciphertext:

HQG QI PDUKROUCBVCUJA HHFVCJPCUJH DROFV QI NRWGCXGCNGHUBKFCU QXSBYPKFFUCXGCFPWSGDUBJPFCEGIFPG QXSBISGH NDOF

Guess the length of key phrase and apply a statisticaltest to letters separated by that distance.

k = 3 ? A occurs 9 times = space?offset of every third letter is 1?

Page 72: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Attacking the Vigenere Cipher

ciphertext:

gQG QI PDtKRnUCaVCtJA HHeVCiPCtJH DRnFV QI NRvGCwGCmGHtBKeCU QXrBYoKFeUCwGCePWrGDtBJoFCdGIePG QXrBIrGH NDnF

Guess the length of key phrase and apply a statisticaltest to letters separated by that distance.

k = 3 ? A occurs 9 times = space?offset of every third letter is 1?

Page 73: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Vernam Cipher (1917)

Solution? make the keyphrase as long as the message!

message: ATTACK AT DAWN

Page 74: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Vernam Cipher

Solution? make the keyphrase as long as the message!

message: ATTACK AT DAWN key: ABCDEFGHIJKLMN

Page 75: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Vernam Cipher

Solution? make the keyphrase as long as the message!

message: ATTACK AT DAWN key: ABCDEFGHIJKLMN

ciphertext: BVWEHQGIBJOMIA

Page 76: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Vernam Cipher

Solution? make the keyphrase as long as the message!

message: ATTACK AT DAWN key: ABCDEFGHIJKLMN

ciphertext: BVWEHQGIBJOMIA

Now any letter can encode as any other letter atany point in the message.

Page 77: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Vernam Cipher

Solution? make the keyphrase as long as the message!

message: ATTACK AT DAWN key: ABCDEFGHIJKLMN

ciphertext: BVWEHQGIBJOMIA

Now any letter can encode as any other letter atany point in the message.

Solving a letter doesn’t help solve any others.

Page 78: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Vernam Cipher

Solution? make the keyphrase as long as the message!

message: ATTACK AT DAWN key: ABCDEFGHIJKLMN

ciphertext: BVWEHQGIBJOMIA

Now any letter can encode as any other letter atany point in the message.

Solving a letter doesn’t help solve any others.

Only provably secure encryption scheme!

Page 79: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Vernam Cipher

Two major problems:

Page 80: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Vernam Cipher

Two major problems:

1. Can’t re-use keys, so how do we make them?(one-time pad)

Page 81: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Vernam Cipher

Two major problems:

1. Can’t re-use keys, so how do we make them?(one-time pad)

2. How do we distribute them?

Page 82: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Digital Vernam Cipher

Solution: generate keys

randomgenerator

message

encoder encoded message

Page 83: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Digital Vernam Cipher

message = ‘V’ = 86 = 01010110

random number = 223 = 11100101

XOR = 10110011

random number = 223 = 11100101

XOR = 01010110 = ‘V’

= cipher

Page 84: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Digital Vernam Cipher

Solution: generate keys

randomgenerator

message

encoder encoded message

Problem: distribute generator for decoding

Page 85: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Public Key encryption

Solution: publish the encryption key

RSA:

1. generate 3 large prime numberss=97 x=47 y=79

which give N = x * y, or N=3713

2. find a unique value, p, satisfying(p*s) mod (x-1)*(y-1) = 1

which, in this case, gives p = 37

Page 86: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

RSA:

3. Encrypt a message segment, m, usingmp mod N

e.g. for m = 0120012037 mod 3713 = 1404

Public Key encryption

4. decrypt the coded segment, c, usingcs mod N

e.g.140497 mod 3713 = 0120

Page 87: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

RSA: publish some of the values (p, N)

Anyone wanting to send us a message can useour public key to encrypt it.

Public Key encryption

We decrypt the message with our secret key, (s, N)

Cracking our code is as hard as deriving s from (p, N)

Page 88: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

RSA: how secure is it

Anyone can crack our coded messages bymathematically deriving s from (p, N), which ispossible ….. but …

Public Key encryption

If N is very large, then finding its factors(i.e. x and y, from which we get p) takes a verylong time … too long to make it worth while.

Page 89: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

RSA: one way to crack it

Quantum computers can simultaneously testall possible factors …but …

So far, only 5-qubit quantum machines havebeen achieved … and …

We can use quantum computers to make newencryption schemes.

Public Key encryption

Page 90: Keeping your bits private! Tony C Smith Dept. Computer Science University of Waikato Science of cryptography = Art of keeping secrets

Instead of encoding the information …

… hide it!

Bury our bits in image files in a way that no one can see them, or in audio files in a way no one can hear them.

Demo in the S Block foyer on state-of-the-art steganography research, by Kathryn Hempstalk

Steganography