1 / 35

LECTURE 4 Data Integrity & Authentication Message Authentication Codes (MACs)

LECTURE 4 Data Integrity & Authentication Message Authentication Codes (MACs). Goal. Ensure integrity of messages, even in presence of an active adversary who sends own messages. Alice (sender). Bob (reciever). Fran (forger). Remark: Authentication is orthogonal to secrecy , yet

ike
Download Presentation

LECTURE 4 Data Integrity & Authentication Message Authentication Codes (MACs)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LECTURE 4Data Integrity & AuthenticationMessage Authentication Codes (MACs)

  2. Goal Ensure integrity of messages, even in presence of an active adversary who sends own messages. Alice (sender) Bob (reciever) Fran (forger) Remark: Authentication is orthogonal to secrecy, yet systems often required to provide both.

  3. Definitions • Authentication algorithm - A • Verification algorithm - V (“accept”/”reject”) • Authentication key – k • Message space (usually binary strings) • Every message between Alice and Bob is a pair (m, Ak(m)) • Ak(m) is called the authentication tag of m

  4. Definition (cont.) • Requirement – Vk(m,Ak(m)) = “accept” • The authentication algorithm is called MAC (Message Authentication Code) • Ak(m) is frequently denoted MACk(m) • Verification is by executing authentication on m and comparing with MACk(m)

  5. Properties of MAC Functions • Security requirement – adversary can’t construct a new legal pair (m, MACk(m)) even after seeing (mi, MACk(mi)) (i=1,2,…,n) • Output should be as short as possible • The MAC function is not 1-to-1

  6. Adversarial Model • Available Data: • The MAC algorithm • Known plaintext • Chosen plaintext • Note: chosen MAC is unrealistic • Goal: Given n legal pairs (m1, MACk(m1)), …, (mn, MACk(mn)) find a new legal pair (m, MACk(m))

  7. Adversarial Model We will say that the adversary succeeded even if the message Fran forged is “meaningless”. The reason is that it is hard to predict what has and what does not have a meaning in an unknown context, and how will Bob, the reciever, react to such successful forgery.

  8. Efficiency • Adversary goal: given n legal pairs (m1, MACk(m1)), …, (mn, MACk(mn)) find a new legal pair (m, MACk(m)) efficiently and with non negligible probability. • If n is large enough then n pairs (mi, MACk(mi)) determine the key k uniquely(with high prob.). Thus a non-deterministic machine can guess k and verify it. But doing this in poly time should be computationally hard.

  9. MACs Used in Practice We describe a MAC based onCBC Mode Encryption, and aMAC based on cryptographic hash functions.

  10. Reminder: CBC Mode Encryption(Cipher Block Chaining) S0 P1 P2 P3 Ek Ek Ek C1 C2 C3 Previous ciphertext is XORed with current plaintext before encrypting current block. An initialization vector S0 is used as a “seed” for the process. Seed can be “openly” transmitted.

  11. CBC Mode MACs • Start with the all zero seed. • Given a message consisting of n blocks M1,M2,…,Mn, apply CBC (using the secret key k). 0000000 M1 M2 Mn       Ek Ek Ek C1 C2 Cn • Produce n “cipertext” blocks C1,C2,…,Cn , discard first n-1. • Send M1,M2,…,Mn & the authentication tag MACk(M)=Cn .

  12. Security of CBC MAC [BKR] • Claim: If Ek is a pseudo random function, then CBC MACis resilient to forgery. • Proof outline: Assume CBC MAC can be forged efficiently. Transform the forging algorithm into an algorithm distinguishing Ek from random functionefficiently.

  13. Combined Secrecy & MAC • Given a message consisting of n blocks M1,M2,…,Mn, apply CBC (using the secret key k1) to produce MACk1(M). • Produce n cipertext blocks C1,C2,…,Cn • under a different key, k2. • Send C1,C2,…,Cn & the authentication tag MACk1(M).

  14. Hash Functions • Map large domains to smaller ranges • Example h: {0,1,…,p2}  {0,1,…,p-1} defined by h(x) = ax+b mod p • Used extensively for searching (hash tables) • Collisions are resolved by several possible means – chaining, double hashing, etc.

  15. Collision Resistance • A hash function h: D  Ris called weakly collision resistant for xD if it is hard to find x’x such that h(x’)=h(x) • A function h: DRis called strongly collision resistant if it is hard to find x, x’ such that x’x but h(x)=h(x’)

  16. The Birthday Paradox • If 23 people are chosen at random the probability that two of them have the same birth-day is greater than 0.5 • More generally, let h:DR be any mapping. If we chose 1.17|R|1/2 elements of Dat random, the probability that two of them are mapped to the same image is greater than 0.5.

  17. Cryptographic Hash Functions Cryptographic hash functions are hash functions that are strongly collision resistant. • Notice: No secret key. • Should be very fast to compute, yet hard to find coliding pairs (impossible if P=NP). • Usually defined by: • Compression function mapping n bits (e.g. 512) to m bits (e.g 160), m < n.

  18. Extending to Longer Strings h(M) Seed H H H  M1 M2 Mk D --> R (fixed sets, typically {0,1}n and {0,1}m )

  19. Extending the Domain (cont.) • The seed is usually constant • Typically, padding (including text length of original message) is used to ensure a multiple of n. • Claim: if the basic function H is collision resistant, then so is its extension.

  20. Lengths • Input message length should be arbitrary. In practice it is usually up to 264, which is good enough for all practical purposes. • Block length is usually 512 bits. • Output length should be at least 160 bits to prevent birthday attacks.

  21. Real-World Hash Functions • MD family (“message digest”) • MD-2 • MD-4 (full description in Stinson’s book) • MD-5 • SHA and SHA-1 (secure hash standard, 160 bits) (www.itl.nist.gov/fipspubs/fip180-1.htm) • RIPE-MD • SHA-256, 384 and 512 (proposed standards, longer digests)

  22. Basing MACs on Hash Functions • First goal: combine message and secret key, hash and produce MAC • Second goal: work with any cryptographic hash function • First attempt: MACk(m)=h(k,m) • Second attempt: MACk(m)=h(m,k)

  23. HMAC • Proposed in 1996 by [Bellare Canetti Krawczyk] • Internet engineering task force RFP • Receives as input a message m, a key k and a hash function h • Outputs a MAC by: • HMACk(m,h)= h(kopad, h(kipad,m)) • Theorem [BCK]: HMAC can be forged if and only if the underlying hash function is broken (collisions found). • FIPS Standard: The keyed hash message authentication code

  24. HMAC in Practice • SSL / TLS • WTLS • IPSec: • AH • ESP

  25. Back to Number Theory

  26. Quadratic Residues • An element x is a quadratic residue modulo n if there exists y such that y2x mod n • If x is a quadratic residue then so is –x mod n • If p is prime there are exactly (p-1)/2 quadratic residues • If p is prime, and g is a generator of the multiplicative group, the quadratic residues are even powers of g.

  27. One-Way Functions • A function f: DR is called one-way if: • Computing f(x) is “easy” • Computing f-1(y) for almost all the images is “hard” • Given the “real-world” definition of “hard” a one-way function may be a single function (e.g. SHA-1) • Given the theoretical definition, we refer to a family of one-way functions

  28. Example • The Domain is all the pairs of prime numbers. • The function is f(p,q) = pq • Multiplication is easy – naïve algorithm is O(n2) • Factoring is difficult – simple algorithm is O(2n/2). NFS and ECM are better but not polynomial. • The function f(p,q) = pq maintains length

  29. The Chinese Remainder Theorem • Given • x mod p • x mod q • Compute x mod pq • If gcd(p,q)=1 take ((x mod p) (q-1 mod p) q + (x mod q) (p-1 mod q) p) mod pq • x mod 3 = 2, x mod 5 = 3, 1/3 mod 5 = 2, 1/5 mod 3 = ½ mod 3 = 2 • (x mod p) (q-1 mod p) q = 2 * 2 * 5 = 20 • (x mod q) (p-1 mod q) p = 3 * 2 * 3 = 18, 38 mod 15 = 8

  30. The four different square roots modulo pq • Let x be a quadratic residue modulo pq • Then, x mod p is a quadratic residue and so is x mod q • x mod p has two roots mod p: y and p - y • x mod q has two roots mod q: z and q - z • Using the Chinese remainder theorem, we get four root modulo pq: A, B, pq – A, pq – B • (y,z) -> A, (p - y, q - z) -> pq – A • (y, q - z) -> B, (p – y, z) -> pq – B • gcd(A - B,np) = p

  31. Factoring Idea: square roots • Compute x2 mod np • Extract y = square root of x2 mod np • If y = x or y = np - x then useless • If not, x2 mod np = y2 mod np • then gcd(x - y, np) = p or gcd(x - y,np) = q • The square root extraction algorithm does not “know” if we started with x, np - x, y, or np - y

  32. Pollards rho (ρ) method • Imagine the following process mod p: • x0 – random • xi+1 = xi2+1 mod p • After p1/2 steps, we’ll find xi, xj such that xi = xj mod p. What this means is that the function f(x) = x2+1 mod p loops.

  33. Pollards rho (ρ) method • Imagine the following process mod pq: • x0 – random • xi+1 = xi2+1 mod pq • This will loop only after (pq)1/2 steps (modulo pq) • However, modulo p (or q) it will loop after p1/2 (or q1/2) steps • Given two values xi, xj, such that xi=xj mod p but xi <> xj mod pq, we have that gcd(xi - xj, pq) = p • Repeat: • x = x2 + 1 mod pq • y = (y2 +1)2 + 1 mod pq • If gcd(x - y, pq) > 1 then found factor

  34. More complex factoring ideas • A number is smooth with respect to the set of primes ≤ L if all prime factors are ≤ L • If a smooth number has all powers even then it is easy to extract a square root • Major idea: • Generate quadratic residues, one of whose roots is known • Compute a product of these quadratic residues which is smooth and has all powers even • Now, you have a 2nd root of this product, use it for factoring

  35. Quadratic Sieve Factoring • Determine a limit L • Generate random values x2 mod pq • Check them for smoothness, discard if not • This process can be done entirely distributed • Collect all smooth quadratic residues • Solve a set of linear equations over GF(2) • This can be done if the matrix is singular, i.e., if we have sufficiently many smooth quadratic residues • How many smooth quadratic residues are required?

More Related