Cryptography Network Systems Security Mort Anvari 8312004 Cryptography

  • Slides: 36
Download presentation
Cryptography Network Systems Security Mort Anvari 8/31/2004

Cryptography Network Systems Security Mort Anvari 8/31/2004

Cryptography n Can be characterized by n type of encryption operations used n n

Cryptography n Can be characterized by n type of encryption operations used n n number of keys used n n substitution / transposition / product single-key or shared / two-key or public way in which plaintext is processed n 8/31/2004 block / stream 2

Security of Cryptography n Unconditional security n n no matter how much computer power

Security of Cryptography n Unconditional security n n no matter how much computer power is available, the cipher cannot be broken since the ciphertext provides insufficient information to uniquely determine the corresponding plaintext Computational security n given limited computing resources (eg. time needed for calculations is greater than age of universe), the cipher cannot be broken 8/31/2004 3

Cryptographic Tools To Be Used n n Shared keys Public and private keys Hashing

Cryptographic Tools To Be Used n n Shared keys Public and private keys Hashing functions and message digest Nonces 8/31/2004 4

Symmetric Encryption n Sender and receiver share a common key All classical encryption algorithms

Symmetric Encryption n Sender and receiver share a common key All classical encryption algorithms belong to this type Was only type prior to invention of public-key in 1970’s 8/31/2004 5

Basic Terminology n n n n n plaintext - the original message ciphertext -

Basic Terminology n n n n n plaintext - the original message ciphertext - the coded message cipher - algorithm for transforming plaintext to ciphertext key - info used in cipher known only to sender/receiver encipher (encrypt) - converting plaintext to ciphertext decipher (decrypt) – restoring plaintext from ciphertext cryptography - study of encryption principles/methods cryptanalysis (codebreaking) - the study of principles/ methods of deciphering ciphertext without knowing key cryptology - the field of both cryptography and cryptanalysis 8/31/2004 6

Types of Cryptanalytic Attacks n n n Ciphertext only n only know algorithm, ciphertext,

Types of Cryptanalytic Attacks n n n Ciphertext only n only know algorithm, ciphertext, and statistics n can identify plaintext Known plaintext n know/suspect plaintext and ciphertext Chosen plaintext n select plaintext and obtain ciphertext Chosen ciphertext n select ciphertext and obtain plaintext Chosen text n select either plaintext or ciphertext to encrypt or decrypt 8/31/2004 7

Symmetric Cipher Model 8/31/2004 8

Symmetric Cipher Model 8/31/2004 8

Requirements n Two requirements for secure use of symmetric encryption n n a strong

Requirements n Two requirements for secure use of symmetric encryption n n a strong encryption algorithm a secret key K known only to sender and receiver Y = E K( X ) X = D K( Y ) Assume encryption algorithm is known Imply a secure channel used to distribute key 8/31/2004 9

Classical Substitution Ciphers n n Letters of plaintext are replaced by other letters, by

Classical Substitution Ciphers n n Letters of plaintext are replaced by other letters, by numbers, or by symbols If plaintext is viewed as a sequence of bits, then substitution involves replacing plaintext bit patterns with ciphertext bit patterns 8/31/2004 10

Caesar Cipher n n n Earliest known substitution cipher Invented by Julius Caesar First

Caesar Cipher n n n Earliest known substitution cipher Invented by Julius Caesar First attested use in military affairs Replace each letter by letter three places down the alphabet For example, meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWB 8/31/2004 11

Mechanism of Caesar Cipher n Can define transformation as a b c d e

Mechanism of Caesar Cipher n Can define transformation as 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 D E F G H I J K L M N O P Q R S T U V W X Y Z A B C n Or assign each letter a number a b c 0 1 2 n o 13 14 n d e f 3 4 5 p q 15 16 g h i 6 7 8 r s 17 18 j k l m 9 10 11 12 t u v w x y Z 19 20 21 22 23 24 25 In general, Caesar cipher can be specified as C = E(p) = (p + k) mod (26) p = D(C) = (C – k) mod (26) 8/31/2004 12

Cryptanalysis of Caesar Cipher n Only 26 possible ciphers n n Can easily break

Cryptanalysis of Caesar Cipher n Only 26 possible ciphers n n Can easily break with brute-force cryptanalysis n n n “A” maps to “A”, “B”, . . . “Z” Given ciphertext, just try all 26 ciphers Need to recognize the original plaintext eg. break ciphertext "GCUA VQ DTGCM" 8/31/2004 13

