Odds and Ends: Key Derivation
Odds and Ends: Key Derivation
Key Derivation
Dan Boneh
Deriving many keys from one
Typical scenario. a single source key (SK) is sampled from:
• Hardware random number generator
• A key exchange protocol (discussed later)
SK k1 , k 2 , k3 , …
KDF
Dan Boneh
When source key is uniform
F: a PRF with key space K and outputs in {0,1}n
Dan Boneh
Extract-then-Expand paradigm
Step 1: extract pseudo-random key k from source key SK
prob
prob
extractor
SK k
salt
Dan Boneh
Password-Based KDF (PBKDF)
Deriving keys from passwords:
• Do not use HKDF: passwords have insufficient entropy
• Derived keys will be vulnerable to dictionary attacks
(more on this later)
Dan Boneh
End of Segment
Dan Boneh
Online Cryptography Course Dan Boneh
Deterministic Encryption
Dan Boneh
The need for det. Encryption (no nonce)
Alice data ??
Dan Boneh
The need for det. Encryption (no nonce)
??
Alice data
k1, k2 Bob data
equal ciphertexts
means same index
Dan Boneh
Problem: det. enc. cannot be CPA secure
The problem: attacker can tell when two ciphertexts
encrypt the same message ⇒ leaks information
b m0 , m0 M
Chal. Adv.
c0 E(k, m0)
kK
m 0 , m1 M
output 0
c E(k, mb) if c = c0
Dan Boneh
A solution: the case of unique messages
Suppose encryptor never encrypts same message twice:
the pair (k , m) never repeats
Dan Boneh
Deterministic CPA security
E = (E,D) a cipher defined over (K,M,C). For b=0,1 define EXP(b) as:
for i=1,…,q:
b Chal. Adv.
kK mi,0 , mi,1 M : |mi,0| = |mi,1|
where m1,0, …, mq,0 are distinct and m1,1, …, mq,1 are distinct
ciphertext
Yes
b
No m,m
Adv.
Chal.
c m⨁F(k, FIV)
It depends kK
m0 , m1 output 0 if
c’ mb⨁F(k, FIV) c⨁c’=m⨁m0
End of Segment
Dan Boneh
Online Cryptography Course Dan Boneh
Deterministic Encryption
Constructions:
SIV and wide PRP
Dan Boneh
Deterministic encryption
Needed for maintaining an encrypted database index
• Lookup records by encrypted index
Dan Boneh
Construction 1: Synthetic IV (SIV)
Let (E, D) be a CPA-secure encryption. E(k, m ; r) ⟶ c
Let F:K × M ⟶ R be a secure PRF
Well suited for messages longer than one AES block (16 bytes)
Dan Boneh
Ensuring ciphertext integrity
Goal: det. CPA security and ciphertext integrity
⇒ DAE: deterministic authenticated encryption
Consider a SIV special case: SIV-CTR
SIV where cipher is counter mode with rand. IV
PRF F message
k1
CTR mode with PRF Fctr k2
Fctr(k2, IV) ll Fctr(k2, IV+1) ll … ll Fctr(k2, IV+L)
IV ciphertext
Dan Boneh
Det. Auth. Enc. (DAE) for free
Decryption: IV ciphertext
message
if ≠IV output ⊥
E E E
E ⨁ ⨁
⨁
E E E
⨁ ⨁ ⨁
Dan Boneh
PRP-based Det. Authenticated Enc.
Let (E, D) be a secure PRP. E: K × (X×{0,1}n) ⟶ X×{0,1}n
Dan Boneh
Online Cryptography Course Dan Boneh
Tweakable encryption
Dan Boneh
Disk encryption: no expansion
Sectors on disk are fixed size (e.g. 4KB)
⇒ encryption cannot expand plaintext (i.e. M = C)
⇒ must use deterministic encryption, no integrity
Dan Boneh
sector 1 sector 2 sector 3
Can we do better?
Dan Boneh
sector 1 sector 2 sector 3
Syntax: E , D : K × T × X ⟶ X
Dan Boneh
Secure tweakable block ciphers
E , D : K × T × X ⟶ X . For b=0,1 define experiment EXP(b) as:
b
b=1: π(Perms[X])|T|
Chal. Adv. A
b=0: kK, π[t] E(k,t,)
t1, x1 t2, x2 … tq, xq
π
π[t1](x1) π[t2](x2) … π[tq](xq)
b’ {0,1}
• Def: E is a secure tweakable PRP if for all efficient A:
AdvtPRP[A,E] = |Pr[EXP(0)=1] – Pr[EXP(1)=1] | is negligible. Dan Boneh
Example 1: the trivial construction
Let (E,D) be a secure PRP, E: K × X ⟶ X .
Dan Boneh
2. the XTS tweakable block cipher [R’04]
x c
Yes, it is secure
No: E(k, (t,1), P(t,2)) ⨁ E(k, (t,2), P(t,1)) = P(t,1)
No: E(k, (t,1), P(t,1)) ⨁ E(k, (t,2), P(t,2)) = P(t,1) ⨁ P(t,2)
No: E(k, (t,1), P(t,1)) ⨁ E(k, (t,2), P(t,2)) = 0
Disk encryption using XTS
sector # t: block 1 block 2 block n
Dan Boneh
End of Segment
Dan Boneh
Online Cryptography Course Dan Boneh
Format preserving
encryption
Dan Boneh
Encrypting credit card numbers
Credit card format: bbbb bbnn nnnn nnnc ( ≈ 42 bits )
k
k
POS
terminal
Dan Boneh
Step 1: from {0,1}n to {0,1}t (t<n)
Want PRP on {0,…,s-1} . Let t be such that 2t-1 < s ≤ 2t .
t/2 bits R0 R1 R2 R3
F’(k1,⋅) F’(k2,⋅) F’(k3,⋅)
t/2 bits L0 ⊕ L1 ⊕ L2 ⊕ L3
input output
(better to use 7 rounds a la Patarin, Crypto’03)
Dan Boneh
Step 2: from {0,1}t to {0,…,s-1}
Given PRP (E,D): K × {0,1}t ⟶ {0,1}t
we build (E’,D’): K × {0,…,s-1} ⟶ {0,…,s-1}
Expected # iterations: 2
{0,…,s-1} {0,1}t
Dan Boneh
Security
Step 2 is tight: ∀A ∃B: PRPadv[A,E] = PRPadv[B,E’]
Dan Boneh