cit 380 securing computer systems n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
CIT 380: Securing Computer Systems PowerPoint Presentation
Download Presentation
CIT 380: Securing Computer Systems

Loading in 2 Seconds...

play fullscreen
1 / 67

CIT 380: Securing Computer Systems - PowerPoint PPT Presentation


  • 151 Views
  • Uploaded on

CIT 380: Securing Computer Systems. Classical Cryptography. Overview. Modular Arithmetic Review What is Cryptography? Transposition Ciphers Substition Ciphers Cæsar cipher Vigènere cipher Cryptanalysis: frequency analysis Block Ciphers DES. Modular Arithmetic. Congruence

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CIT 380: Securing Computer Systems' - red


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cit 380 securing computer systems

CIT 380: Securing Computer Systems

Classical Cryptography

CIT 380: Securing Computer Systems

overview
Overview
  • Modular Arithmetic Review
  • What is Cryptography?
  • Transposition Ciphers
  • Substition Ciphers
    • Cæsar cipher
    • Vigènere cipher
  • Cryptanalysis: frequency analysis
  • Block Ciphers
  • DES

CIT 380: Securing Computer Systems

modular arithmetic
Modular Arithmetic

Congruence

  • a = b (mod N) iff a = b + kN
  • Equivalently, a = b (mod N) iff N / (a – b)
  • ex: 37=27 mod 10

b is the residue of a, modulo N

  • Ints 0..N-1 are complete set of residues mod N

CIT 380: Securing Computer Systems

laws of modular arithmetic
Laws of Modular Arithmetic
  • (a + b) mod N = (a mod N + b mod N) mod N
  • (a - b) mod N = (a mod N - b mod N) mod N
  • ab mod N = (a mod N)(b mod N) mod N
  • a(b+c) mod N = ((ab mod N)+(ac mod N)) mod N

CIT 380: Securing Computer Systems

what is cryptography
What is Cryptography?

Cryptography: The art and science of keeping messages secure.

Cryptanalysis: the art and science of decrypting messages.

Cryptology: cryptography + cryptanalysis

CIT 380: Securing Computer Systems

terminology

Plaintext

Encryption

Procedure

Ciphertext

Terminology
  • Plaintext: message to be encrypted. Also called cleartext.
  • Encryption: altering a message to keep its contents secret.
  • Ciphertext: encrypted message.

CIT 380: Securing Computer Systems

history of cryptography
History of Cryptography

Egyptian hieroglyphics ~ 2000 B.C.E.

  • Cryptic tomb enscriptions for regality.

Spartan skytale cipher ~ 500 B.C.E.

  • Wrapped thin sheet of papyrus around staff.
  • Messages written down length of staff.
  • Decrypted by wrapped around = diameter staff.

Cæsar cipher ~ 50 B.C.E.

  • Simple alphabetic substitution cipher.

al-Kindi ~ 850 C.E.

  • Cryptanalysis using letter frequencies.

CIT 380: Securing Computer Systems

history of cryptography1
History of Cryptography

Alberti’s polyalphabetic cipher 1467

Decryption of Zimmerman telegram 1917

  • Leads US into World War I

Japanese Purple Machine cracked 1937

  • US breaks rotor machine for highest secrets.

German Enigma machine cracked 1933-45

  • Initially broken by Polish mathematician Rejewski
  • Variants broken at Bletchley Park in UK
  • Colossus, world’s 1st electronic computer.

CIT 380: Securing Computer Systems

cryptosystem formal definition
Cryptosystem Formal Definition

5-tuple (E, D, M, K, C)

  • M set of plaintexts
  • K set of keys
  • C set of ciphertexts
  • E set of encryption functions e: M KC
  • D set of decryption functions d: C KM

CIT 380: Securing Computer Systems

example c sar cipher
Example: Cæsar cipher

Letter shifting cipher (A=>D, B=>E, C=>F, …)

