IN2150/TEL2810: Introduction to Computer Security1 October 25, 2005 Introduction to Computer Security Lecture 7 Basic Cryptography & Network Security.

Slides:



Advertisements
Similar presentations
CLASSICAL ENCRYPTION TECHNIQUES
Advertisements

Public Key Encryptions CS461/ECE422 Fall Reading Material Text Chapters 2 and 20 Handbook of Applied Cryptography, Chapter 8 –
Computer Science CSC 474By Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.1 Introduction to Cryptography.
Symmetric Encryption Example: DES Weichao Wang. 2 Overview of the DES A block cipher: – encrypts blocks of 64 bits using a 64 bit key – outputs 64 bits.
Session 4 Asymmetric ciphers.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Cryptographic Security.
ECOMMERCE TECHNOLOGY FALL 2003 COPYRIGHT © 2003 MICHAEL I. SHAMOS Cryptography.
1 Overview of the DES A block cipher: –encrypts blocks of 64 bits using a 64 bit key –outputs 64 bits of ciphertext A product cipher –basic unit is the.
ITIS 3200: Introduction to Information Security and Privacy Dr. Weichao Wang.
November 1, 2004Introduction to Computer Security ©2004 Matt Bishop Slide crypto1-1 Crypto – B/B mindmeld history symmetric hashes/macs/1-way etc public.
Csci5233 Computer Security & Integrity 1 Cryptography: Basics (2)
RSA Exponentiation cipher
McGraw-Hill©The McGraw-Hill Companies, Inc., Security PART VII.
1 Day 04- Cryptography Acknowledgements to Dr. Ola Flygt of Växjö University, Sweden for providing the original slides.
ITIS 3200: Introduction to Information Security and Privacy Dr. Weichao Wang.
Overview of Cryptography and Its Applications Dr. Monther Aldwairi New York Institute of Technology- Amman Campus INCS741: Cryptography.
Lecture 23 Symmetric Encryption
Public Key Algorithms 4/17/2017 M. Chatterjee.
What is Cryptography? Definition: The science or study of the techniques of secret writing, esp. code and cipher systems, methods, and the like Google.
Public Key Cryptography and Cryptographic Hashes CS461/ECE422 Fall 2009.
CSCI 172/283 Fall 2010 Public Key Cryptography. New paradigm introduced by Diffie and Hellman The mailbox analogy: Bob has a locked mailbox Alice can.
Chapter 8.  Cryptography is the science of keeping information secure in terms of confidentiality and integrity.  Cryptography is also referred to as.
Encryption. Introduction Computer security is the prevention of or protection against –access to information by unauthorized recipients –intentional but.
CN8816: Network Security1 Confidentiality, Integrity & Authentication Confidentiality - Symmetric Key Encryption Data Integrity – MD-5, SHA and HMAC Public/Private.
Public Key Model 8. Cryptography part 2.
1 Introduction to Codes, Ciphers, and Cryptography Michael A. Karls Ball State University.
Chapter 12 Cryptography (slides edited by Erin Chambers)
CS5204 – Fall Cryptographic Security Presenter: Hamid Al-Hamadi October 13, 2009.
Page 1 Secure Communication Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 9: Cryptography.
© Neeraj Suri EU-NSF ICT March 2006 DEWSNet Dependable Embedded Wired/Wireless Networks MUET Jamshoro Computer Security: Principles and Practice Slides.
Prime Numbers Prime numbers only have divisors of 1 and self
Chapter 2 Basic Encryption and Decryption. csci5233 computer security & integrity 2 Encryption / Decryption encrypted transmission AB plaintext ciphertext.
1 IS 2150 / TEL 2810 Introduction to Security James Joshi Associate Professor, SIS Lecture 7 Oct 20, 2009 Basic Cryptography Network Security.
CIS 725 Security. Cryptosystem Quintuple ( E, D, M, K, C ) M set of plaintexts K set of keys C set of ciphertexts E set of encryption functions e: M 
I-4 security.
Chapter 2 – Elementary Cryptography  Concepts of encryption  Cryptanalysis  Symmetric (secret key) Encryption (DES & AES)(DES & AES)  Asymmetric (public.
Chapter 20 Symmetric Encryption and Message Confidentiality.
ITIS 3200: Introduction to Information Security and Privacy Dr. Weichao Wang.
Section 2.1: Shift Ciphers and Modular Arithmetic Practice HW from Barr Textbook (not to hand in) p.66 # 1, 2, 3-6, 9-12, 13, 15.
Midterm Review Cryptography & Network Security
1 Chapter 2-1 Conventional Encryption Message Confidentiality.
Chapter 20 Symmetric Encryption and Message Confidentiality.
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
Module 3 – Cryptography Cryptography basics Ciphers Symmetric Key Algorithms Public Key Algorithms Message Digests Digital Signatures.
Courtesy of Professors Chris Clifton & Matt Bishop INFSCI 2935: Introduction of Computer Security1 October 2, 2003 Introduction to Computer Security Lecture.
Symmetric-Key Cryptography
Part 9, Basic Cryptography 1. Introduction A cryptosystem is a tuple: ( M,K,C, E,D) where M is the set of plaintexts K the set of keys C the set of ciphertexts.
Elementary Cryptography  Concepts of encryption  Symmetric (secret key) Encryption (DES & AES)(DES & AES)  Asymmetric (public key) Encryption (RSA)(RSA)
Part 9, Basic Cryptography 1. Introduction A cryptosystem is a tuple: ( M,K,C, E,D) where M is the set of plaintexts K the set of keys C the set of ciphertexts.
CSCE 815 Network Security Lecture 8 SHA Operation and Kerberos.
September 10, 2009Introduction to Computer Security ©2004 Matt Bishop Slide #8-1 Chapter 8: Basic Cryptography Classical Cryptography Public Key Cryptography.
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Modern Cryptography.
Cryptography 1 Crypto Cryptography 2 Crypto  Cryptology  The art and science of making and breaking “secret codes”  Cryptography  making “secret.
Lecture 23 Symmetric Encryption
1 ISA 562 Information Security Theory & Practice Public Key Cryptosystem Chapter 9 of Bishop ’ s Book.
1.1 Introduction to Cryptography. 1.2 Basic Cryptography Cryptography is a deep mathematical subject. Cryptographic protocols provide a cornerstone for.
1 Cryptography Troy Latchman Byungchil Kim. 2 Fundamentals We know that the medium we use to transmit data is insecure, e.g. can be sniffed. We know that.
Cryptography services Lecturer: Dr. Peter Soreanu Students: Raed Awad Ahmad Abdalhalim
Department of Computer Science Chapter 5 Introduction to Cryptography Semester 1.
IS 2150 / TEL 2810 Information Security and Privacy
Chapter 30 Cryptography Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Public Key Cryptography Diffie-Hellman, Discrete Log, RSA
PART VII Security.
Cryptography: Basics (2)
Presentation transcript:

IN2150/TEL2810: Introduction to Computer Security1 October 25, 2005 Introduction to Computer Security Lecture 7 Basic Cryptography & Network Security

IN2150/TEL2810: Introduction to Computer Security2 Secure Information Transmission (network security model) Trusted Third Party arbiter, distributer of secret information Opponent Secure Message Message Information channel SenderReceiver Secret Information Security related transformation Secret Information Message

IN2150/TEL2810: Introduction to Computer Security3 Security of Information Systems (Network access model) Gate Keeper Opponent - hackers - software Access Channel Internal Security Control Data Software Gatekeeper – firewall or equivalent, password-based login Internal Security Control – Access control, Logs, audits, virus scans etc.

IN2150/TEL2810: Introduction to Computer Security4 Issues in Network security Distribution of secret information to enable secure exchange of information is important Distribution of secret information to enable secure exchange of information is important Effect of communication protocols needs to be considered Effect of communication protocols needs to be considered Encryption (cryptography) if used cleverly and correctly, can provide several of the security services Encryption (cryptography) if used cleverly and correctly, can provide several of the security services Physical and logical placement of security mechanisms Physical and logical placement of security mechanisms Countermeasures need to be considered Countermeasures need to be considered

IN2150/TEL2810: Introduction to Computer Security5 Cryptology CRYPTOLOGY CRYPTOGRAPH Y Private Key (Secret Key) Block CipherStream Cipher Public Key Integer Factorization Discrete Logarithm CRYPTANALYSIS Encipher, encrypt Decipher, decrypt

IN2150/TEL2810: Introduction to Computer Security6 Elementary Number Theory Natural numbers N = {1,2,3,…} Natural numbers N = {1,2,3,…} Whole numbers W = {0,1,2,3, …} Whole numbers W = {0,1,2,3, …} Integers Z = {…,-2,-1,0,1,2,3, …} Integers Z = {…,-2,-1,0,1,2,3, …} Divisors Divisors  A number b is said to divide a if a = mb for some m where a,b,m  Z  We write this as b | a Read as “b divides a”

IN2150/TEL2810: Introduction to Computer Security7 Divisors Some common properties Some common properties  If a | 1, a = +1 or –1  If a|b and b|a then a = +b or –b  Any b  Z divides 0 if b  0  If b|g and b|h then b|(mg + nh) where b,m,n,g,h  Z Examples: Examples:  The positive divisors of 42 are 1,2,3,6,7,14,21,42  3|6 and 3|21 => 3|21m+6n for m,n  Z

IN2150/TEL2810: Introduction to Computer Security8 Prime Numbers An integer p is said to be a prime number if its only positive divisors are 1 and itself An integer p is said to be a prime number if its only positive divisors are 1 and itself  1, 3, 7, 11,.. Any integer can be expressed as a unique product of prime numbers raised to positive integral powers Any integer can be expressed as a unique product of prime numbers raised to positive integral powers Examples Examples  7569 = 3 x 3 x 29 x 29 = 3 2 x 29 2  5886 = 2 x 27 x 109 = 2 x 3 3 x 109  4900 = 7 2 x 5 2 x 2 2  100 = ?  250 = ? This process is called Prime Factorization This process is called Prime Factorization

IN2150/TEL2810: Introduction to Computer Security9 Greatest common divisor (GCD) Definition: Greatest Common Divisor Definition: Greatest Common Divisor  This is the largest divisor of both a and b Given two integers a and b, the positive integer c is called their GCD or greatest common divisor if and only if Given two integers a and b, the positive integer c is called their GCD or greatest common divisor if and only if  c | a and c | b  Any divisor of both a and b also divides c Notation: gcd(a, b) = c Notation: gcd(a, b) = c Example: gcd(49,63) = ? Example: gcd(49,63) = ?

IN2150/TEL2810: Introduction to Computer Security10 Relatively Prime Numbers Two numbers are said to be relatively prime if their gcd is 1 Two numbers are said to be relatively prime if their gcd is 1  Example: 63 and 22 are relatively prime How do you determine if two numbers are relatively prime? How do you determine if two numbers are relatively prime?  Find their GCD or  Find their prime factors If they do not have a common prime factor other than 1, they are relatively prime  Example: 63 = 9 x 7 = 3 2 x 7 and 22 = 11 x 2

IN2150/TEL2810: Introduction to Computer Security11 The modulo operation What is 27 mod 5? What is 27 mod 5? Definition Definition  Let a, r, m be integers and let m > 0  We write a  r mod m if m divides r – a (or a – r) and 0  r < m  m is called the modulus  r is called the remainder Note that r is positive or zero  Note that a = m.q + r where q is another integer (quotient) Example: 42  6 mod 9 Example: 42  6 mod 9  9 divides 42-6 = 36  9 also divides 6-42 = -36  Note that 42 = (q = 4)

IN2150/TEL2810: Introduction to Computer Security12 Modular Arithmetic We say that a  b mod m if m | a – b We say that a  b mod m if m | a – b  Read as: a is congruent to b modulo m  m is called the modulus  Example: 27  2 mod 5 Note that b is the remainder after dividing a by m BUT Note that b is the remainder after dividing a by m BUT  Example: 27  7 mod 5 and 7  2 mod 5 a  b mod m => b  a mod m a  b mod m => b  a mod m  Example: 2  27 mod 5 We usually consider the smallest positive remainder which is sometimes called the residue We usually consider the smallest positive remainder which is sometimes called the residue

IN2150/TEL2810: Introduction to Computer Security13 Modulo Operation The modulo operation “reduces” the infinite set of integers to a finite set The modulo operation “reduces” the infinite set of integers to a finite set Example: modulo 5 operation Example: modulo 5 operation  We have five sets {…,-10, -5, 0, 5, 10, …} => a  0 mod 5 {…,-9,-4,1,6,11,…} => a  1 mod 5 {…,-8,-3,2,7,12,…} => a  2 mod 5, etc.  The set of residues of integers modulo 5 has five elements {0,1,2,3,4} and is denoted Z 5.

IN2150/TEL2810: Introduction to Computer Security14 Brief History All encryption algorithms from BC till 1976 were secret key algorithms All encryption algorithms from BC till 1976 were secret key algorithms  Also called private key algorithms or symmetric key algorithms  Julius Caesar used a substitution cipher  Widespread use in World War II (enigma) Public key algorithms were introduced in 1976 by Whitfield Diffie and Martin Hellman Public key algorithms were introduced in 1976 by Whitfield Diffie and Martin Hellman

IN2150/TEL2810: Introduction to Computer Security15 Cryptosystem ( E, D, M, K, C ) ( E, D, M, K, C )  E set of encryption functions e: M  K  C  D set of decryption functions d: C  K  M  M set of plaintexts  K set of keys  C set of ciphertexts

IN2150/TEL2810: Introduction to Computer Security16 Example Example: Cæsar cipher Example: Cæsar cipher  M = { sequences of letters }  K = { i | i is an integer and 0 ≤ i ≤ 25 }  E = { E k | k  K and for all letters m, E k (m) = (m + k) mod 26 }  D = { D k | k  K and for all letters c, D k (c) = (26 + c – k) mod 26 }  C = M

IN2150/TEL2810: Introduction to Computer Security17 Cæsar cipher ABCDEFGHIJKLM NOPQRSTUVWXYZ Let k = 9, m = “VELVET” ( ) Let k = 9, m = “VELVET” ( )  E k (m) = ( ) mod 26 =“ ” = “ENUENC”  D k (m) = (26 + c – k) mod 26 = ( ) mod 26 = “ ” = “VELVET”

IN2150/TEL2810: Introduction to Computer Security18 Attacks Ciphertext only: Ciphertext only:  adversary has only Y;  goal is to find plaintext, possibly key Known plaintext: Known plaintext:  adversary has X, Y;  goal is to find K Chosen plaintext: Chosen plaintext:  adversary gets a specific plaintext enciphered;  goal is to find key

IN2150/TEL2810: Introduction to Computer Security19 Attacking a conventional cryptosystem Cryptoanalysis: Cryptoanalysis:  Art/Science of breaking an encryption scheme  Exploits the characteristics of algorithm/ mathematics Recover plaintext from the ciphertext Recover a key that can be used to break many ciphertexts Brute force Brute force  Tries all possible keys on a piece of ciphertext If the number of keys is small, Ed can break the encryption easily

IN2150/TEL2810: Introduction to Computer Security20 Basis for Cyptoanalysis Mathematical attacks Mathematical attacks  Based on analysis of underlying mathematics Statistical attacks Statistical attacks  Make assumptions about the distribution of letters, pairs of letters (digrams), triplets of letters (trigrams), etc. (called models of the language).  Examine ciphertext, correlate properties with the assumptions.

IN2150/TEL2810: Introduction to Computer Security21 Classical Cryptography Key Source Oscar Encrypt ( algorithm ) Decrypt (algorithm) AliceBob Secret key K Secure Channel Plaintext X Ciphertext Y Plaintext X Ed (Cryptoanalyst) X’, K’

IN2150/TEL2810: Introduction to Computer Security22 Classical Cryptography Sender, receiver share common key Sender, receiver share common key  Keys may be the same, or trivial to derive from one another  Sometimes called symmetric cryptography Two basic types Two basic types  Transposition ciphers  Substitution ciphers Product ciphers Product ciphers  Combinations of the two basic types

IN2150/TEL2810: Introduction to Computer Security23 Classical Cryptography y = E k (x) : Ciphertext  Encryption x = D k (y) : Plaintext  Decryption k = encryption and decryption key The functions E k () and D k () must be inverses of one another  E k (D k (y)) = ?  D k (E k (x)) = ?  E k (D k (x)) = ?

IN2150/TEL2810: Introduction to Computer Security24 Transposition Cipher Rearrange letters in plaintext to produce ciphertext Rearrange letters in plaintext to produce ciphertext Example (Rail-Fence Cipher) Example (Rail-Fence Cipher)  Plaintext is “ HELLO WORLD ”  Rearrange as HLOOL ELWRD  Ciphertext is HLOOL ELWRD

IN2150/TEL2810: Introduction to Computer Security25 Attacking the Cipher Anagramming Anagramming  If 1-gram frequencies match English frequencies, but other n-gram frequencies do not, probably transposition  Rearrange letters to form n-grams with highest frequencies

IN2150/TEL2810: Introduction to Computer Security26 Example Ciphertext: HLOOLELWRD Ciphertext: HLOOLELWRD Frequencies of 2-grams beginning with H Frequencies of 2-grams beginning with H  HE  HO  HL, HW, HR, HD < Frequencies of 2-grams ending in H Frequencies of 2-grams ending in H  WH  EH, LH, OH, RH, DH ≤ Implies E follows H Implies E follows H

IN2150/TEL2810: Introduction to Computer Security27 Example Arrange so that H and E are adjacent Arrange so that H and E are adjacent HE LL OW OR LD Read off across, then down, to get original plaintext Read off across, then down, to get original plaintext

IN2150/TEL2810: Introduction to Computer Security28 Substitution Ciphers Change characters in plaintext to produce ciphertext Change characters in plaintext to produce ciphertext Example (Cæsar cipher) Example (Cæsar cipher)  Plaintext is HELLO WORLD ;  Key is 3, usually written as letter ‘D’  Ciphertext is KHOOR ZRUOG

IN2150/TEL2810: Introduction to Computer Security29 Attacking the Cipher Brute Force: Exhaustive search Brute Force: 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 Statistical analysis Statistical analysis  Compare to 1-gram model of English

IN2150/TEL2810: Introduction to Computer Security30 Statistical Attack Ciphertext is KHOOR ZRUOG Ciphertext is KHOOR ZRUOG Compute frequency of each letter in ciphertext: Compute frequency of each letter in ciphertext: G0.1H0.1K0.1O0.3 R0.2U0.1Z0.1 Apply 1-gram model of English Apply 1-gram model of English  Frequency of characters (1-grams) in English is on next slide

IN2150/TEL2810: Introduction to Computer Security31 Character Frequencies (Denning) a0.080h0.060n0.070t0.090 b0.015i0.065o0.080u0.030 c0.030j0.005p0.020v0.010 d0.040k0.005q0.002w0.015 e0.130l0.035r0.065x0.005 f0.020m0.030s0.060y0.020 g0.015z0.002

IN2150/TEL2810: Introduction to Computer Security32 Statistical Analysis f(c) frequency of character c in ciphertext f(c) frequency of character c in ciphertext  (i):  (i):  correlation of frequency of letters in ciphertext with corresponding letters in English, assuming key is i   (i) =  0 ≤ c ≤ 25 f(c)p(c – i)  so here,  (i) = 0.1p(6 – i) + 0.1p(7 – i) + 0.1p(10 – i) + 0.3p(14 – i) + 0.2p(17 – i) + 0.1p(20 – i) + 0.1p(25 – i) p(x) is frequency of character x in English  Look for maximum correlation!

IN2150/TEL2810: Introduction to Computer Security33 Correlation:  (i) for 0 ≤ i ≤ 25 i (i)(i)(i)(i)i (i)(i)(i)(i)i (i)(i)(i)(i)i (i)(i)(i)(i)

IN2150/TEL2810: Introduction to Computer Security34 The Result Ciphertext is KHOOR ZRUOG Ciphertext is KHOOR ZRUOG Most probable keys, based on  : Most probable keys, based on  :  i = 6,  (i) = plaintext EBIIL TLOLA (K = 10, ( ) mod 26 = 4 = E)  i = 10,  (i) = plaintext AXEEH PHKEW (K = 10, ( ) mod 26 = 0 = A)  i = 3,  (i) = plaintext HELLO WORLD (K = 10, ( ) mod 26 = H = E)  i = 14,  (i) = plaintext WTAAD LDGAS Only English phrase is for i = 3 Only English phrase is for i = 3  That’s the key (3 or ‘D’)

IN2150/TEL2810: Introduction to Computer Security35 Cæsar’s Problem Key is too short Key is too short  Can be found by exhaustive search  Statistical frequencies not concealed well They look too much like regular English letters So make it longer So make it longer  Multiple letters in key  Idea is to smooth the statistical frequencies to make cryptanalysis harder

IN2150/TEL2810: Introduction to Computer Security36 Vigenère Cipher Like Cæsar cipher, but use a phrase Like Cæsar cipher, but use a phrase Example Example  Message THE BOY HAS THE BALL  Key VIG  Encipher using Cæsar cipher for each letter: key VIGVIGVIGVIGVIGV plain THEBOYHASTHEBALL cipher OPKWWECIYOPKWIRG

IN2150/TEL2810: Introduction to Computer Security37 Relevant Parts of Tableau G I V G I V A G I V B H J W E K 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 with relevant rows, columns only Tableau with relevant rows, columns only Example encipherments: 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”)