Monoalphabetic Cipher n n n Rather than just shifting the alphabet Can shuffle the

Monoalphabetic Cipher n n n Rather than just shifting the alphabet Can shuffle the letters arbitrarily Each letter in plain alphabet maps to a different random letter in cipher alphabet Hence key is 26 letters long For example, Plain: abcdefghijklmnopqrstuvwxyz Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN Plaintext: ifwewishtoreplaceletters Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA 8/31/2004 14

Monoalphabetic Cipher Security n n n Now have a total of 26! 4 x

Monoalphabetic Cipher Security n n n Now have a total of 26! 4 x 1026 keys With so many keys, might think is secure Still has problem: natural language characteristics 8/31/2004 15

Language Characteristics and Cryptanalysis n n Letters are not equally commonly used In English,

Language Characteristics and Cryptanalysis n n Letters are not equally commonly used In English, “E” is by far the most common letter, followed by “T”, “A”, “O”, “I”, “N”, “S”, “H”, “R” Other letters “Z”, “J”, “K”, “Q”, “X” are rarely used Have tables of single, double & triple letter frequencies 8/31/2004 16

English Letter Frequencies 8/31/2004 17

English Letter Frequencies 8/31/2004 17

Cryptanalysis of Caesar Cipher and Monoalphabetic Cipher n n n Fact: monoalphabetic substitution ciphers

Cryptanalysis of Caesar Cipher and Monoalphabetic Cipher n n n Fact: monoalphabetic substitution ciphers do not change relative letter frequencies Discovered by Arabian scientists in 9 th century Calculate letter frequencies for ciphertext Compare counts/plots against known values For Caesar cipher, look for common peaks and troughs n peaks at: A-E-I triple, NO pair, RST triple n troughs at: JK, X-Z For monoalphabetic, must identify each letter n tables of common double/triple letters help 8/31/2004 18

Example Cryptanalysis n Given ciphertext: UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ n n Count relative letter frequencies

Example Cryptanalysis n Given ciphertext: UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ n n Count relative letter frequencies Guess “P” and “Z” are “e” and “t” Guess “ZW” is “th” and hence “ZWP” is “the” Proceeding with trial and error finally get: it was disclosed yesterday that several informal but direct contacts have been made with political representatives of the viet cong in moscow 8/31/2004 19

Playfair Cipher n n n Not even the large number of keys in a

Playfair Cipher n n n Not even the large number of keys in a monoalphabetic cipher provides security One approach to improving security was to encrypt multiple letters Playfair cipher is an example 8/31/2004 20

Playfair Key Matrix n n A 5 X 5 matrix of letters based on

Playfair Key Matrix n n A 5 X 5 matrix of letters based on a keyword Fill in letters of keyword (sans duplicates) Fill rest of matrix with other letters Eg. using the keyword MONARCHY M C E L U 8/31/2004 O H F P V N A R Y B D G I/J K Q S T W X Z 21

Encrypting and Decrypting n plaintext encrypted two letters at a time 1. 2. 3.

Encrypting and Decrypting n plaintext encrypted two letters at a time 1. 2. 3. 4. if a pair is a repeated letter, insert a filler like “X” eg. “balloon” encrypts as “ba lx lo on” if both letters fall in the same row, replace each with letter to right (wrapping back to start from end) eg. “ar” encrypts as “RM” if both letters fall in the same column, replace each with the letter below it (again wrapping to top from bottom) eg. “mu” encrypts to “CM” otherwise each letter is replaced by the one in its row in the column of the other letter of the pair eg. “hs” encrypts to “BP”, and “ea” to “IM” or “JM” (as desired) 8/31/2004 22

Security of Playfair Cipher n n n Security much improved over monoalphabetic Have 26

Security of Playfair Cipher n n n Security much improved over monoalphabetic Have 26 x 26 = 676 digrams Would need a 676 entry frequency table to analyze (verses 26 for a monoalphabetic) Also need correspondingly more ciphertexts Can still be broken since still has much of plaintext structure 8/31/2004 23

Polyalphabetic Ciphers n n n Use multiple cipher alphabets to improve security Make cryptanalysis

Polyalphabetic Ciphers n n n Use multiple cipher alphabets to improve security Make cryptanalysis harder with more alphabets to guess and flatter frequency distribution Use a key to select which alphabet is used for each letter of the message Use each alphabet in turn Repeat from start after end of key is reached 8/31/2004 24