5-tuple

  • M = { all sequences of letters }
  • K = { i | i is an integer and 0 ≤ i ≤ 25 }
  • E = { Ek | kK and for all letters m,

Ek(m) = (m + k) mod 26 }

  • D = { Dk | kK and for all letters c,

Dk(c) = (26 + c – k) mod 26 }

  • C = M

History: Cæsar’s key was 3.

CIT 380: Securing Computer Systems

example c sar cipher1
Example: Cæsar 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’
  • Ciphertext is KHOOR ZRUOG

CIT 380: Securing Computer Systems

a transposition cipher
A Transposition Cipher

Rearrange letters in plaintext.

Example: Rail-Fence Cipher

  • Plaintext is HELLO WORLD
  • Rearrange as

H L O O L

E L W R D

  • Ciphertext is HLOOL ELWRD

CIT 380: Securing Computer Systems

cryptosystem security dependencies
Cryptosystem Security Dependencies
  • Quality of shared encryption algorithm E
  • Secrecy of key K

CIT 380: Securing Computer Systems

cryptanalysis
Cryptanalysis

Goals

  • Decrypt a given message.
  • Recover encryption key.

Adversarial models vary based on

  • Type of information available to adversary
  • Interaction with cryptosystem.

CIT 380: Securing Computer Systems

cryptanalysis adversarial models
Cryptanalysis Adversarial Models
  • ciphertext only: adversary has only ciphertext; goal is to find plaintext, possibly key.
  • known plaintext: adversary has ciphertext, corresponding plaintext; goal is to find key.
  • chosen plaintext: adversary may supply plaintexts and obtain corresponding ciphertext; goal is to find key.

CIT 380: Securing Computer Systems

classical cryptography
Classical Cryptography

Sender & receiver share common key

  • Keys may be the same, or trivial to derive from one another.
  • Sometimes called symmetric cryptography.

CIT 380: Securing Computer Systems

substitution ciphers
Substitution Ciphers

Substitute plaintext chars for ciphered chars.

  • Simple: Always use same substitution function.
  • Polyalphabetic: Use different substitution functions based on position in message.

CIT 380: Securing Computer Systems

cryptanalysis of c sar cipher
Cryptanalysis of Cæsar Cipher

Exhaustive search

  • If the key space is small enough, try all possible keys until you find the right one.
  • Cæsar cipher has 26 possible keys.

CIT 380: Securing Computer Systems

general simple substitution cipher
General Simple Substitution Cipher

Key Space: All permutations of alphabet.

Encryption:

  • Replace each plaintext letter x with K(x)

Decryption:

  • Replace each ciphertext letter y with K-1(y)

Example:

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

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

CRYPTO BQCOWP

CIT 380: Securing Computer Systems

general substitution cryptanalysis
General Substitution Cryptanalysis

Exhaustive search impossible

  • Key space size is 26! =~ 4 x 1026
  • Historically thought to be unbreakable.
  • Yet people solve them as newspaper puzzles every day…

Solution: frequency analysis.

Lesson: A large key space is necessary but not sufficient for security of a cryptosystem.

CIT 380: Securing Computer Systems

cryptanalysis frequency analysis
Cryptanalysis: Frequency Analysis

Languages have different frequencies of

  • letters
  • digrams (groups of 2 letters)
  • trigrams (groups of 3 letters)
  • etc.

Simple substitution ciphers preserve

frequency distributions.

CIT 380: Securing Computer Systems

english letter frequencies
English Letter Frequencies

CIT 380: Securing Computer Systems

additional frequency features
Additional Frequency Features
  • Digram frequencies
    • Common digraphs: EN, RE, ER, NT, TH
  • Trigram frequencies
    • Common trigrams: THE, ING, THA, ENT
  • Vowels other than E rarely followed by another vowel.
  • The letter Q is followed only by U.
  • Many others.

CIT 380: Securing Computer Systems

countering frequency analysis
Countering Frequency Analysis

Nulls

  • Insert additional symbols (numbers) which have no meaning in random places.

Idiosyncratic spellings

  • Hacker speak: www.google.com/intl/xx-hacker

Homophonic substitution

  • Each letter has multiple substitutions.

These techniques increase difficulty of frequency analysis but don’t make it impossible.