IN2150/TEL2810: Introduction to Computer Security38 Useful Terms period: length of key period: length of key  In earlier example, period is 3 tableau: table used to encipher and decipher tableau: table used to encipher and decipher  Vigènere cipher has key letters on top, plaintext letters on the left polyalphabetic: the key has several different letters polyalphabetic: the key has several different letters  Cæsar cipher is monoalphabetic

IN2150/TEL2810: Introduction to Computer Security39 Attacking the Cipher Key to attacking vigenère cipher Key to attacking vigenère cipher  determine the key length  If the keyword is n, then the cipher consists of n monoalphabetic substitution ciphers key VIGVIGVIGVIGVIGV plain THEBOYHASTHEBALL cipher OPKWWECIYOPKWIRG key DECEPTIVEDECEPTIVEDECEPTIVE plain WEAREDISCOVEREDSAVEYOURSELF cipher ZICVTWQNGRZGVTWAVZHCQYGLMGJ

IN2150/TEL2810: Introduction to Computer Security40 One-Time Pad A Vigenère cipher with a random key at least as long as the message A Vigenère cipher with a random key at least as long as the message  Provably unbreakable; Why?  Consider ciphertext DXQR. Equally likely to correspond to plaintext DOIT (key AJIY) and plaintext DONT (key AJDY) and any other 4 letters  Warning: keys must be random, or you can attack the cipher by trying to regenerate the key Approximations, such as using pseudorandom number generators to generate keys, are not random

