SlideShare a Scribd company logo
Understanding Cryptography
by Christof Paar and Jan Pelzl
www.crypto-textbook.com
These slides were prepared by Christof Paar and Jan Pelzl

And modified by Sam Bowne
Chapter 12 – Message Authentication Codes
(MACs)
Updated 12-4-17
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl
! Some legal stuff (sorry): Terms of Use
2
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl3
12.1 Principles of Message Authentication Codes
12.2 MACs from Hash Functions: HMAC
12.3 MACs from Block Ciphers: CBC-MAC
12.4 Galois Counter Message Authentication Code: GMAC
Contents of this Chapter
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl4
12.1 



Principles of Message Authentication
Codes
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl
• Similar to digital signatures, MACs append an
authentication tag to a message
• MACs use a symmetric key k for generation and
verification
• Computation of a MAC: m = MACk(x)
Principle of MessageAuthentication Codes
5
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl6
1. Cryptographic checksum
A MAC generates a cryptographically secure authentication tag for a given message.
2. Symmetric
MACs are based on secret symmetric keys. The signing and verifying parties must
share a secret key.
3. Arbitrary message size
MACs accept messages of arbitrary length.
4. Fixed output length
MACs generate fixed-size authentication tags.
5. Message integrity
MACs provide message integrity: Any manipulations of a message during transit will be
detected by the receiver.
6. Message authentication
The receiving party is assured of the origin of the message.
7. No nonrepudiation
Since MACs are based on symmetric principles, they do not provide nonrepudiation.
Properties of MessageAuthentication Codes
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl7
12.2


MACs from Hash Functions: 

HMAC
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl8
•MAC is realized with cryptographic hash
functions (e.g., SHA-1)
•HMAC is such a MAC built from hash functions
•Basic idea: Key is hashed together with the
message
•Two possible constructions:
•secret prefix MAC: m =MACk(x) = h(k||x)
•secret suffix MAC: m =MACk(x) = h(x||k)
MACs from Hash Functions
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl9
•Secret prefix MAC: Attack MAC for the message x =
(x1,x2, . . . ,xn,xn+1), where xn+1 is an arbitrary
additional block, can be constructed from m without
knowing the secret key
•Secret suffix MAC: find collision x and xO such
that h(x) = h(xO), then m = h(x||k) = h(xO||k)
•Idea: Combine secret prefix and suffix: HMAC (cf.
next slide)
MACs from Hash Functions: Attacks
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl
• Proposed by Mihir Bellare, 

Ran Canetti and Hugo Krawczyk 

in 1996
• Uses two hashes: inner & outer
• k+ is key k padded with 

zeroes to the block 

length of the hash function
• expanded key k+ is XORed

with the inner pad
• ipad = 00110110 repeated
• opad = 01011100 repeated
• HMACk(x) =
h [ (k+ ⊕ opad) || h[ (k+ ⊕ ipad)|| x ] ]
HMAC
10
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl
• HMAC is provably secure
• The MAC can only be broken
if a collision for the hash
function can be found.
HMAC
11
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl12
12.3



MACs from Block Ciphers: 

CBC-MAC
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl
• MAC constructed from block ciphers (e.g. AES)
• Popular: Use AES in CBC mode
• CBC-MAC:
MACs from Block Ciphers
13
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl14
• MAC Generation
• Divide the message x into blocks xi
• Compute first iteration y1 = ek(x1⊕IV)
• Compute yi = ek(xi⊕yi−1) for the next blocks
• Final block is the MAC value: m =MACk(x) = yn
• MAC Verification
• Repeat MAC computation (m‘)
• Compare results: In case m’ = m, the message is
verified as correct
• In case m’ ≠ m, the message and/or the MAC value m
has been altered during transmission
CBC-MAC
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl15
12.4


Galois Counter 

Message Authentication Code:

GMAC
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl16
• MAC Generation
• Divide the message x into blocks xi
• Compute first iteration y1 = ek(x1⊕IV)
• Compute yi = ek( xi ⊕ yi−1 ) for the next blocks
• Final block is the MAC value: m =MACk(x) = yn
• MAC Verification
• Repeat MAC computation (m‘)
• Compare results:In case m’ = m, the message is verified as
correct
• In case m’ ≠ m, the message and/or the MAC value m have
been altered during transmission
CBC-MAC
Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl17
• MACs provide two security services, message integrity and message
authentication, using symmetric techniques. MACs are widely used in
protocols.
• Both of these services also provided by digital signatures, but MACs are much
faster as they are based on symmetric algorithms.
• MACs do not provide nonrepudiation.
• In practice, MACs are either based on block ciphers or on hash functions.
• HMAC is a popular and very secure MAC, used in many practical protocols
such as TLS.
! Lessons Learned
CNIT 141: 12. Message Authentication Codes (MACs)

