CSCE 815 Network Security Lecture 7 Message Authentication Codes And Hash Functions.

Slides:



Advertisements
Similar presentations
Cryptography and Network Security
Advertisements

Chapter 8 – Introduction to Number Theory. Prime Numbers prime numbers only have divisors of 1 and self –they cannot be written as a product of other.
Cryptography and Network Security Chapter 12 Fourth Edition by William Stallings Lecture slides by Lawrie Brown.
First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown and edited by Archana Chidanandan Cryptographic Tools.
Hash functions a hash function produces a fingerprint of some file/message/data h = H(M)  condenses a variable-length message M  to a fixed-sized fingerprint.
Cryptography and Network Security Chapter 12
Cryptography and Network Security Hash Algorithms.
Cryptography and Network Security (CS435) Part Ten (Hash and MAC algorithms)
Information Security and Management 11
Henric Johnson1 Chapter3 Public-Key Cryptography and Message Authentication Henric Johnson Blekinge Institute of Technology, Sweden
Cryptography and Network Security Chapter 11. Chapter 11 – Message Authentication and Hash Functions At cats' green on the Sunday he took the message.
Cryptography and Network Security Chapter 11 Fourth Edition by William Stallings.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Cryptography and Network Security Chapter 12 Fourth Edition by William Stallings Lecture slides by Lawrie Brown.
Chapter 8 – Introduction to Number Theory Prime Numbers  prime numbers only have divisors of 1 and self they cannot be written as a product of other numbers.
1 Pertemuan 09 Hash and Message Digest Matakuliah: H0242 / Keamanan Jaringan Tahun: 2006 Versi: 1.
CSCE 790: Computer Network Security Chin-Tser Huang University of South Carolina.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Cryptography and Network Security Chapter 11 Fourth Edition by William Stallings Lecture slides by Lawrie Brown/Mod. & S. Kondakci.
Chapter 8 – Introduction to Number Theory Prime Numbers
Cryptography and Network Security Chapter 8. Chapter 8 – Introduction to Number Theory The Devil said to Daniel Webster: "Set me a task I can't carry.
Chapter 8 – Introduction to Number Theory Prime Numbers  prime numbers only have divisors of 1 and self they cannot be written as a product of other numbers.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Cryptography1 CPSC 3730 Cryptography Chapter 11, 12 Message Authentication and Hash Functions.
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
1 Cryptography and Network Security (Various Hash Algorithms) Fourth Edition by William Stallings Lecture slides by Lawrie Brown (Changed by Somesh Jha)
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Lecture 2: Message Authentication Anish Arora CSE5473 Introduction to Network Security.
1 Public-Key Cryptography and Message Authentication Ola Flygt Växjö University, Sweden
Acknowledgements: William Stallings.William Stallings All rights Reserved Session 4 Public Key Cryptography (Part 2) Network Security Essentials Application.
Prime Numbers Prime numbers only have divisors of 1 and self