IN2150/TEL2810: Introduction to Computer Security41 Overview of the DES A block cipher: A block cipher:  encrypts blocks of 64 bits using a 64 bit key  outputs 64 bits of ciphertext  A product cipher performs both substitution and transposition (permutation) on the bits  basic unit is the bit Cipher consists of 16 rounds (iterations) each with a round key generated from the user- supplied key Cipher consists of 16 rounds (iterations) each with a round key generated from the user- supplied key

IN2150/TEL2810: Introduction to Computer Security42 DES Round keys are 48 bits each Round keys are 48 bits each  Extracted from 64 bits  Permutation applied Deciphering involves using round keys in reverse Deciphering involves using round keys in reverse

IN2150/TEL2810: Introduction to Computer Security43 Encipherment 32bits

IN2150/TEL2810: Introduction to Computer Security44 The f Function R i (32 bits) Expansion R i (48 bits) K i  S1S2S3S4S5S6 S7 S8 6 bits into each Permutation 32 bits 4 bits out of each

IN2150/TEL2810: Introduction to Computer Security45 Controversy Considered too weak Considered too weak  Diffie, Hellman said in a few years technology would allow DES to be broken in days Design using 1999 technology published  Design decisions not public S-boxes may have backdoors

IN2150/TEL2810: Introduction to Computer Security46 Undesirable Properties 4 weak keys 4 weak keys  They are their own inverses 12 semi-weak keys 12 semi-weak keys  Each has another semi-weak key as inverse Complementation property Complementation property  DES k (m) = c  DES k´ (m´) = c´ S-boxes exhibit irregular properties S-boxes exhibit irregular properties  Distribution of odd, even numbers non-random  Outputs of fourth box depends on input to third box

