Message Authentication Code

Slides:



Advertisements
Similar presentations
Sri Lanka Institute of Information Technology
Advertisements

Cryptography and Network Security Chapter 12 Fourth Edition by William Stallings Lecture slides by Lawrie Brown.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
Cryptography and Network Security Chapter 12
Cryptography and Network Security (CS435) Part Ten (Hash and MAC algorithms)
Cryptography and Network Security Chapter 12 Fourth Edition by William Stallings Lecture slides by Lawrie Brown.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Lecture 13 Message Signing
Cryptography and Network Security Chapter 11 Fourth Edition by William Stallings Lecture slides by Lawrie Brown/Mod. & S. Kondakci.
Cryptography1 CPSC 3730 Cryptography Chapter 11, 12 Message Authentication and Hash Functions.
1 Message Authentication and Hash Functions Authentication Requirements Authentication Functions Message Authentication Codes Hash Functions Security of.
CRYPTOGRAPHIC DATA INTEGRITY ALGORITHMS
Chapter 8.  Cryptography is the science of keeping information secure in terms of confidentiality and integrity.  Cryptography is also referred to as.
Cryptography and Network Security Chapter 12 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Lecture 2: Message Authentication Anish Arora CSE5473 Introduction to Network Security.
Acknowledgements: William Stallings.William Stallings All rights Reserved Session 4 Public Key Cryptography (Part 2) Network Security Essentials Application.
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.
Message Authentication Code July Message Authentication Problem  Message Authentication is concerned with:  protecting the integrity of a message.
Fall 2002CS 395: Computer Security1 Chapter 11: Message Authentication and Hash Functions.
Hash and MAC Functions CS427 – Computer Security
11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 11 Message Integrity and Message Authentication.
Chapter 4 Message Authentication MSc. NGUYEN CAO DAT Dr. TRAN VAN HOAI 1.
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.
Cryptography and Network Security (CS435) Part Nine (Message Authentication)
1 Chapter 12: Hash and MAC Algorithms Fourth Edition by William Stallings Lecture slides by Lawrie Brown (modified by Prof. M. Singhal, U of Kentucky)
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.
Message Authentication Codes CSCI 5857: Encoding and Encryption.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 13.Message Authentication.
Cryptographic Hash Function. A hash function H accepts a variable-length block of data as input and produces a fixed-size hash value h = H(M). The principal.
Understanding Cryptography by Christof Paar and Jan Pelzl These slides were prepared by Christof Paar and Jan Pelzl Chapter 12.
Message Authentication Code
Chapter 12 – Hash Algorithms
Message Authentication and Hash Functions
G. Pullaiah College of Engineering and Technology
Cryptography and Network Security Chapter 12
Cryptography and Network Security Chapter 11
Computer and Network Security
Cryptographic Hash Function
CSCE 715: Network Systems Security
Message Authentication and Hash Functions
Cryptography and Network Security Chapter 12 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
NET 311 Information Security
Message Authentication Codes, Hashes and Message Digests
Message Authentication and Hash Functions
Chapter 11 – Message Authentication and Hash Functions
Hash and MAC Algorithms
Cryptography and Network Security Chapter 12
Message Authentication and Hash Functions
NETW4005 COMPUTER SECURITY - A
Cryptography and Network Security Chapter 12
Cryptography and Network Security Chapter 12
Message Authentication
Outline Using cryptography in networks IPSec SSL and TLS.
Chapter -7 CRYPTOGRAPHIC HASH FUNCTIONS
Message Authentication Code
Lecture 4.1: Hash Functions, and Message Authentication Codes
Message Authentication Code
CRYPTOGRAPHY & NETWORK SECURITY
Message Authentication
Presentation transcript:

Message Authentication Code Lecture slides by Lawrie Brown for “Cryptography and Network Security”, 5/e, by William Stallings, Chapter 12 – “Message Authentication Codes”. July 2011

Message Authentication Problem Message Authentication is concerned with: protecting the integrity of a message validating identity of originator How to detect changes by adversary to message? Ancient solution : sign and seal More technique: break to message part and authenticator part (“tag”) How to do this digitally? Create a tag t(M) and send tag securely One of the most fascinating and complex areas of cryptography is that of message authentication and the related area of digital signatures. We now consider how to protect message integrity (ie protection from modification), as well as confirming the identity of the sender. Generically this is the problem of message authentication, and in eCommerce applications is arguably more important than secrecy. Message Authentication is concerned with: protecting the integrity of a message, validating identity of originator, & non-repudiation of origin (dispute resolution). There are three types of functions that may be used to produce an authenticator: a hash function, message encryption, message authentication code (MAC). Hash functions, and how they may serve for message authentication, are discussed in Chapter 11. The remainder of this section briefly examines the remaining two topics. The remainder of the chapter elaborates on the topic of MACs.

