Goal Ensure integrity of messages, even in presence of

Slides:



Advertisements
Similar presentations
ONE WAY FUNCTIONS SECURITY PROTOCOLS CLASS PRESENTATION.
Advertisements

Lecture 5: Cryptographic Hashes
Lecture 7 Overview. Advanced Encryption Standard 10, 12, 14 rounds for 128, 192, 256 bit keys – Regular Rounds (9, 11, 13) – Final Round is different.
Hash Function. What are hash functions? Just a method of compressing strings – E.g., H : {0,1}*  {0,1} 160 – Input is called “message”, output is “digest”
ECE454/CS594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2011.
Digital Signatures and Hash Functions. Digital Signatures.
Session 4 Asymmetric ciphers.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
1 Chapter 5 Hashes and Message Digests Instructor: 孫宏民 Room: EECS 6402, Tel: , Fax :
The RSA Cryptosystem and Factoring Integers (II) Rong-Jaye Chen.
Chapter 4  Hash Functions 1 Overview  Cryptographic hash functions are functions that: o Map an arbitrary-length (but finite) input to a fixed-size output.
CMSC 414 Computer and Network Security Lecture 5 Jonathan Katz.
Kemal AkkayaWireless & Network Security 1 Department of Computer Science Southern Illinois University Carbondale CS 591 – Wireless & Network Security Lecture.
Secure Hashing and DSS Sultan Almuhammadi ICS 454 Principles of Cryptography.
Introduction to Modern Cryptography Makeup Class Symmetric Encryption:
J. Wang. Computer Network Security Theory and Practice. Springer 2008 Chapter 4 Data Authentication Part I.
How cryptography is used to secure web services Josh Benaloh Cryptographer Microsoft Research.
Hash Functions Nathanael Paul Oct. 9, Hash Functions: Introduction Cryptographic hash functions –Input – any length –Output – fixed length –H(x)
CS526Topic 5: Hash Functions and Message Authentication 1 Computer Security CS 526 Topic 5 Cryptography: Cryptographic Hash Functions And Message Authentication.
Cryptography1 CPSC 3730 Cryptography Chapter 11, 12 Message Authentication and Hash Functions.
Computer Security CS 426 Lecture 3
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Lecture 15 Lecture’s outline Public algorithms (usually) that are each other’s inverse.
Lecture slides prepared for “Computer Security: Principles and Practice”, 2/e, by William Stallings and Lawrie Brown, Chapter 21 “Public-Key Cryptography.
Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
CMSC 414 Computer and Network Security Lecture 6 Jonathan Katz.
CS555Spring 2012/Topic 51 Cryptography CS 555 Topic 5: Pseudorandomness and Stream Ciphers.
How cryptography is used to secure web services Josh Benaloh Cryptographer Microsoft Research.
Introduction to Modern Cryptography Lecture 5 Number Theory: 1. Quadratic residues. 2. The discrete log problem. Intro to Public Key Cryptography Diffie.
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
EE515/IS523 Think Like an Adversary Lecture 4 Crypto in a Nutshell Yongdae Kim.
Message Authentication Code July Message Authentication Problem  Message Authentication is concerned with:  protecting the integrity of a message.
Lecture 4.1: Hash Functions, and Message Authentication Codes CS 436/636/736 Spring 2015 Nitesh Saxena.
Cryptography Wei Wu. Internet Threat Model Client Network Not trusted!!
Chapter 21 Public-Key Cryptography and Message Authentication.
CS555Spring 2012/Topic 111 Cryptography CS 555 Topic 11: Encryption Modes and CCA Security.
11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 11 Message Integrity and Message Authentication.
1 Hash Functions. 2 A hash function h takes as input a message of arbitrary length and produces as output a message digest of fixed length
11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 11 Message Integrity and Message Authentication.
Cryptographic Hash Functions and Protocol Analysis
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Modern Cryptography.
NEW DIRECTIONS IN CRYPTOGRAPHY Made Harta Dwijaksara, Yi Jae Park.
Hash Functions Ramki Thurimella. 2 What is a hash function? Also known as message digest or fingerprint Compression: A function that maps arbitrarily.
Lecture 4.1: Hash Functions, and Message Authentication Codes CS 436/636/736 Spring 2014 Nitesh Saxena.
Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.3 Hash Functions.
Computer Science and Engineering Computer System Security CSE 5339/7339 Lecture 11 September 23, 2004.
CS426Fall 2010/Lecture 51 Computer Security CS 426 Lecture 5 Cryptography: Cryptographic Hash Function.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
Hashes Lesson Introduction ●The birthday paradox and length of hash ●Secure hash function ●HMAC.
IT 221: Introduction to Information Security Principles Lecture 5: Message Authentications, Hash Functions and Hash/Mac Algorithms For Educational Purposes.
Message Authentication Codes CSCI 5857: Encoding and Encryption.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 13.Message Authentication.
Cryptography Hyunsung Kim, PhD University of Malawi, Chancellor College Kyungil University February, 2016.
Data Integrity / Data Authentication. Definition Authentication (Signature) algorithm - A Verification algorithm - V Authentication key – k Verification.
Key Exchange in Systems VPN usually has two phases –Handshake protocol: key exchange between parties sets symmetric keys –Traffic protocol: communication.
Cryptographic Hash Function. A hash function H accepts a variable-length block of data as input and produces a fixed-size hash value h = H(M). The principal.
@Yuan Xue 285: Network Security CS 285 Network Security Hash Algorithm Yuan Xue Fall 2012.
Chapter 12 – Hash Algorithms
Cryptographic Hash Functions
Cryptographic Hash Functions
Cryptographic Hash Functions Part I
Cryptography Lecture 13.
Introduction to Symmetric-key and Public-key Cryptography
Cryptographic Hash Functions Part I
Lecture 4.1: Hash Functions, and Message Authentication Codes
Cryptography Lecture 14.
Cryptography Lecture 13.
Cryptography Lecture 13.
Presentation transcript:

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 systems often required to provide both.

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

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)

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

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))

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.

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.

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

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.

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 .

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 function efficiently.

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).

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.

Collision Resistance A hash function h: D  R is 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R is called strongly collision resistant if it is hard to find x, x’ such that x’x but h(x)=h(x’)

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 D at random, the probability that two of them are mapped to the same image is greater than 0.5.

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.

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 )

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.

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.

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)

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)

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

HMAC in Practice SSL / TLS WTLS IPSec: AH ESP

Back to Number Theory

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.

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

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

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

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

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

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.

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

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

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?