IN2150/TEL2810: Introduction to Computer Security47 DES Modes Electronic Code Book Mode (ECB): Electronic Code Book Mode (ECB):  Encipher each block independently Cipher Block Chaining Mode (CBC) Cipher Block Chaining Mode (CBC)  XOR each block with previous ciphertext block  Uses an initialization vector for the first one  init. vector m1m1 DES c1c1  m2m2 c2c2 sent … … …

IN2150/TEL2810: Introduction to Computer Security48 CBC Mode Decryption  init. vector c1c1 DES m1m1 … … …  c2c2 m2m2 CBC has self healing property CBC has self healing property  If one block of ciphertext is altered, the error propagates for at most two blocks

IN2150/TEL2810: Introduction to Computer Security49 Self-Healing Property Initial message Initial message  Received as (underlined 4c should be 4b) Received as (underlined 4c should be 4b)  ef7c4cb2b4ce6f3b f6266e3a97af0e2c 746ab9a6308f e60b451b09603d Which decrypts to Which decrypts to  efca61e19f4836f  Incorrect bytes underlined; plaintext “heals” after 2 blocks

IN2150/TEL2810: Introduction to Computer Security50 Current Status of DES Design for computer system, associated software that could break any DES-enciphered message in a few days published in 1998 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 Several challenges to break DES messages solved using distributed computing NIST selected Rijndael as Advanced Encryption Standard, successor to DES NIST selected Rijndael as Advanced Encryption Standard, successor to DES  Designed to withstand attacks that were successful on DES