CIT 380: Securing Computer Systems

countering frequency analysis1
Countering Frequency Analysis

Primary weakness of simple substition:

  • Each ciphertext letter corresponds to only one letter of plaintext.

Solution: polyalphabetic substitution

  • Use multiple cipher alphabets.
  • Switch between cipher alphabets from character to character in the plaintext.

CIT 380: Securing Computer Systems

letter frequency distributions
Letter Frequency Distributions

CIT 380: Securing Computer Systems

vig nere cipher
Vigènere Cipher

Use phrase instead of letter as key.

Example:

  • Message THE BOY HAS THE BALL
  • Key VIG
  • Encipher using Cæsar cipher for each letter:

key VIGVIGVIGVIGVIGV

plain THEBOYHASTHEBALL

cipher OPKWWECIYOPKWIRG

Key space size is 26m.

CIT 380: Securing Computer Systems

relevant parts of tableau
G I V

A G I V

B H J W

E L M Z

H N P C

L R T G

O U W J

S Y A N

T Z B O

Y E H T

Tableau shown has relevant rows, columns only.

Example encipherments:

key V, letter T: follow V column down to T row (giving “O”)

Key I, letter H: follow I column down to H row (giving “P”)

Relevant Parts of Tableau

CIT 380: Securing Computer Systems

useful terms
Useful Terms

period: length of key

  • In earlier example, period is 3

tableau: table used to encipher and decipher

  • Vigènere cipher has key letters on top, plaintext letters on the left.

CIT 380: Securing Computer Systems

simple attacks
Simple Attacks
  • Chosen Plaintext
    • Choose plaintext of all a’s.
    • If long enough, it will be encrypted to the key.
  • Dictionary Attack
    • Guess key from dictionary and try decryption.
  • Brute Force
    • Try every possible key in turn.
    • Is there a ciphertext only attack that’s faster?

CIT 380: Securing Computer Systems

vig nere cryptanalysis
Vigènere Cryptanalysis
  • Find key length (period).
  • Break message into n parts, each part being enciphered using the same key letter.
  • Use frequency analysis to solve resulting simple substition ciphers.

key VIGVIGVIGVIGVIGV

plain THEBOYHASTHEBALL

cipher OPKWWECIYOPKWIRG

CIT 380: Securing Computer Systems

kaskski test
Kaskski Test
  • Conjunction of key repetition with repeated portion of plaintext produces repeated ciphertext.
  • Example:

key VIGVIGVIGVIGVIGV

plain THEBOYHASTHEBALL

cipher OPKWWECIYOPKWIRG

Key and plaintext line up over the repetitions.

  • Distance between reptitions is 9
    • Repeated phrase “OPK” at 1st and 10th positions.
    • Period is a multiple of 9 (1, 3 or 9.)

CIT 380: Securing Computer Systems

example vig nere ciphertext
Example Vigènere Ciphertext

ADQYS MIUSB OXKKT MIBHK IZOOO

EQOOG IFBAG KAUMF VVTAA CIDTW

MOCIO EQOOG BMBFV ZGGWP CIEKQ

HSNEW VECNE DLAAV RWKXS VNSVP

HCEUT QOIOF MEGJS WTPCH AJMOC

HIUIX

CIT 380: Securing Computer Systems

repetitions in example
Repetitions in Example

CIT 380: Securing Computer Systems

estimate of period
Estimate of Period
  • OEQOOG is probably not a coincidence
    • Two character repetitions may be chance.
    • Period may be 1, 2, 3, 5, 6, 10, 15, or 30
  • Most others (7/10) have 2 in their factors
  • Almost as many (6/10) have 3 in their factors.
  • Begin with period of 2  3 = 6.

CIT 380: Securing Computer Systems

letter coincidence
Letter Coincidence
  • Coincidence: Picking two letters at random from a message that are identical.
  • Probability of picking two a’s
    • Let there be n letters in the ciphertext.
    • Let there be na a’s in the ciphertext.
    • The probability of selecting two a’s at random

