Ch 2 - Message integrity
Ch 2 - Message integrity
Message integrity
Dan Boneh
Message Integrity
Goal: integrity, no confidentiality.
Examples:
– Protecting public binaries on disk.
– Protecting banner ads on web pages.
Dan Boneh
Message integrity: MACs
k message m tag
k
Alice Bob
m1 M m2 , …, mq
Chal. Adv.
kK t1 S(k,m1) t2 , …, tq
(m,t)
b
b=1 if V(k,m,t) = `yes’ and (m,t) { (m1,t1) , … , (mq,tq) }
b=0 otherwise
Message Integrity
Dan Boneh
Abstractly: PRPs and PRFs
• Pseudo Random Function (PRF) defined over (K,X,Y):
F: K X Y
such that exists “efficient” algorithm to evaluate F(k,x)
b’ {0,1}
• Def: F is a secure PRF if for all “efficient” A: EXP(b)
b’ {0,1}
• Def: E is a secure PRP if for all “efficient” A:
AdvPRP[A,E] = |Pr[EXP(0)=1] – Pr[EXP(1)=1] |
Dan Boneh
Let X = {0,1}. Perms[X] contains two functions
Dan Boneh
Consider the 1-bit PRP from the previous question: E(k,x) = x⨁k
Is it a secure PRF?
Yes
No
Attacker A:
It depends (1) query f(⋅) at x=0 and x=1
(2) if f(0) = f(1) output “1”, else “0”
AdvPRF[A,E] = |0-½| = ½
Dan Boneh
Secure PRF ⇒ Secure MAC
For a PRF F: K × X ⟶ Y define a MAC IF = (S,V) as:
– S(k,m) := F(k,m)
– V(k,m,t): output `yes’ if t = F(k,m) and `no’ otherwise.
message m tag
Alice Bob
m1 X m2 , …, mq
Chal. Adv.
t1 f(m1) f(m2) , …, f(mq)
f in
Funs[X,Y] (m,t)
Dan Boneh
Online Cryptography Course Dan Boneh
Message Integrity
Dan Boneh
MACs and PRFs
Recall: secure PRF F ⇒ secure MAC, as long as |Y| is large
S(k, m) = F(k, m)
Our goal:
given a PRF for short messages (AES)
construct a PRF for long messages
Dan Boneh
Construction 1: encrypted CBC-MAC
raw CBC
m[0] m[1] m[3] m[4]
F(k,) F(k,) F(k,) F(k,)
cascade
m[0] m[1] m[3] m[4]
k t
> F > F > F > F t ll fpad
> F
Let F: K × X ⟶ K be a PRF k1
tag
Define new PRF FNMAC : K2 × X≤L ⟶ K
Dan Boneh
Why the last encryption step in ECBC-MAC and NMAC?
S(k,m) = rawCBC(k,m)
Message Integrity
MAC padding
Dan Boneh
Recall: ECBC-MAC
F(k,) F(k,) F(k,) F(k,)
F(k,) F(k,) F(k,) F(k,)
tag
F(k1,)
Dan Boneh
CBC MAC padding
Bad idea: pad m with 0’s
m[0] m[1] m[0] m[1] 0000
Dan Boneh
CMAC (NIST standard)
k1 k2
Dan Boneh
Online Cryptography Course Dan Boneh
Message Integrity
PMAC and
Carter-Wegman MAC
Dan Boneh
• ECBC and NMAC are sequential.
Dan Boneh
Construction 3: PMAC – parallel MAC
P(k, i): an easy to compute function
m[0] m[1] m[2] m[3]
key = (k, k1)
P(k,0) P(k,1) P(k,2) P(k,3)
Padding similar
to CMAC F(k1,) F(k1,) F(k1,)
Let F: K × X ⟶ X be a PRF
Define new PRF FPMAC : K2 × X≤L ⟶ X F(k1,) tag
Dan Boneh
PMAC is incremental
Suppose F is a PRP. m[0] m[1] m[3] m[4]
m1 M
Chal. Adv.
kK t1 S(k,m1)
(m,t)
b
b=1 if V(k,m,t) = `yes’ and (m,t) ≠ (m1,t1)
b=0 otherwise
Dan Boneh
Further reading
• J. Black, P. Rogaway: CBC MACs for Arbitrary-Length Messages: The Three-
Key Constructions. J. Cryptology 18(2): 111-131 (2005)
• K. Pietrzak: A Tight Bound for EMAC. ICALP (2) 2006: 168-179