IN2150/TEL2810: Introduction to Computer Security51 Public Key Cryptography Two keys Two keys  Private key known only to individual  Public key available to anyone Idea Idea  Confidentiality: encipher using public key, decipher using private key  Integrity/authentication: encipher using private key, decipher using public one

IN2150/TEL2810: Introduction to Computer Security52 Requirements 1.Given the appropriate key, it must be computationally easy to encipher or decipher a message 2.It must be computationally infeasible to derive the private key from the public key 3.It must be computationally infeasible to determine the private key from a chosen plaintext attack

IN2150/TEL2810: Introduction to Computer Security53 Diffie-Hellman Compute a common, shared key Compute a common, shared key  Called a symmetric key exchange protocol Based on discrete logarithm problem Based on discrete logarithm problem  Given integers n and g and prime number p, compute k such that n = g k mod p  Solutions known for small p  Solutions computationally infeasible as p grows large – hence, choose large p

IN2150/TEL2810: Introduction to Computer Security54 Algorithm Constants known to participants Constants known to participants  prime p; integer g other than 0, 1 or p–1 Alice: (private = k A, public = K A ) Alice: (private = k A, public = K A ) Bob: (private = k B, public = K B ) Bob: (private = k B, public = K B )  K A = g kA mod p  K B = g kB mod p To communicate with Bob, To communicate with Bob,  Alice computes S A, B = K B kA mod p To communicate with Alice, To communicate with Alice,  Bob computes S B, A = K A kB mod p S A, B = S B, A ? S A, B = S B, A ?