Communication without authentication Very easy.. Eve Eve can simply change the message M M’ Alice Bob Shared key k to generate authenticate message

Integrity Protection with MAC k=??, MAC=?? Eve Eve can not forge MAC when k is unknown M M’ MAC (k,M) MAC?? Alice Bob Key : k Key : k Shared key k to generate authenticate message

MAC Authentication (I) MAC allows two or more mutually trusting parties to authenticate messages sent between members Only Alice and me know k, one of us sent M. Eve If I do not send M, then Alice must have sent it. Alice Bob M Key : k Key : k MAC (k,M)

MAC Authentication (II) MAC allows two or more mutually trusting parties to authenticate messages sent between members Chris Only Alice, Chris, Doug and me know k, one of us sent M. Eve Key : k Alice Bob M Key : k Key : k Doug MAC (k,M) Key : k

Forge M’ and compute h(M’) Integrity with Hash Forge M’ and compute h(M’) Eve No shared key M M’ h (M) h (M) Alice Bob Can we simply send the hash with the message to serve message authentication ? Ans: No, Eve can change the message and recompute the hash. Using hash needs more appropriate procedure to guarantee integrity

Message Authentication Code A function of the message and a secret key that produces a fixed-length value that serves as the authenticator Generated by an algorithm : generated from message + secret key : MAC = C(K,M) A small fixed-sized block of data appended to message as a signature when sent Receiver performs same computation on message and checks it matches the MAC An alternative authentication technique involves the use of a secret key to generate a small fixed- size block of data, known as a cryptographic checksum or MAC that is appended to the message. This technique assumes that two communicating parties, say A and B, share a common secret key K. When A has a message to send to B, it calculates the MAC as a function of the message and the key: MAC = C(K, M). The message plus MAC are transmitted to the intended recipient. The recipient performs the same calculation on the received message, using the same secret key, to generate a new MAC. The received MAC is compared to the calculated MAC. If we assume that only the receiver and the sender know the identity of the secret key, and if the received MAC matches the calculated MAC, then the receiver is assured that the message has not been altered, is from the alleged sender, and if the message includes a sequence number then the receiver can be assured of the proper sequence because an attacker cannot successfully alter the sequence number. A MAC function is similar to encryption. One difference is that the MAC algorithm need not be reversible, as it must for decryption. In general, the MAC function is a many-to-one function.

MAC and Encryption As shown the MAC provides authentication But encryption can also provides authentication! 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 The process depicted on the previous slide provides authentication but not confidentiality, because the message as a whole is transmitted in the clear. Confidentiality can be provided by performing message encryption either after or before the MAC algorithm. In both these cases, two separate keys are needed, each of which is shared by the sender and the receiver. Typically, it is preferable to tie the authentication directly to the plaintext. Can use MAC in circumstances where just authentication is needed (or needs to be kept), see text for examples (e.g. such as when the same message is broadcast to a number of destinations; when one side has a heavy load and cannot afford the time to decrypt all incoming messages; or do not need to keep messages secret, but must authenticate messages). Finally, note that the MAC does not provide a digital signature because both sender and receiver share the same key.

MAC Properties A MAC is a cryptographic checksum MAC = CK(M) condenses a variable-length message M using a secret key K to a fixed-sized authenticator A many-to-one function potentially many messages have same MAC but finding these needs to be very difficult A MAC (also known as a cryptographic checksum, fixed-length authenticator, or tag) is generated by a function C. The MAC is appended to the message at the source at a time when the message is assumed or known to be correct. The receiver authenticates that message by re-computing the MAC. The MAC function is a many-to-one function, since potentially many arbitrarily long messages can be condensed to the same summary value, but don’t want finding them to be easy (see text for discussion)!

Keyed Hash Functions as MACs Want a MAC based on a hash function because hash functions are generally faster crypto hash function code is widely available Need a hashing including a key along with message But hashing is internally has no key! Original proposal: KeyedHash = Hash(Key|Message) some weaknesses were found with this Eventually led to development of HMAC In recent years, there has been increased interest in developing a MAC derived from a cryptographic hash function, because they generally execute faster in software than symmetric block ciphers, and because code for cryptographic hash functions is widely available. A hash function such as SHA was not designed for use as a MAC and cannot be used directly for that purpose because it does not rely on a secret key. There have been a number of proposals for the incorporation of a secret key into an existing hash algorithm, originally by just pre-pending a key to the message. Problems were found with these earlier, simpler proposals, but they resulted in the development of HMAC.