CIT 380: Securing Computer Systems

index of coincidence
Index of Coincidence

Probability of chosing two identical letters

Coincidence probabilities for two letters:

  • English plaintext: 0.0667
  • Random English letters: 1/26 @ 0.0385

CIT 380: Securing Computer Systems

english letter frequencies1
English Letter Frequencies

CIT 380: Securing Computer Systems

coincidence counting
Coincidence Counting

Plaintext

Plaintext/Ciphertext

Simple Language: f(A)=0.75, f(B)=0.25

Simple Cipher: Swap A’s and B’s

CIT 380: Securing Computer Systems

friedman test

Index of Coincidence

Shorter Key

Longer Key

0.0667

Friedman Test

Expected IC

  • Random: 0.0385
  • Plaintext: 0.0667

Expected IC by period

  • 2: 0.052
  • 3: 0.047
  • 4: 0.045
  • 5: 0.044
  • 10: 0.041

0.0385

CIT 380: Securing Computer Systems

compute i c for example
Compute I.C. for Example

For our ciphertext, IC = 0.043

  • Indicates a key of slightly more than 5.
  • A statistical measure, so it can be in error, but it agrees with the previous estimate (6).

If the key has m characters, then every mth

character is enciphered with the same shift.

  • The string of letters won’t be recognizable.
  • But its letter frequencies should be the same as English as it’s a monoalphabetic ciphertext.

CIT 380: Securing Computer Systems

splitting into alphabets
Splitting Into Alphabets

Alphabet IC

AIKHOIATTOBGEEERNEOSAI 0.069

DUKKEFUAWEMGKWDWSUFWJU 0.078

QSTIQBMAMQBWQVLKVTMTMI 0.078

YBMZOAFCOOFPHEAXPQEPOX 0.056

SOIOOGVICOVCSVASHOGCC 0.124

MXBOGKVDIGZINNVVCIJHH 0.043

Divide cipher into 6 (period) alphabets.

IC indicates single alphabet, except #4 and #6.

CIT 380: Securing Computer Systems

frequency examination
Frequency Examination

ABCDEFGHIJKLMNOPQRSTUVWXYZ

1 31004011301001300112000000

2 10022210013010000010404000

3 12000000201140004013021000

4 21102201000010431000000211

5 10500021200000500030020000

  • 01110022311012100000030101

HMMMHMMHHMMMMHHMLHHHMLLLLL

Unshifted frequencies (H high, M medium, L low)

CIT 380: Securing Computer Systems

begin decryption
Begin Decryption
  • First matches characteristics of unshifted alphabet
  • Third matches if I shifted to A
  • Sixth matches if V shifted to A
  • Substitute into ciphertext (bold are substitutions)

ADIYS RIUKB OCKKL MIGHK AZOTO EIOOL IFTAG PAUEF VATAS CIITW EOCNO EIOOL BMTFV EGGOP CNEKI HSSEW NECSE DDAAA RWCXS ANSNP HHEUL QONOF EEGOS WLPCM AJEOC MIUAX

CIT 380: Securing Computer Systems

look for clues
Look For Clues

AJE in last line suggests “are”, meaning second alphabet maps A into S:

ALIYS RICKB OCKSL MIGHS AZOTO

MIOOL INTAG PACEF VATIS CIITE

EOCNO MIOOL BUTFV EGOOP CNESI

HSSEE NECSE LDAAA RECXS ANANP

HHECL QONON EEGOS ELPCM AREOC

MICAX

CIT 380: Securing Computer Systems

next alphabet
Next Alphabet

MICAX in last line suggests “mical” (a common ending for an adjective), meaning fourth alphabet maps O into A:

ALIMS RICKP OCKSL AIGHS ANOTO MICOL INTOG PACET VATIS QIITE ECCNO MICOL BUTTV EGOOD CNESI VSSEE NSCSE LDOAA RECLS ANAND HHECL EONON ESGOS ELDCM ARECC MICAL

CIT 380: Securing Computer Systems

got it
Got It!

QI means that U maps into I, as Q is always followed by U:

ALIME RICKP ACKSL AUGHS ANATO MICAL INTOS PACET HATIS QUITE ECONO MICAL BUTTH EGOOD ONESI VESEE NSOSE LDOMA RECLE ANAND THECL EANON ESSOS ELDOM ARECO MICAL

CIT 380: Securing Computer Systems

countering frequency analaysis
Countering Frequency Analaysis
  • Observation: If Vigènere key is very long, frequency analysis won’t work.
  • Problem: Long keys are hard to remember.
  • Solution: Use multiple encryptions.
    • Encrypting with a key m and key n is same as encryption by key whose length is least common multiple of m and n.
    • If m and n are relatively prime, then the least common multiple is mn.

CIT 380: Securing Computer Systems

rotor machines
Rotor Machines

Use multiple rounds of Vigènere substitution.

  • Machine contains multiple cylinders.
  • Each cylinder has 26 states (ciphers).
  • Cylinders rotate to change states on different schedules.
  • m-cylinder machine has 26m substitution ciphers.

CIT 380: Securing Computer Systems

enigma machine
Enigma Machine
  • 3 rotors: 17576 substitutions.
  • 3 rotors can be used in any order: 6 combinations.
  • Plug board: 6 pairs of letters can be swapped.
  • Total keys ~ 1016

CIT 380: Securing Computer Systems

perfect security the one time pad
Perfect Security: The One-Time Pad
  • A Vigenère cipher with a random key at least as long as the message.
  • Provably unbreakable.
  • Example ciphertext: DXQR.
  • Equally likely to correspond to
    • plaintext DOIT (key AJIY)
    • plaintext DONT (key AJDY)
    • and any other 4 letters.

CIT 380: Securing Computer Systems

one time pad
One-Time Pad
  • Warning: keys must be random, or you can attack the cipher by trying to regenerate the key.
  • Approximations, such as using computer pseudorandom number generators to generate keys, are not random.

CIT 380: Securing Computer Systems

block ciphers
Block Ciphers
  • Encrypt groups (blocks) of chars at once.
  • Improvement over single char substitution
    • Cryptanalysis must use digraph frequencies for two-char blocks.
    • Longer blocks are more difficult to analyze.
    • Modern ciphers are block ciphers.
  • Example: Playfair Cipher, 1854

CIT 380: Securing Computer Systems

playfair cipher
Playfair Cipher

Create 5x5 table

  • Fill in spaces with letters of key, dropping duplicate letters.
  • Fill remaining spaces with unused letters of alphabet in order
    • Drop Q … or
    • I = J

CIT 380: Securing Computer Systems

playfair cipher1
Playfair Cipher

Encryption Algorithm

  • If letters of pair are identical (or only one letter remains), add an “X” after first letter.
  • If two letters are in same row or column, replace them with the succeeding letters.
  • Otherwise, two letters form a rectangle, and we replace them with letters on the same row respectively at the other pair of corners.

CIT 380: Securing Computer Systems

playfair cipher example
Playfair Cipher Example

Plaintext is HELLO WORLD

  • Pair HE is rectangle, replace with DM
  • Pair LX (X inserted) is rectangle, YR
  • Pair LO is rectangle, replace with AN
  • Pair WO is rectangle, replace with VQ
  • Pair RL is in column, replace with CR
  • Pair DX is rectangle, replace with GE

Ciphertext is DMYRANVQCRGE

CIT 380: Securing Computer Systems

transposition cipher cryptanalysis
Transposition Cipher Cryptanalysis

Anagramming

  • If
    • 1-gram frequencies match English frequencies,
    • but other n-gram frequencies do not,
  • then, message likely ciphered via transposition.
  • Rearrange letters to form n-grams with highest frequencies.

CIT 380: Securing Computer Systems

cryptanalysis example
Cryptanalysis Example

Rail Fence Ciphertext: HLOOLELWRD

Frequencies of 2-grams beginning with H

  • HE 0.0305
  • HO 0.0043
  • HL, HW, HR, HD < 0.0010