IN2150/TEL2810: Introduction to Computer Security55 Example Assume p = 53 and g = 17 Assume p = 53 and g = 17 Alice chooses k A = 5 Alice chooses k A = 5  Then K A = 17 5 mod 53 = 40 Bob chooses k B = 7 Bob chooses k B = 7  Then K B = 17 7 mod 53 = 6 Shared key: Shared key:  K B kA mod p = 6 5 mod 53 = 38  K A kB mod p = 40 7 mod 53 = 38 Let p = 5, g = 3 k A k B k A = 4, k B = 3 K A K B K A = ?, K B = ?, S = ?,

IN2150/TEL2810: Introduction to Computer Security56 RSA Relies on the difficulty of determining the number of numbers relatively prime to a large integer n Relies on the difficulty of determining the number of numbers relatively prime to a large integer n Totient function  (n) Totient function  (n)  Number of + integers less than n and relatively prime to n Relatively prime means with no factors in common with n Example:  (10) = 4 Example:  (10) = 4  1, 3, 7, 9 are relatively prime to 10  (77) ?  (77) ?  (p) ?  (p) ?  When p is a prime number  (pq) ?  (pq) ?  When p and q are prime numbers

IN2150/TEL2810: Introduction to Computer Security57 Algorithm Choose two large prime numbers p, q Choose two large prime numbers p, q  Let n = pq; then  (n) = (p–1)(q–1)  Choose e < n relatively prime to  (n).  Compute d such that ed mod  (n) = 1 Public key: (e, n); private key: d (or (d, n)) Public key: (e, n); private key: d (or (d, n)) Encipher: c = m e mod n Encipher: c = m e mod n Decipher: m = c d mod n Decipher: m = c d mod n

IN2150/TEL2810: Introduction to Computer Security58 Confidentiality using RSA Message Source Encryption Message Source Decryption X YX Alice Key Source KBKBKBKB kBkBkBkB Bob

IN2150/TEL2810: Introduction to Computer Security59 Example: Confidentiality Take p = 7, q = 11, so n = 77 and  (n) = 60 Take p = 7, q = 11, so n = 77 and  (n) = 60 Say Bob chooses ( K B ) e = 17, making ( k B ) d = 53 Say Bob chooses ( K B ) e = 17, making ( k B ) d = 53  17 x 53 mod 60 = ? Alice wants to send Bob secret message HELLO [ ] Alice wants to send Bob secret message HELLO [ ]  mod 77 = 28  mod 77 = 16  mod 77 = 44  mod 77 = 42 Alice sends ciphertext [ ] Alice sends ciphertext [ ]

