KEMBAR78
Message Authentication Codes Guide | PDF
0% found this document useful (0 votes)
74 views27 pages

Message Authentication Codes Guide

This document discusses message authentication requirements and techniques. It covers using encryption for authentication, message authentication codes (MACs), and HMAC which provides authentication using a cryptographic hash function and secret key. HMAC is specified as an Internet standard and proven secure if the underlying hash function is secure against collision attacks.

Uploaded by

mca.2022
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views27 pages

Message Authentication Codes Guide

This document discusses message authentication requirements and techniques. It covers using encryption for authentication, message authentication codes (MACs), and HMAC which provides authentication using a cryptographic hash function and secret key. HMAC is specified as an Internet standard and proven secure if the underlying hash function is secure against collision attacks.

Uploaded by

mca.2022
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Cryptography and

Network Security
Chapter 12
Fifth Edition
by William Stallings
Chapter 12 – Message
Authentication Codes
 At cats' green on the Sunday he took the message from
the inside of the pillar and added Peter Moran's name to
the two names already printed there in the "Brontosaur"
code. The message now read: “Leviathan to Dragon:
Martin Hillman, Trevor Allan, Peter Moran: observe and
tail.” What was the good of it John hardly knew. He felt
better, he felt that at last he had made an attack on Peter
Moran instead of waiting passively and effecting no
retaliation. Besides, what was the use of being in
possession of the key to the codes if he never took
advantage of it?
 —Talking to Strange Men, Ruth Rendell
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


Message Security Requirements
 Disclosure
 Traffic analysis
 Masquerade
 Content modification
 Sequence modification
 Timing modification
 Source repudiation
 Destination repudiation
Symmetric Message Encryption
 Encryption can also provides authentication
 If symmetric encryption is used then:

Receiver know sender must have created it

Since only sender and receiver now key used

Know content cannot have been altered

If message has suitable structure, redundancy
or a checksum to detect any changes
Public-Key Message Encryption
 If public-key encryption is used:

Encryption provides no confidence of sender
• since anyone potentially knows public-key

However if
• sender signs message using their private-key
• then encrypts with recipients public key
• have both secrecy and authentication

Again need to recognize corrupted messages

But at cost of two public-key uses on
message
Internal & External Error
Control
 With internal error control, authentication is
provided because an opponent would have
difficulty generating ciphertext that, when
decrypted, would have valid error control
bits.

 With external error control, an opponent


can construct messages with valid error-
control codes. Although the opponent
cannot know what the decrypted plaintext
will be, he or she can still hope to create
confusion and disrupt operations.
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 cryptographic
checksum.
 Receiver performs same computation on
message and checks it matches the MAC
 Provides assurance that message is unaltered
and comes from sender
Message Authentication Code
 A small fixed-sized block of data
 Generated from message + secret key
 MAC = C(K,M)
 Appended to message when sent
Basic Use of MAC
When MAC Matched
 The receiver is assured that the message has not
been altered. If an attacker alters the message but
does not alter the MAC, then the receiver’s calculation
of the MAC will differ from the received MAC.
 The receiver is assured that the message is from the
alleged sender. Because no one else knows the
secret key to generate MAC.
 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.
Message Authentication
Codes
 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


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
MAC Properties
 Is a many-to-one function

Potentially many messages have same MAC

But finding these needs to be very difficult


If an m-bit MAC is used, then there are 2m
possible MACs.

N possible messages with N >> 2m

With a k-bit key, there are 2k possible keys.
Security of MACs
 Like block ciphers have:
 Brute-force attacks exploiting
m/

Strong collision resistance hash have cost 2 2

• 128-bit hash looks vulnerable, 160-bits better



MACs with known message-MAC pairs
• can either attack keyspace (cf key search) or MAC
• Brute force attack effort ~ min(2k,2n)
• at least 128-bit MAC is needed for security
Requirements for MACs
 If k > m; key size is greater than MAC
size.
 Given message M1 and T1 where T1
=MAC(k,M1), we can compute
Ti=MAC(ki, M1) for all values of ki.
 At least one key ki will produce Ti = T1.
 But 2k > 2m; So 2k/2m = 2k-m key values will
produce T1 and create confusion in the
mind of attacker.
 Round 1
 Given:M1, T1 = MAC(K,M1)
 Compute Ti = MAC(Ki,M1) for all 2k keys

Number of matches ≈ 2(k-n)
 Round 2
 Given:M2, T2 = MAC(K,M2)
 Compute Ti = MAC(Ki,M2) for the 2(k-n) keys
resulting from Round 1

Number of matches ≈ 2(k-2xn)

 On average, α rounds will be needed if k= α x n.


Security of MACs
 Cryptanalytic attacks exploit structure

like block ciphers want brute-force attacks to
be the best alternative
 More variety of MACs so harder to
generalize about cryptanalysis
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. Probability
that two different messages have the same hash
must be 2-n where n is number of bits in the hash.
3. MAC should depend equally on all bits of the
message
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
 Hash includes a key along with message
 Original proposal:
KeyedHash = Hash(Key|Message)

some weaknesses were found with this
 Eventually led to development of HMAC
Problem with Keyed Hash
 KeyedHash = Hash(Key|Message)
 Recall hash function works on blocks
 Let M = Key | Message | Padding and M

M=M1 M2 … ML, where |Mi| = Blocksize


Hash=H(H(…H(H(IV,M1),M2),…,ML)
 But can add extra block(s) M
L+1 by

Hash’=H(Hash,ML+1)
 Unless formatting prevents it…
… but still best to use HMAC!
HMAC Design Objectives
 Use, without modifications, hash functions
 Allow for easy replaceability of embedded
hash function
 Preserve original performance of hash
function without significant degradation
 Use and handle keys in a simple way.
 Have well understood cryptographic analysis
of authentication mechanism strength
HMAC
 Specified as Internet standard RFC2104
 Uses hash function on the message:
HMACK(M)= Hash[(K+ XOR opad) ||
Hash[(K+ XOR ipad) || M)] ]

where K+ is the key padded out to block size

opad, ipad are specified padding constants
 Overhead is just 3 more hash block calculations
than the message needs alone
 Any hash function can be used

eg. MD5, SHA-1, RIPEMD-160, Whirlpool
HMAC
Overview
HMAC Security
 Proved security of HMAC relates to that of
the underlying hash algorithm
 Attacking HMAC requires either:

brute force attack on key used

birthday attack (but since keyed would need
to observe a very large number of messages)
 Choose hash function used based on
speed verses security constraints
Summary
 Have considered:

Message authentication requirements

Message authentication using encryption

MACs

HMAC authentication using a hash function

You might also like