More Related Content

More from Sam Bowne

9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android ApplicationsSam Bowne
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)Sam Bowne
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3Sam Bowne
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard ProblemsSam Bowne
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)Sam Bowne
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis MethodologySam Bowne
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated EncryptionSam Bowne
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)Sam Bowne
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)Sam Bowne
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream CiphersSam Bowne
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data CollectionSam Bowne
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers Sam Bowne
 
6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)Sam Bowne
 
4 Getting Started & 5 Leads
4 Getting Started & 5 Leads4 Getting Started & 5 Leads
4 Getting Started & 5 LeadsSam Bowne
 
3. Cryptographic Security
3. Cryptographic Security3. Cryptographic Security
3. Cryptographic SecuritySam Bowne
 
Bitcoin and Blockchains
Bitcoin and BlockchainsBitcoin and Blockchains
Bitcoin and BlockchainsSam Bowne
 
Ch 18: Source Code Auditing
Ch 18: Source Code AuditingCh 18: Source Code Auditing
Ch 18: Source Code AuditingSam Bowne
 
Ch 16 & 17 Fault Injection & Fuzzing
Ch 16 & 17 Fault Injection & FuzzingCh 16 & 17 Fault Injection & Fuzzing
Ch 16 & 17 Fault Injection & FuzzingSam Bowne
 
Ch 13: Attacking Users: Other Techniques (Part 2)
Ch 13: Attacking Users: Other Techniques (Part 2)Ch 13: Attacking Users: Other Techniques (Part 2)
Ch 13: Attacking Users: Other Techniques (Part 2)Sam Bowne
 

More from Sam Bowne (20)

9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)
 
10 RSA
10 RSA10 RSA
10 RSA
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard Problems
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis Methodology
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated Encryption
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream Ciphers
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers
 
6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)
 
4 Getting Started & 5 Leads
4 Getting Started & 5 Leads4 Getting Started & 5 Leads
4 Getting Started & 5 Leads
 
3. Cryptographic Security
3. Cryptographic Security3. Cryptographic Security
3. Cryptographic Security
 
Bitcoin and Blockchains
Bitcoin and BlockchainsBitcoin and Blockchains
Bitcoin and Blockchains
 
Ch 18: Source Code Auditing
Ch 18: Source Code AuditingCh 18: Source Code Auditing
Ch 18: Source Code Auditing
 
Ch 16 & 17 Fault Injection & Fuzzing
Ch 16 & 17 Fault Injection & FuzzingCh 16 & 17 Fault Injection & Fuzzing
Ch 16 & 17 Fault Injection & Fuzzing
 
Ch 13: Attacking Users: Other Techniques (Part 2)
Ch 13: Attacking Users: Other Techniques (Part 2)Ch 13: Attacking Users: Other Techniques (Part 2)
Ch 13: Attacking Users: Other Techniques (Part 2)
 

Recently uploaded

Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxShibin Azad
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePedroFerreira53928
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17Celine George
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptSourabh Kumar
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxheathfieldcps1
 
Open Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointOpen Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointELaRue0
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Mohamed Rizk Khodair
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxJenilouCasareno
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPost Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPragya - UEM Kolkata Quiz Club
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticspragatimahajan3
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/siemaillard
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTechSoup
 
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Celine George
 

Recently uploaded (20)

Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
Open Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointOpen Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPoint
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
Word Stress rules esl .pptx
Word Stress rules esl               .pptxWord Stress rules esl               .pptx
Word Stress rules esl .pptx
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPost Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 