IN2150/TEL2810: Introduction to Computer Security60 Example Bob receives [ ] Bob receives [ ] Bob uses private key ( k B ), d = 53, to decrypt the message: Bob uses private key ( k B ), d = 53, to decrypt the message:  mod 77 = 07H  mod 77 = 04E  mod 77 = 11L  mod 77 = 14O No one else could read it, as only Bob knows his private key and that is needed for decryption No one else could read it, as only Bob knows his private key and that is needed for decryption

IN2150/TEL2810: Introduction to Computer Security61 Authentication using RSA Message Source Encryption Message Source Decryption X YX Key Source Alice kAkAkAkA KAKAKAKA Bob

IN2150/TEL2810: Introduction to Computer Security62 Example: Origin Integrity/Authentication Take p = 7, q = 11, so n = 77 and  (n) = 60 Take p = 7, q = 11, so n = 77 and  (n) = 60 Alice chooses ( K A ) e = 17, making ( k A ) d = 53 Alice chooses ( K A ) e = 17, making ( k A ) d = 53 Alice wants to send Bob message HELLO [ ] so Bob knows it is what Alice sent and there was no changes in transit Alice wants to send Bob message HELLO [ ] so Bob knows it is what Alice sent and there was no changes in transit  mod 77 = 35  mod 77 = 09  mod 77 = 44  mod 77 = 49 Alice sends [ ] Alice sends [ ]

IN2150/TEL2810: Introduction to Computer Security63 Example Bob receives Bob receives Bob uses Alice’s public key (KA), e = 17, n = 77, to decrypt message: Bob uses Alice’s public key (KA), e = 17, n = 77, to decrypt message:  mod 77 = 07H  mod 77 = 04E  mod 77 = 11L  mod 77 = 14O Alice sent it as only she knows her private key, so no one else could have enciphered it Alice sent it as only she knows her private key, so no one else could have enciphered it If (enciphered) message’s blocks (letters) altered in transit, would not decrypt properly If (enciphered) message’s blocks (letters) altered in transit, would not decrypt properly

IN2150/TEL2810: Introduction to Computer Security64 Confidentiality + Authentication Message Source Encryption Message Source Decryption X Key Source Alice kAkAkAkA KAKAKAKA Bob Decryption YX Encryption Y KBKBKBKB kBkBkBkB Key Source Z

IN2150/TEL2810: Introduction to Computer Security65 Example: Confidentiality + Authentication Alice wants to send Bob message HELLO both enciphered and authenticated (integrity-checked) Alice wants to send Bob message HELLO both enciphered and authenticated (integrity-checked)  Alice’s keys: public (17, 77); private: 53  Bob’s keys: public: (37, 77); private: 13 Alice enciphers HELLO [ ]: Alice enciphers HELLO [ ]:  (07 53 mod 77) 37 mod 77 = 07  (04 53 mod 77) 37 mod 77 = 37  (11 53 mod 77) 37 mod 77 = 44  (14 53 mod 77) 37 mod 77 = 14 Alice sends [ ] Alice sends [ ]

IN2150/TEL2810: Introduction to Computer Security66 Example: Confidentiality + Authentication  Alice’s keys: public (17, 77); private: 53  Bob’s keys: public: (37, 77); private: 13 Bob deciphers ( ): Bob deciphers ( ):  (07 13 mod 77) 17 mod 77 = 07H  (37 13 mod 77) 17 mod 77 = 04E  (44 13 mod 77) 17 mod 77 = 11L  (14 13 mod 77) 17 mod 77 = 14O

IN2150/TEL2810: Introduction to Computer Security67 Security Services Confidentiality Confidentiality  Only the owner of the private key knows it, so text enciphered with public key cannot be read by anyone except the owner of the private key Authentication Authentication  Only the owner of the private key knows it, so text enciphered with private key must have been generated by the owner

IN2150/TEL2810: Introduction to Computer Security68 More Security Services Integrity Integrity  Enciphered letters cannot be changed undetectably without knowing private key Non-Repudiation Non-Repudiation  Message enciphered with private key came from someone who knew it

IN2150/TEL2810: Introduction to Computer Security69 Warnings Encipher message in blocks considerably larger than the examples here Encipher message in blocks considerably larger than the examples here  If 1 character per block, RSA can be broken using statistical attacks (just like classical cryptosystems)  Attacker cannot alter letters, but can rearrange them and alter message meaning Example: reverse enciphered message of text ON to get NO

IN2150/TEL2810: Introduction to Computer Security70 Cryptographic Checksums Mathematical function to generate a set of k bits from a set of n bits (where k ≤ n). Mathematical function to generate a set of k bits from a set of n bits (where k ≤ n).  k is smaller then n except in unusual circumstances  Keyed CC: requires a cryptographic key h = C K (M)  Keyless CC: requires no cryptographic key Message Digest or One-way Hash Functions h = H(M) Can be used for message authentication Can be used for message authentication  Hence, also called Message Authentication Code (MAC)