Frequencies of 2-grams ending in H

  • WH 0.0026
  • EH, LH, OH, RH, DH ≤ 0.0002

Implies E follows H

CIT 380: Securing Computer Systems

cryptanalysis example1
Cryptanalysis Example

Arrange so the H and E are adjacent

HE

LL

OW

OR

LD

Read across, then down, to recover plaintext.

CIT 380: Securing Computer Systems

shannon criteria
Shannon Criteria
  • Kerchoff’s Principle
    • The only secret should be the key.
    • Cipher should be secure if mechanism known but not the key.
  • Use both substitution + permutation
    • Substitution: hide local patterns of language.
    • Permutation: hide large-scale patterns by mixing different parts of plaintext.

CIT 380: Securing Computer Systems

sp networks
SP-Networks

Combine Substitution+Permutation (transposition)

  • Substitution: adding unknown key values will confuse attacker about value of plaintext symbol.
  • Permutation: Transposing text to ensure nothing is left in its original position.

Designing for Security

  • Block Size
  • Number of Rounds
    • Each input bit is XOR of several output bits from previous round.
  • Choice of S-boxes

CIT 380: Securing Computer Systems

overview of the des
Overview of the DES
  • Block cipher: encrypts blocks of 64 bits
    • 56-bit key + 8 parity bits
  • Product cipher
    • substitution + transposition
  • 16 rounds (iterations) of encryption
    • Round key generated from user key
    • Each round is a Feistel network.

CIT 380: Securing Computer Systems

des modes
DES Modes

Electronic Code Book Mode (ECB)

  • Encipher each block independently. Insecure.

Cipher Block Chaining Mode (CBC)

  • XOR each block with previous ciphertext block.
  • Requires an initialization vector for the first one.

Triple DES: Encrypt-Decrypt-Encrypt Mode (3 keys: k, k´, k´´)

  • c = DESk(DESk´–1(DESk’’(m)))
  • Double-encryption vulnerable to meet-in-middle attack, reducing difficulty from 2112 to 257.

CIT 380: Securing Computer Systems

cbc mode encryption

init. vector

m1

m2

DES

DES

c1

c2

sent

sent

CBC Mode Encryption

CIT 380: Securing Computer Systems

current status of des
Current Status of DES
  • Design for computer system, associated software that could break any DES-enciphered message in a few days published in 1998.
  • Several challenges to break DES messages solved using distributed computing.
  • NIST selected Rijndael as Advanced Encryption Standard, successor to DES.
    • 128-bit block product cipher.
    • Designed to withstand attacks that succeeded on DES.
    • Keys: 128, 192, or 256 bits.

CIT 380: Securing Computer Systems

key points
Key Points
  • Cryptography is the art of securing messages.
  • Types of ciphers
    • Substitition
    • Transposition (permutation)
    • Product
  • Cryptanalysis
    • Language features can be used to break ciphers.
    • Frequency analysis: Kaski test, Index of Coincidence.
  • Block ciphers
    • DES

CIT 380: Securing Computer Systems

references
References
  • Matt Bishop, Introduction to Computer Security, Addison-Wesley, 2005.
  • Paul Garrett, Making, Breaking Codes: An Introduction to Cryptology, Prentice Hall, 2001.
  • David Kahn, The Codebreakers, MacMillan, 1967.
  • Wenbo Mao, Modern Cryptography: Theory and Practice, Prentice Hall, 2004.
  • Alfred J. Menezes, Paul C. van Oorschot and Scott A. Vanstone, Handbook of Applied Cryptography, http://www.cacr.math.uwaterloo.ca/hac/, CRC Press, 1996.
  • NIST, FIPS Publication 46-3: Data Encryption Standard (DES), 1999, http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
  • Bruce Schneier, Applied Cryptography, 2nd edition, Wiley, 1996.
  • US Government Dept of the Army, FM 34-40-2 FIELD MANUAL, 1990, http://www.umich.edu/~umich/fm-34-40-2/
  • John Viega and Gary McGraw, Building Secure Software, Addison-Wesley, 2002.

CIT 380: Securing Computer Systems