CNIT 141: 12. Message Authentication Codes (MACs)

  • 1. Understanding Cryptography by Christof Paar and Jan Pelzl www.crypto-textbook.com These slides were prepared by Christof Paar and Jan Pelzl
 And modified by Sam Bowne Chapter 12 – Message Authentication Codes (MACs) Updated 12-4-17
  • 2. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl ! Some legal stuff (sorry): Terms of Use 2
  • 3. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl3 12.1 Principles of Message Authentication Codes 12.2 MACs from Hash Functions: HMAC 12.3 MACs from Block Ciphers: CBC-MAC 12.4 Galois Counter Message Authentication Code: GMAC Contents of this Chapter
  • 4. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl4 12.1 
 
 Principles of Message Authentication Codes
  • 5. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl • Similar to digital signatures, MACs append an authentication tag to a message • MACs use a symmetric key k for generation and verification • Computation of a MAC: m = MACk(x) Principle of MessageAuthentication Codes 5
  • 6. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl6 1. Cryptographic checksum A MAC generates a cryptographically secure authentication tag for a given message. 2. Symmetric MACs are based on secret symmetric keys. The signing and verifying parties must share a secret key. 3. Arbitrary message size MACs accept messages of arbitrary length. 4. Fixed output length MACs generate fixed-size authentication tags. 5. Message integrity MACs provide message integrity: Any manipulations of a message during transit will be detected by the receiver. 6. Message authentication The receiving party is assured of the origin of the message. 7. No nonrepudiation Since MACs are based on symmetric principles, they do not provide nonrepudiation. Properties of MessageAuthentication Codes
  • 7. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl7 12.2 
 MACs from Hash Functions: 
 HMAC
  • 8. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl8 •MAC is realized with cryptographic hash functions (e.g., SHA-1) •HMAC is such a MAC built from hash functions •Basic idea: Key is hashed together with the message •Two possible constructions: •secret prefix MAC: m =MACk(x) = h(k||x) •secret suffix MAC: m =MACk(x) = h(x||k) MACs from Hash Functions
  • 9. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl9 •Secret prefix MAC: Attack MAC for the message x = (x1,x2, . . . ,xn,xn+1), where xn+1 is an arbitrary additional block, can be constructed from m without knowing the secret key •Secret suffix MAC: find collision x and xO such that h(x) = h(xO), then m = h(x||k) = h(xO||k) •Idea: Combine secret prefix and suffix: HMAC (cf. next slide) MACs from Hash Functions: Attacks
  • 10. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl • Proposed by Mihir Bellare, 
 Ran Canetti and Hugo Krawczyk 
 in 1996 • Uses two hashes: inner & outer • k+ is key k padded with 
 zeroes to the block 
 length of the hash function • expanded key k+ is XORed
 with the inner pad • ipad = 00110110 repeated • opad = 01011100 repeated • HMACk(x) = h [ (k+ ⊕ opad) || h[ (k+ ⊕ ipad)|| x ] ] HMAC 10
  • 11. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl • HMAC is provably secure • The MAC can only be broken if a collision for the hash function can be found. HMAC 11
  • 12. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl12 12.3
 
 MACs from Block Ciphers: 
 CBC-MAC
  • 13. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl • MAC constructed from block ciphers (e.g. AES) • Popular: Use AES in CBC mode • CBC-MAC: MACs from Block Ciphers 13
  • 14. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl14 • MAC Generation • Divide the message x into blocks xi • Compute first iteration y1 = ek(x1⊕IV) • Compute yi = ek(xi⊕yi−1) for the next blocks • Final block is the MAC value: m =MACk(x) = yn • MAC Verification • Repeat MAC computation (m‘) • Compare results: In case m’ = m, the message is verified as correct • In case m’ ≠ m, the message and/or the MAC value m has been altered during transmission CBC-MAC
  • 15. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl15 12.4 
 Galois Counter 
 Message Authentication Code:
 GMAC
  • 16. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl16 • MAC Generation • Divide the message x into blocks xi • Compute first iteration y1 = ek(x1⊕IV) • Compute yi = ek( xi ⊕ yi−1 ) for the next blocks • Final block is the MAC value: m =MACk(x) = yn • MAC Verification • Repeat MAC computation (m‘) • Compare results:In case m’ = m, the message is verified as correct • In case m’ ≠ m, the message and/or the MAC value m have been altered during transmission CBC-MAC
  • 17. Chapter 12 of Understanding Cryptography by Christof Paar and Jan Pelzl17 • MACs provide two security services, message integrity and message authentication, using symmetric techniques. MACs are widely used in protocols. • Both of these services also provided by digital signatures, but MACs are much faster as they are based on symmetric algorithms. • MACs do not provide nonrepudiation. • In practice, MACs are either based on block ciphers or on hash functions. • HMAC is a popular and very secure MAC, used in many practical protocols such as TLS. ! Lessons Learned