IN2150/TEL2810: Introduction to Computer Security71 Mathematical characteristics Every bit of the message digest function potentially influenced by every bit of the function’s input Every bit of the message digest function potentially influenced by every bit of the function’s input If any given bit of the function’s input is changed, every output bit has a 50 percent chance of changing If any given bit of the function’s input is changed, every output bit has a 50 percent chance of changing Given an input file and its corresponding message digest, it should be computationally infeasible to find another file with the same message digest value Given an input file and its corresponding message digest, it should be computationally infeasible to find another file with the same message digest value

IN2150/TEL2810: Introduction to Computer Security72 Definition Cryptographic checksum function h: A  B: Cryptographic checksum function h: A  B: 1.For any x  A, h(x) is easy to compute – Makes hardware/software implementation easy 2.For any y  B, it is computationally infeasible to find x  A such that h(x) = y – One-way property 3.It is computationally infeasible to find x, x´  A such that x ≠ x´ and h(x) = h(x´) 4. Alternate form: Given any x  A, it is computationally infeasible to find a different x ´  A such that h ( x ) = h ( x ´).

IN2150/TEL2810: Introduction to Computer Security73 Collisions If x ≠ x´ and h(x) = h(x´), x and x´ are a collision If x ≠ x´ and h(x) = h(x´), x and x´ are a collision  Pigeonhole principle: if there are n containers for n+1 objects, then at least one container will have 2 objects in it.  Application: suppose n = 5 and k = 3. Then there are 32 elements of A and 8 elements of B, so at least one element of B has at least 4 corresponding elements of A

IN2150/TEL2810: Introduction to Computer Security74 Keys Keyed cryptographic checksum: requires cryptographic key Keyed cryptographic checksum: requires cryptographic key  DES in chaining mode: encipher message, use last n bits. Requires a key to encipher, so it is a keyed cryptographic checksum. Keyless cryptographic checksum: requires no cryptographic key Keyless cryptographic checksum: requires no cryptographic key  MD5 and SHA-1 are best known; others include MD4, HAVAL, and Snefru

IN2150/TEL2810: Introduction to Computer Security75 Message Digest MD2, MD4, MD5 (Ronald Rivest) MD2, MD4, MD5 (Ronald Rivest)  Produces 128-bit digest;  MD2 is probably the most secure, longest to compute (hence rarely used)  MD4 is a fast alternative; MD5 is modification of MD4 SHA, SHA-1 (Secure Hash Algorithm) SHA, SHA-1 (Secure Hash Algorithm)  Related to MD4; used by NIST’s Digital Signature  Produces 160-bit digest  SHA-1 may be better SHA-256, SHA-384, SHA-512 SHA-256, SHA-384, SHA-512  256-, 384-, 512 hash functions designed to be use with the Advanced Encryption Standards (AES) Example: Example:  MD5(There is $1500 in the blue bo) = f80b3fde8ecbac1b515960b9058de7a1  MD5(There is $1500 in the blue box) = a4a5471a0e019a4a502134d38fb64729

IN2150/TEL2810: Introduction to Computer Security76 Hash Message Authentication Code (HMAC) Make keyed cryptographic checksums from keyless cryptographic checksums Make keyed cryptographic checksums from keyless cryptographic checksums h keyless cryptographic checksum function that takes data in blocks of b bytes and outputs blocks of l bytes. k´ is cryptographic key of length b bytes (from k) h keyless cryptographic checksum function that takes data in blocks of b bytes and outputs blocks of l bytes. k´ is cryptographic key of length b bytes (from k)  If short, pad with 0 bytes; if long, hash to length b ipad is repeated b/8 times ipad is repeated b/8 times opad is repeated b/8 times opad is repeated b/8 times HMAC-h(k, m) = h(k´  opad || h(k´  ipad || m)) HMAC-h(k, m) = h(k´  opad || h(k´  ipad || m))   exclusive or, || concatenation

IN2150/TEL2810: Introduction to Computer Security77 Security Levels Unconditionally Secure Unconditionally Secure  Unlimited resources + unlimited time  Still the plaintext CANNOT be recovered from the ciphertext Computationally Secure Computationally Secure  Cost of breaking a ciphertext exceeds the value of the hidden information  The time taken to break the ciphertext exceeds the useful lifetime of the information

IN2150/TEL2810: Introduction to Computer Security78 Average time required for exhaustive key search Key Size (bits) Number of Alternative Keys Time required at 10 6 Decryption/µs = 4.3 x milliseconds = 7.2 x hours = 3.4 x x years = 3.7 x x years

IN2150/TEL2810: Introduction to Computer Security79 Key Points Two main types of cryptosystems: classical and public key Two main types of cryptosystems: classical and public key Classical cryptosystems encipher and decipher using the same key Classical cryptosystems encipher and decipher using the same key  Or one key is easily derived from the other Public key cryptosystems encipher and decipher using different keys Public key cryptosystems encipher and decipher using different keys  Computationally infeasible to derive one from the other