Message Authentication  message authentication is concerned with: protecting the integrity of a message protecting the integrity of a message validating.
Information Security Principles Assistant Professor Dr. Sana’a Wafa Al-Sayegh 1 st Semester ITGD 2202 University of Palestine.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
1 Chapter 11: Message Authentication and Hash Functions Fourth Edition by William Stallings Lecture slides by Lawrie Brown (modified by Prof. M. Singhal,
Hash and MAC Algorithms Dr. Monther Aldwairi New York Institute of Technology- Amman Campus 12/3/2009 INCS 741: Cryptography 12/3/20091Dr. Monther Aldwairi.
1 Public-Key Cryptography and Message AuthenticationPublic-Key Cryptography and Message Authentication Henric Johnson Blekinge Institute of Technology,
Message Authentication Code July Message Authentication Problem  Message Authentication is concerned with:  protecting the integrity of a message.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
Fall 2002CS 395: Computer Security1 Chapter 11: Message Authentication and Hash Functions.
Hash and MAC Functions CS427 – Computer Security
Computer Security: Principles and Practice First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown Chapter 2 – Cryptographic.
11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 11 Message Integrity and Message Authentication.
CSCE 815 Network Security Lecture 8 SHA Operation and Kerberos.
Chapter 4 Message Authentication MSc. NGUYEN CAO DAT Dr. TRAN VAN HOAI 1.
Hash Algorithms see similarities in the evolution of hash functions & block ciphers –increasing power of brute-force attacks –leading to evolution in algorithms.
Chapter 11 Message Authentication and Hash Functions.
Cryptography and Network Security Chapter 12 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Message Authentication and Hash Functions K. U. Khimani Asst. Prof. IT Dept. VVP Engineering College.
Authentication. Goal: Bob wants Alice to “prove” her identity to him Protocol ap1.0: Alice says “I am Alice” Failure scenario?? “I am Alice”
Cryptography and Network Security (CS435) Part Nine (Message Authentication)
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
IT 221: Introduction to Information Security Principles Lecture 5: Message Authentications, Hash Functions and Hash/Mac Algorithms For Educational Purposes.
Hash Algorithms Ch 12 of Cryptography and Network Security - Third Edition by William Stallings Modified from lecture slides by Lawrie Brown CIM3681 :
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Information and Network Security Dr. Hadi AL Saadi Message Authentication and Hash Functions.
Chapter 12 – Hash Algorithms
Message Authentication and Hash Functions
CSCE 715: Network Systems Security
CSCE 715: Network Systems Security
Introduction to Number Theory
Cryptography and Network Security
Chapter 11 – Message Authentication and Hash Functions
Presentation transcript:

CSCE 815 Network Security Lecture 7 Message Authentication Codes And Hash Functions

– 2 – CSCE 815 Sp 03 Resources Brown and Johnson Slides Big Integers C Java pec.html Benton’s RSA spreadsheet Class/csce /Handouts/rsa.xls

– 3 – CSCE 815 Sp 03 Review Lecture 1 – Overview Lecture 2 – Classical Cryptography Lecture 3 – DES Overview Lecture 4 – DES details (ref Brown) Lecture 5 – (AES) Rijndael overview, Message Authentication, MAC Lecture 6 – Public Key Encryption, RSA

– 4 – CSCE 815 Sp 03 Assignment 1 Due Feb 12 Decipher – Ciphertext1 (produced with MonoAlph) Ciphertext2 (produced with Perm; n < 10) Ciphertext3 (produced Perm(MonoAlph(P))) In doing this you should write a program that will enable you to do statistical analysis of the ciphertexts Then you may modify or use MonoAlph.c and perm.c to aid in decoding

– 5 – CSCE 815 Sp 03 Assignment 2 Due Feb 17 Page 83 problem 3.2 Page 83 problem 3.5 Page 84 problem 3.7

– 6 – CSCE 815 Sp 03 Number Theory Review Lawrie Brown slides – Chapter 8 Primes – prime factorization Relatively Prime Numbers & GCD Fermat's Theorem: a p-1 mod p = 1 Euler Totient Function ø(n) Euler's Theorem: a ø(n) mod N = 1 Miller Rabin Algorithm: Primality Testing

– 7 – CSCE 815 Sp 03 Prime Numbers prime numbers only have divisors of 1 and self they cannot be written as a product of other numbers note: 1 is prime, but is generally not of interest eg. 2,3,5,7 are prime, 4,6,8,9,10 are not prime numbers are central to number theory list of prime number less than 200 is:

– 8 – CSCE 815 Sp 03 Prime Factorisation to factor a number n is to write it as a product of other numbers: n = a × b × c note that factoring a number is relatively hard compared to multiplying the factors together to generate the number the prime factorisation of a number n is when its written as a product of primes eg. 91=7×13 ; 3600=2 4 ×3 2 ×5 2

– 9 – CSCE 815 Sp 03 Relatively Prime Numbers & GCD two numbers a, b are relatively prime if have no common divisors apart from 1 eg. 8 & 15 are relatively prime since factors of 8 are 1,2,4,8 and of 15 are 1,3,5,15 and 1 is the only common factor conversely can determine the greatest common divisor by comparing their prime factorizations and using least powers eg. 300=2 1 ×3 1 ×5 2 18=2 1 ×3 2 hence GCD(18,300)=2 1 ×3 1 ×5 0 =6

– 10 – CSCE 815 Sp 03 Fermat's Theorem a p-1 mod p = 1 where p is prime and gcd(a,p)=1 also known as Fermat’s Little Theorem useful in public key and primality testing

– 11 – CSCE 815 Sp 03 Euler Totient Function ø(n) when doing arithmetic modulo n complete set of residues is: 0..n-1 reduced set of residues is those numbers (residues) which are relatively prime to n eg for n=10, complete set of residues is {0,1,2,3,4,5,6,7,8,9} reduced set of residues is {1,3,7,9} number of elements in reduced set of residues is called the Euler Totient Function ø(n)

– 12 – CSCE 815 Sp 03 Euler Totient Function ø(n) to compute ø(n) need to count number of elements to be excluded in general need prime factorization, but for p (p prime) ø(p) = p-1 for p.q (p,q prime) ø(p.q) = (p-1)(q-1)eg. ø(37) = 36 ø(21) = (3–1)×(7–1) = 2×6 = 12

– 13 – CSCE 815 Sp 03 Euler's Theorem a generalisation of Fermat's Theorem a ø(n) mod N = 1 where gcd(a,N)=1eg. a=3;n=10; ø(10)=4; hence 3 4 = 81 = 1 mod 10 a=2;n=11; ø(11)=10; hence 2 10 = 1024 = 1 mod 11

– 14 – CSCE 815 Sp 03 Primality Testing often need to find large prime numbers traditionally sieve using trial division ie. divide by all numbers (primes) in turn less than the square root of the number only works for small numbers alternatively can use statistical primality tests based on properties of primes for which all primes numbers satisfy property but some composite numbers, called pseudo- primes, also satisfy the property

– 15 – CSCE 815 Sp 03 Miller Rabin Algorithm a test based on Fermat’s Theorem algorithm is: TEST (n) is: 1. Find integers k, q, k > 0, q odd, so that (n–1)=2 k q 2. Select a random integer a, 1<a<n–1 3. if a q mod n = 1 then return (“maybe prime"); 4. for j = 0 to k – 1 do 5. if ( a 2 j q mod n = n-1 ) then return(" maybe prime ") 6. return ("composite")

– 16 – CSCE 815 Sp 03 Probabilistic Considerations if Miller-Rabin returns “composite” the number is definitely not prime otherwise is a prime or a pseudo-prime chance it detects a pseudo-prime is < ¼ hence if repeat test with different random a then chance n is prime after t tests is: Pr(n prime after t tests) = 1-4 -t eg. for t=10 this probability is >

– 17 – CSCE 815 Sp 03 Message Authentication message authentication is concerned with: protecting the integrity of a message validating identity of originator non-repudiation of origin (dispute resolution) will consider the security requirements then three alternative functions used: message encryption message authentication code (MAC) hash function

– 18 – CSCE 815 Sp 03 Approaches to Message Authentication Authentication Using Conventional Encryption Only the sender and receiver should share a key Message Authentication without Message Encryption An authentication tag is generated and appended to each message Message Authentication Code Calculate the MAC as a function of the message and the key. MAC = F(K, M)

– 19 – CSCE 815 Sp 03 Message Authentication Code (MAC) generated by an algorithm that creates a small fixed- sized block depending on both message and some key like encryption though need not be reversible appended to message as a signature receiver performs same computation on message and checks it matches the MAC provides assurance that message is unaltered and comes from sender

– 20 – CSCE 815 Sp 03

– 21 – CSCE 815 Sp 03 Message Authentication Codes as shown the MAC provides confidentiality can also use encryption for secrecy generally use separate keys for each can compute MAC either before or after encryption is generally regarded as better done before why use a MAC? sometimes only authentication is needed sometimes need authentication to persist longer than the encryption (eg. archival use) note that a MAC is not a digital signature

– 22 – CSCE 815 Sp 03 MAC Properties a MAC is a cryptographic checksum MAC = C K (M) condenses a variable-length message M using a secret key K to a fixed-sized authenticator is a many-to-one function potentially many messages have same MAC but finding these needs to be very difficult

– 23 – CSCE 815 Sp 03 Requirements for MACs taking into account the types of attacks need the MAC to satisfy the following: 1. knowing a message and MAC, is infeasible to find another message with same MAC 2. MACs should be uniformly distributed 3. MAC should depend equally on all bits of the message

– 24 – CSCE 815 Sp 03 Using Symmetric Ciphers for MACs can use any block cipher chaining mode and use final block as a MAC Data Authentication Algorithm (DAA) is a widely used MAC based on DES-CBC using IV=0 and zero-pad of final block encrypt message using DES in CBC mode and send just the final block as the MAC or the leftmost M bits (16≤M≤64) of final block but final MAC is now too small for security

– 25 – CSCE 815 Sp 03 One Way Hash Functions Alternative to MAC As with MAC condenses arbitrary message to fixed size usually assume that the hash function is public and not keyed cf. MAC which is keyed hash used to detect changes to message can use in various ways with message most often to create a digital signature

– 26 – CSCE 815 Sp 03 One-way HASH function

– 27 – CSCE 815 Sp 03 One-way HASH function Secret value is added before the hash and removed before transmission.

– 28 – CSCE 815 Sp 03 Simple Hash Functions There are several proposals for simple functions Based on XOR of message blocks But predictability in data causes problems e.g., text which is ASCII has leading 0 not secure since can manipulate any message and either not change hash or change hash also need a stronger cryptographic function

– 29 – CSCE 815 Sp 03 Simple Hash Function One-bit circular shift on the hash value after each block is processed would improve

– 30 – CSCE 815 Sp 03 Secure HASH Functions Purpose of the HASH function is to produce a “fingerprint.” Properties of a HASH function H : 1. H can be applied to a block of data at any size 2. H produces a fixed length output 3. H(x) is easy to compute for any given x. 4. One way property - For any given block x, it is computationally infeasible to find x such that H(x) = h 5. Weak Collision Resistance Property - For any given block x, it is computationally infeasible to find with H(y) = H(x). 6. Strong Collision Resistance Property - It is computationally infeasible to find any pair (x, y) such that H(x) = H(y)

– 31 – CSCE 815 Sp 03 Secure Hash Algorithm (SHA-1) SHA was designed by NIST & NSA in 1993, revised 1995 as SHA-1 US standard for use with DSA signature scheme standard is FIPS , also Internet RFC3174 nb. the algorithm is SHA, the standard is SHS produces 160-bit hash values now the generally preferred hash algorithm based on design of MD4 with key differences

– 32 – CSCE 815 Sp 03 SHA Overview pad message so its length is 448 mod 512 append a 64-bit length value to message initialize 5-word (160-bit) buffer (A,B,C,D,E) to ( ,efcdab89,98badcfe, ,c3d2e1f0) process message in 16-word (512-bit) chunks: expand 16 words into 80 words by mixing & shifting use 4 rounds of 20 bit operations on message block & buffer add output to input to form new buffer value output hash value is the final buffer value

– 33 – CSCE 815 Sp 03 Message Digest Generation Using SHA-1

– 34 – CSCE 815 Sp 03 SHA-1 Processing of single 512-Bit Block

– 35 – CSCE 815 Sp 03 Other Secure HASH functions- table 3.1 SHA-1MD5RIPEMD-160 Digest length 160 bits 128 bits 160 bits Basic unit of processing 512 bits Number of steps 80 (4 rounds of 20) 64 (4 rounds of 16) 160 (5 paired rounds of 16) Maximum message size bits

– 36 – CSCE 815 Sp 03 HMAC Use a MAC derived from a cryptographic hash code, such as SHA-1. Motivations: Cryptographic hash functions executes faster in software than encryption algorithms such as DES Library code for cryptographic hash functions is widely available No export restrictions from the US

– 37 – CSCE 815 Sp 03 HMAC Design Objectives Proposal to include secret key in hash function RFC 2104 lists design objectives for HMAC  To use available hash functions  Allow easy replaceability of hash function  Maintain performance of original hash  Use and handle keys simply  Have well understood cryptographic analysis of strength of the authentication method

– 38 – CSCE 815 Sp 03 HMAC Structure

– 39 – CSCE 815 Sp 03 Other Public-Key Cryptographic Algorithms Digital Signature Standard (DSS) Makes use of the SHA-1 Not for encryption or key echange Elliptic-Curve Cryptography (ECC) Good for smaller bit size Low confidence level, compared with RSA Very complex

– 40 – CSCE 815 Sp 03 Birthday Attacks You might think a 64-bit hash is secure But by Birthday Paradox is not The Birthday attack works thus: opponent generates 2 m / 2 variations of a valid message all with essentially the same meaning opponent also generates 2 m / 2 variations of a desired fraudulent message two sets of messages are compared to find pair with same hash (probability > 0.5 by birthday paradox) have user sign the valid message, then substitute the forgery which will have a valid signature Conclusion is that need to use larger MACs

– 41 – CSCE 815 Sp 03 Other Secure Hash Functions MD5 Message Digest Algorithm RFC 1321 Ron Rivest 128 bit message digest with faster processors security has become questionable RIPEMD-160 Round European group produces 160 bit digest produces 160 bit digest processes text in 512 bit blocks

– 42 – CSCE 815 Sp 03 Summary have considered: message authentication using message encryption MACs hash functions some current hash algorithms: MD5, SHA-1, RIPEMD-160 HMAC authentication using hash function

– 43 – CSCE 815 Sp 03 SHA-1 Compression Function each round has 20 steps which replaces the 5 buffer words thus: (A,B,C,D,E) <-(E+f(t,B,C,D)+(A<<5)+W t +K t ),A,(B<<30),C,D) a,b,c,d refer to the 4 words of the buffer t is the step number f(t,B,C,D) is nonlinear function for round W t is derived from the message block K t is a constant value derived from sin

– 44 – CSCE 815 Sp 03 Keyed Hash Functions as MACs have desire to create a MAC using a hash function rather than a block cipher because hash functions are generally faster not limited by export controls unlike block ciphers hash includes a key along with the message original proposal: KeyedHash = Hash(Key|Message) some weaknesses were found with this eventually led to development of HMAC