Vigenère Cipher n n n Simplest polyalphabetic substitution cipher which effectively multiply Caesar ciphers

Vigenère Cipher n n n Simplest polyalphabetic substitution cipher which effectively multiply Caesar ciphers Key is multiple letters long K = k 1 k 2. . . kd ith letter specifies ith alphabet to use Use each key letter as a Caesar cipher key Eg. using keyword deceptive key: deceptivedeceptive plaintext: wearediscoveredsaveyourself ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ 8/31/2004 25

Security of Vigenère Ciphers n n n Have multiple ciphertext letters for each plaintext

Security of Vigenère Ciphers n n n Have multiple ciphertext letters for each plaintext letter: obscure letter frequencies a bit Start with letter frequencies n see if look monoalphabetic or not n if not, need to determine number of alphabets Repetitions in ciphertext give clues to period Find same plaintext an exact period apart which results in the same ciphertext (could also be random fluke) Eg. repeated “VTW” in previous example suggests size of 3 or 9 8/31/2004 26

Autokey Cipher n n To eliminate periodic nature of keyword, prefix keyword to message

Autokey Cipher n n To eliminate periodic nature of keyword, prefix keyword to message as key Knowing keyword can recover the first few letters Use these in turn on the rest of the message Eg. given key deceptive key: deceptivewearediscoveredsav plaintext: wearediscoveredsaveyourself ciphertext: ZICVTWQNGKZEIIGASXSTSLVVWLA n Still have frequency characteristics to attack 8/31/2004 27

One-Time Pad n n If use a truly random key as long as plaintext,

One-Time Pad n n If use a truly random key as long as plaintext, cipher will be secure Unbreakable n n ciphertext bears no statistical relationship to the plaintext for any plaintext and any ciphertext there exists a key mapping one to other Can only use the key once Problems n n overhead of making large number pf random keys safe distribution of key 8/31/2004 28

Transposition Ciphers n n n Hide message by rearranging order of letters Without altering

Transposition Ciphers n n n Hide message by rearranging order of letters Without altering the actual letters used Can recognize these since they have the same frequency distribution as the original text 8/31/2004 29

Rail Fence Cipher n n n Write message letters out diagonally over a number

Rail Fence Cipher n n n Write message letters out diagonally over a number of rows Then read off cipher row by row For example, write message out as m e m a t r h t g p r y e t e f e t e o a a t and get ciphertext as MEMATRHTGPRYETEFETEOAAT 8/31/2004 30

Row Transposition Ciphers n n n A more complex scheme Write letters of message

Row Transposition Ciphers n n n A more complex scheme Write letters of message out in rows over a specified number of columns Then reorder the columns according to some key before reading off the rows Key: 3 4 2 1 5 6 7 Plaintext: a t t a c k p o s t p o n e d u n t i l t w o a m x y z Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ 8/31/2004 31

Product Ciphers n n n Ciphers using substitutions or transpositions are not secure because

Product Ciphers n n n Ciphers using substitutions or transpositions are not secure because of language characteristics Hence consider using several ciphers in succession to make it harder to break n two substitutions make a more complex substitution, but still a substitution n two transpositions make a more complex transposition, but still a transposition n but a substitution followed by a transposition makes a new much harder cipher Significance: bridge from classical to modern ciphers 8/31/2004 32

Rotor Machines n n Before modern ciphers, rotor machines were most common product cipher

Rotor Machines n n Before modern ciphers, rotor machines were most common product cipher Were widely used in WW 2 n n German Enigma, Allied Hagelin, Japanese Purple Implement a very complex, varying substitution cipher Use a series of cylinders, each giving one substitution, which rotate and change after each letter was encrypted With 3 cylinders, have 263=17576 alphabets 8/31/2004 33

An Example of Rotor Machine 8/31/2004 34

An Example of Rotor Machine 8/31/2004 34

Steganography n n An alternative to encryption Hide existence of message n n using

Steganography n n An alternative to encryption Hide existence of message n n using only a subset of letters/words in a longer message marked in some way using invisible ink hiding in LSB in graphic image or sound file Has drawbacks n high overhead to hide relatively few info bits 8/31/2004 35

Next Class n n Block ciphers Modern symmetric encryption standard 8/31/2004 36

Next Class n n Block ciphers Modern symmetric encryption standard 8/31/2004 36