Lecture 7
Lecture 7
2
Message Authentication
• Bob receives a message m from Alice, he wants to know
(Data origin authentication) whether the message was
really sent by Alice;
(Data integrity) whether the message has been modified.
• Solutions:
Alice attaches a message authentication code (MAC)
to the message.
Or she attaches a digital signature to the message.
3
Communication without authentication
Very easy..
Alice Bob
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
Integrity Protection with MAC
k=??,
MAC=??
Alice Bob
Key : k Key : k
m1 m2 m3 mk
v0 v1 v2 vk
IV f f f … f h(m)
m = m1 m2 m3 ms
f … f X hk(m)
h(m)
X
k IV f f
ms+1
• Easy to forge:
(m, hk ( m)), f
hk(m) hk(m||ms+1)
where m = m ms +1
HMAC
• Interest in developing a MAC derived from a cryptographic hash code
• Cryptographic hash functions generally execute faster
• Library code is widely available
• SHA-1 was not deigned for use as a MAC because it does not rely on a secret key
• MD5
• 128-bit output
• Introduced in 1991…collision attacks found in 2004…several extensions and improvements
since then
• Still widely deployed(!)
• SHA-1
• 160-bit output
• No collisions known, but theoretical attacks exist
• SHA-2
• 256-/512-bit outputs
Secure Hash Algorithm (SHA)
• SHA was originally developed by NIST
• Published as FIPS 180 in 1993
• Was revised in 1995 as SHA-1
• Produces 160-bit hash values
• NIST issued revised FIPS 180-2 in 2002
• Adds 3 additional versions of SHA
• SHA-256, SHA-384, SHA-512
• With 256/384/512-bit hash values
• Same basic structure as SHA-1 but greater security
• The most recent version is FIPS 180-4 which added two variants of
SHA-512 with 224-bit and 256-bit hash sizes
Comparison of SHA Parameters
Requirements:
• Must support hash value lengths of 224, 256,384, and 512 bits
• Algorithm must process small blocks at a time instead of
requiring the entire message to be buffered in memory before
processing it
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
CBC CMAC Overview
CMAC Facts
• Advantages:
• Can use existing encryption functions
• Encryption functions have properties that resist preimage and collision
attacks
• 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
30
Encryption + integrity
➢simultaneously protect confidentiality and authenticity of communications
⚫often required but usually separate
➢approaches
⚫Hash-then-encrypt: EK(M || H(M))
⚫MAC-then-encrypt: EK2(M || MACK1(M))
⚫Encrypt-then-MAC: (C=EK2(M), T=MACK1(C)
⚫Encrypt-and-MAC: (C=EK2(M), T=MACK1(M)
Replay attacks