HMAC Hash-based Message Authentication Code Developed by Mihir Bellare, Ran Canetti, and Hugo Krawczyk in1996  Specified as Internet standard RFC2104 Use cryptographic hash function in combination with a secret key Any hash function can be used eg. MD5, SHA-1, RIPEMD-160, Whirlpool HMAC-MD5, HMAC-SHA1, HMAC-RIPEND-160, HMAC- Whirlpool HMAC-SHA1 and HMAC-MD5 are used within the IPsec and TLS protocols The idea of a keyed hash evolved into HMAC, designed to overcome some problems with the original proposals. It involves hashing padded versions of the key concatenated with the message, and then with another outer hash of the result prepended by another padded variant of the key. The hash function need only be used on 3 more blocks than when hashing just the original message (for the two keys + inner hash). HMAC can use any desired hash function, and has been shown to have the same security as the underlying hash function. Can choose the hash function to use based on speed/security concerns.

HMAC Overview Scheme consists of 2-stage nested : an inner and outer hash K+ is expanded key k padded with zeros on the left so that the result is b bits in length Intermediate result of first hash padded to increase complexity next hash Different “round keys” generated for each hash Stage 1: k1 = K+  ipad Stage 2: k2 = K+  opad Ipad : a string of repeated 0x36 00110110,00110110, . . .,00110110 Opad : is a string of repeated 0x5C 01011100,01011100, . . .,01011100 This illustrates the overall operation of HMAC: HMACK = Hash[(K+ XOR opad) || Hash[(K+ XOR ipad) || M)] where: K+ is K padded with zeros on the left so that the result is b bits in length ipad is a pad value of 36 hex repeated to fill block opad is a pad value of 5C hex repeated to fill block M is the message input to HMAC (including the padding specified in the embedded hash function) Note that the XOR with ipad results in flipping one-half of the bits of K. Similarly, the XOR with opad results in flipping one-half of the bits of K, but a different set of bits. In effect, pseudorandomly generated two keys from K. HMAC should execute in approximately the same time as the embedded hash function for long messages. HMAC adds three executions of the hash compression function (for Si, So, and the block produced from the inner hash). A more efficient implementation is possible by precomputing the internal hash function on (K+ XOR opad) and (K+ XOR ipad) and inserting the results into the hash processing at start & end. With this implementation, only one additional instance of the compression function is added to the processing normally produced by the hash function. This is especially worthwhile if most of the messages for which a MAC is computed are short. HMAC(K,M) = H( (K+⊕opad) | H( (K+ ⊕ ipad)| M) )

Simplified Visualize

CMAC (Cipher-based MAC) “Hashless” MAC Uses an encryption algorithm (DES, AES, etc.) to generate MAC Based on same idea as cipher block chaining Compresses result to size of single block (unlike encryption The Data Authentication Algorithm cipher-based MAC has been widely adopted in government and industry. Has been shown to be secure, with the following restriction. Only messages of one fixed length of mn bits are processed, where n is the cipher block size and m is a fixed positive integer. This limitation can be overcome using multiple keys, which can be derived from a single key. This refinement has been adopted by NIST as the cipher-based message authentication code (CMAC) mode of operation, for use with AES and triple DES. It is specified in NIST Special Publication 800-38B.

CMAC Overview Message broken into N blocks CMAC uses the blocksize of the underlying cipher (ie 128-bits for AES or 64-bits for triple-DES). The message is divided into n blocks M1..Mn, padded if necessary. The algorithm makes use of a k-bit encryption key K. For AES, the key size k is 128,192, or 256 bits; for triple DES, the key size is 112 or 168 bits. Message broken into N blocks Each block fed into an encryption algorithm with key Result XOR’d with next block before encryption to make final MAC

CMAC Facts Advantages: Disadvantage: Can use existing encryption functions Encryption functions have properties that resist preimage and collision attacks Ciphertext designed to appear like “random noise” – good approximation of random oracle model Most exhibit strong avalanche effect – minor change in message gives great change in resulting MAC Disadvantage: Encryption algorithms (particularly when chained) can be much slower than hash algorithms

Summary A Hash is used to guarantee the integrity of data, a MAC guarantees integrity AND authentication A Hash take a single input – a message and produces a message digest A MAC algorithm takes two inputs -- a message and a secret key -- and produces a MAC A HMAC algorithm is simply a specific type of MAC algorithm that uses a hash algorithm internally to generate the MAC A CMAC algorithm is a specific type of MAC algorithm that uses a block cipher internally to generate the MAC Chapter 12 summary.