Outline. From last time. Feistel cipher. Some DES history DES. Block ciphers and modes of operation

Similar documents
Outline. Block cipher, basic idea. From last time. Pseudorandom permutation. Confusion and diffusion. Block ciphers and modes of operation

CIS 4360 Secure Computer Systems Symmetric Cryptography

CSE 127: Computer Security Cryptography. Kirill Levchenko

Computer Security. 08. Cryptography Part II. Paul Krzyzanowski. Rutgers University. Spring 2018

Unit 8 Review. Secure your network! CS144, Stanford University

Lecture 1 Applied Cryptography (Part 1)

Computer Security. 08r. Pre-exam 2 Last-minute Review Cryptography. Paul Krzyzanowski. Rutgers University. Spring 2018

Public-Key Cryptography. Professor Yanmin Gong Week 3: Sep. 7

Cryptographic Hash Functions

Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2010

3 Symmetric Key Cryptography 3.1 Block Ciphers Symmetric key strength analysis Electronic Code Book Mode (ECB) Cipher Block Chaining Mode (CBC) Some

Distributed Systems. 26. Cryptographic Systems: An Introduction. Paul Krzyzanowski. Rutgers University. Fall 2015

CPSC 467: Cryptography and Computer Security

CSCI 454/554 Computer and Network Security. Topic 5.2 Public Key Cryptography

Study Guide to Mideterm Exam

Outline. CSCI 454/554 Computer and Network Security. Introduction. Topic 5.2 Public Key Cryptography. 1. Introduction 2. RSA

Introduction to Cryptography. Lecture 6

Winter 2011 Josh Benaloh Brian LaMacchia

Tuesday, January 17, 17. Crypto - mini lecture 1

Elements of Cryptography and Computer and Networking Security Computer Science 134 (COMPSCI 134) Fall 2016 Instructor: Karim ElDefrawy

Introduction to Public-Key Cryptography

Outline. Public Key Cryptography. Applications of Public Key Crypto. Applications (Cont d)

Lecture 20 Public key Crypto. Stephen Checkoway University of Illinois at Chicago CS 487 Fall 2017 Slides from Miller and Bailey s ECE 422

Cryptography (Overview)

Message authentication codes

n-bit Output Feedback

Cryptographic hash functions and MACs

L13. Reviews. Rocky K. C. Chang, April 10, 2015

Public Key Algorithms

Digital Signatures. KG November 3, Introduction 1. 2 Digital Signatures 2

Cryptography. Recall from last lecture. [Symmetric] Encryption. How Cryptography Helps. One-time pad. Idea: Computational security

Summary on Crypto Primitives and Protocols

Lecture 2 Applied Cryptography (Part 2)

Computer Security. 10r. Recitation assignment & concept review. Paul Krzyzanowski. Rutgers University. Spring 2018

RSA. Public Key CryptoSystem

More on Cryptography CS 136 Computer Security Peter Reiher January 19, 2017

CS155. Cryptography Overview

A hash function is strongly collision-free if it is computationally infeasible to find different messages M and M such that H(M) = H(M ).

Data Integrity. Modified by: Dr. Ramzi Saifan

Homework 2. Out: 09/23/16 Due: 09/30/16 11:59pm UNIVERSITY OF MARYLAND DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING

Computer Security 3/23/18

Lecture 6: Symmetric Cryptography. CS 5430 February 21, 2018

David Wetherall, with some slides from Radia Perlman s security lectures.

Stream Ciphers and Block Ciphers

Introduction to Network Security Missouri S&T University CPE 5420 Data Integrity Algorithms

CS 161 Computer Security

Hashes, MACs & Passwords. Tom Chothia Computer Security Lecture 5

CS408 Cryptography & Internet Security

Overview. Public Key Algorithms I

Introduction to Cryptography Lecture 7

CSE484 Final Study Guide

Symmetric Encryption. Thierry Sans

Lecture 6 - Cryptography

symmetric cryptography s642 computer security adam everspaugh

Cryptography Basics. IT443 Network Security Administration Slides courtesy of Bo Sheng

Chapter 9 Public Key Cryptography. WANG YANG

Public-Key Encryption, Key Exchange, Digital Signatures CMSC 23200/33250, Autumn 2018, Lecture 7

Cryptography 2017 Lecture 3

Cryptographic Hash Functions. Rocky K. C. Chang, February 5, 2015

CSC 5930/9010 Modern Cryptography: Cryptographic Hashing

CSC 474/574 Information Systems Security

ASYMMETRIC (PUBLIC-KEY) ENCRYPTION. Mihir Bellare UCSD 1

Message Authentication Codes and Cryptographic Hash Functions

Basics of Cryptography

9/30/2016. Cryptography Basics. Outline. Encryption/Decryption. Cryptanalysis. Caesar Cipher. Mono-Alphabetic Ciphers

What did we talk about last time? Public key cryptography A little number theory

This chapter continues our overview of public-key cryptography systems (PKCSs), and begins with a description of one of the earliest and simplest

Acronyms. International Organization for Standardization International Telecommunication Union ITU Telecommunication Standardization Sector

Cryptographic Hash Functions

Encryption. INST 346, Section 0201 April 3, 2018

Introduction to Cryptography Lecture 7

ASYMMETRIC (PUBLIC-KEY) ENCRYPTION. Mihir Bellare UCSD 1

Cryptographic Primitives A brief introduction. Ragesh Jaiswal CSE, IIT Delhi

Lecture 5. Cryptographic Hash Functions. Read: Chapter 5 in KPS

Data Integrity & Authentication. Message Authentication Codes (MACs)

Introduction to Cryptography. Steven M. Bellovin September 27,

Introduction to Cryptography and Security Mechanisms: Unit 5. Public-Key Encryption

CS155. Cryptography Overview

Understanding Cryptography A Textbook for Students and Practitioners by Christof Paar and Jan Pelzl

Appendix A: Introduction to cryptographic algorithms and protocols

Data Integrity & Authentication. Message Authentication Codes (MACs)

Cryptography MIS

1 Achieving IND-CPA security

page 1 Introduction to Cryptography Benny Pinkas Lecture 3 November 18, 2008 Introduction to Cryptography, Benny Pinkas

Feedback Week 4 - Problem Set

CS408 Cryptography & Internet Security

Analysis, demands, and properties of pseudorandom number generators

Network Security Essentials Chapter 2

Public Key Cryptography

Key Exchange. Secure Software Systems

Lecture 18 Message Integrity. Stephen Checkoway University of Illinois at Chicago CS 487 Fall 2017 Slides from Miller & Bailey s ECE 422

Security: Cryptography

CSCE 715: Network Systems Security

6 Block Ciphers. 6.1 Block Ciphers CA642: CRYPTOGRAPHY AND NUMBER THEORY 1

How many DES keys, on the average, encrypt a particular plaintext block to a particular ciphertext block?

ENEE 459-C Computer Security. Message authentication

Applied Cryptography and Computer Security CSE 664 Spring 2018

Solutions to exam in Cryptography December 17, 2013

CPSC 467b: Cryptography and Computer Security

Kurose & Ross, Chapters (5 th ed.)

Transcription:

Outline CSci 5271 Introduction to Computer Security Day 15: Cryptography part 2: public-key Stephen McCamant University of Minnesota, Computer Science & Engineering From last time Goal: bootstrap from small secret key to secure channel Approach: use good crypto primitives Observation: easier to design than to break Considered stream ciphers, didn t see ones we liked Another primitive: block cipher Feistel cipher Split block in half, operate in turn: (L i+1; R i+1) = (R i ; L i F(R i ; K i )) Key advantage: F need not be invertible Also saves space in hardware Luby-Rackoff: if F is pseudo-random, 4 or more rounds gives a strong PRP DES Some DES history Data Encryption Standard: AES predecessor 1977-2005 64-bit block, 56-bit key Implementable in 70s hardware, not terribly fast in software Triple DES variant still used in places Developed primarily at IBM, based on an earlier cipher named Lucifer Final spec helped and helped by the NSA Argued for smaller key size S-boxes tweaked to avoid a then-secret attack Eventually victim to brute-force attack

DES brute force history Double encryption? 1977 est. $20m cost custom hardware 1993 est. $1m cost custom hardware 1997 distributed software break 1998 $250k built ASIC hardware 2006 $10k FPGAs 2012 as-a-service against MS-CHAPv2 Combine two different block ciphers? Belt and suspenders Anderson: don t do it FS&K: could do it, not a recommendation Maurer and Massey (J.Crypt 93): might only be as strong as first cipher Modes of operation ECB How to build a cipher for arbitrary-length data from a block cipher Many approaches considered For some reason, most have three-letter acronyms More recently: properties susceptible to relative proof Electronic CodeBook Split into blocks, apply cipher to each one individually Leaks equalities between plaintext blocks Almost never suitable for general use Do not use ECB CBC Cipher Block Chaining C i = E K (P i C i-1) Probably most popular in current systems Plaintext changes propagate forever, ciphertext changes only two blocks

CBC: getting an IV Stream modes: OFB, CTR C 0 is called the initialization vector (IV) Must be known for decryption IV should be random-looking To prevent first-block equalities from leaking (lesser version of ECB problem) Common approaches Generate at random Encrypt a unique value ( nonce ) Output FeedBack: produce keystream by repeatedly encrypting the IV Danger: collisions lead to repeated keystream Counter: produce from encryptions of an incrementing value Recently becoming more popular: allows parallelization and random access Outline Ideal model Ideal crypto hash function: pseudorandom function Arbitrary input, fixed-size output Simplest kind of elf in box, theoretically very convenient But large gap with real systems: better practice is to target particular properties Kinds of attacks Pre-image, inversion : given y, find x such that H(x) = y Second preimage, targeted collision: given x, H(x), find x 6= 0 x such that H(x 0 ) = H(x) (Free) collision: find x 1, x 2 such that H(x 1 ) = H(x 2 ) Birthday paradox and attack There are almost certainly two people in this classroom with the same birthday n people have n = (n 2 ) pairs 2 So only about p 365 expected for collision Birthday attack finds collisions in any function

Security levels Not cryptographic hash functions For function with k-bit output: Preimage and second preimage should have complexity 2 k Collision has complexity 2 k=2 Conservative: use hash function twice as big as block cipher Though if you re paranoid, cipher blocks can collide too The ones you probably use for hash tables CRCs, checksums Output too small, but also not resistant to attack E.g., CRC is linear and algebraically nice Short hash function history On the way out: MD5 (128 bit) Flaws known, collision-finding now routine SHA(-0): first from NIST/NSA, quickly withdrawn Likely flaw discovered 3 years later SHA-1: fixed SHA-0, 160-bit output. Collision attacks with complexity around 2 60 No collisions yet publicly demonstrated Length extension problem MD5, SHA1, etc., computed left to right over blocks Can sometimes compute H(a k b) in terms of H(a) k means bit string concatenation Makes many PRF-style constructions insecure SHA-2 and SHA-3 SHA-2: evolutionary, larger, improvement of SHA-1 Exists as SHA-f224; 256; 384; 512g But still has length-extension problem SHA-3: chosen recently in open competition like AES Formerly known as Keccak, official standard Aug. 2015 New design, fixes length extension Not yet very widely used MAC: basic idea Message authentication code: similar to hash function, but with a key Adversary without key cannot forge MACs Strong definition: adversary cannot forge anything, even given chosen-message MACs on other messages

CBC-MAC construction Same process as CBC encryption, but: Start with IV of 0 Return only the last ciphertext block Both these conditions needed for security For fixed-length messages (only), as secure as the block cipher HMAC construction H(K k M): insecure due to length extension Still not recommended: H(M k K), H(K k M k K) HMAC: H(K a k H(K b k M)) Standard a = 0x5c, b = 0x36 Probably most widely used MAC Outline Midterm distribution Upcoming things Midterm solutions: delayed until at least Friday Project progress reports: due Wednesday 11/4 Ex. 3: covering crypto, coming soon HA2: in preparation Relates to network and web security No week-by-week patching Groups can but need not be same as HA1 Outline

Session keys Don t use your long term password, etc., directly as a key Instead, session key used for just one channel In practice, usually obtained with public-key crypto Separate keys for encryption and MACing Order of operations Encrypt and MAC ( in parallel ) Safe only under extra assumptions on the MAC Encrypt then MAC Has cleanest formal safety proof MAC then Encrypt Preferred by FS&K for some practical reasons Can also be secure Authenticated encryption modes Encrypting and MACing as separate steps is about twice as expensive as just encrypting Authenticated encryption modes do both at once Recent (circa 2000) innovation, many variants NIST-standardized and unpatented: Galois Counter Mode (GCM) Ordering and message numbers Also don t want attacker to be able to replay or reorder messages Simple approach: prefix each message with counter Discard duplicate/out-of-order messages Padding Padding oracle attack Adjust message size to match multiple of block size To be reversible, must sometimes make message longer E.g.: for 16-byte block, append either 1, or 2 2, or 3 3 3, up to 16 16 bytes Have to be careful that decoding of padding does not leak information E.g., spend same amount of time MACing and checking padding, whether or not padding is right Remote timing attack against CBC TLS published 2013

Don t actually reinvent the wheel This is all implemented carefully in OpenSSL, SSH, etc. Good to understand it, but rarely sensible to reimplement it You ll probably miss at least one of decades worth of attacks Outline Pre-history of public-key crypto First invented in secret at GCHQ Proposed by Ralph Merkle for UC Berkeley grad. security class project First attempt only barely practical Professor didn t like it Merkle then found more sympathetic Stanford collaborators named Diffie and Hellman Box and locks analogy Alice wants to send Bob a gift in a locked box They don t share a key Can t send key separately, don t trust UPS Box locked by Alice can t be opened by Bob, or vice-versa Box and locks analogy Protocol with clip art Alice wants to send Bob a gift in a locked box They don t share a key Can t send key separately, don t trust UPS Box locked by Alice can t be opened by Bob, or vice-versa Math perspective: physical locks commute

Protocol with clip art Protocol with clip art Protocol with clip art Public key primitives Public-key encryption (generalizes block cipher) Separate encryption key EK (public) and decryption key DK (secret) Signature scheme (generalizes MAC) Separate signing key SK (secret) and verification key VK (public) Modular arithmetic Generators and discrete log Fix modulus n, keep only remainders mod n mod 12: clock face; mod 2 32 : int +, -, and work mostly the same Division: see Exercise Set 1 Exponentiation: efficient by square and multiply Modulo a prime p, non-zero values and have a nice ( group ) structure g is a generator if g 0 ; g; g 2 ; g 3 ; : : : cover all elements Easy to compute x 7! g x Inverse, discrete logarithm, hard for large p

Diffie-Hellman key exchange Relationship to a hard problem Goal: anonymous key exchange Public parameters p, g; Alice and Bob have resp. secrets a, b Alice!Bob: A = g a (mod p) Bob!Alice: B = g b (mod p) Alice computes B a = g ba = k Bob computes A b = g ab = k We re not sure discrete log is hard (likely not even NP-complete), but it s been unsolved for a long time If discrete log is easy (e.g., in P), DH is insecure Converse might not be true: DH might have other problems Categorizing assumptions Math assumptions unavoidable, but can categorize E.g., build more complex scheme, shows it s as secure as DH because it has the same underlying assumption Commonly decisional (DDH) and computational (CDH) variants Key size, elliptic curves Need key sizes 10 times larger then security level Attacks shown up to about 768 bits Elliptic curves: objects from higher math with analogous group structure (Only tenuously connected to ellipses) Elliptic curve algorithms have smaller keys, about 2 security level Outline General description Public-key encryption (generalizes block cipher) Separate encryption key EK (public) and decryption key DK (secret) Signature scheme (generalizes MAC) Separate signing key SK (secret) and verification key VK (public)

RSA setup RSA encryption Choose n = pq, product of two large primes, as modulus n is public, but p and q are secret Compute encryption and decryption exponents e and d such that M ed = M (mod n) Public key is (n; e) Encryption of M is C = M e (mod n) Private key is (n; d) Decryption of C is C d = M ed = M (mod n) RSA signature Signing key is (n; d) Signature of M is S = M d (mod n) Verification key is (n; e) Check signature by S e = M de = M (mod n) Note: symmetry is a nice feature of RSA, not shared by other systems RSA and factoring We re not sure factoring is hard (likely not even NP-complete), but it s been unsolved for a long time If factoring is easy (e.g., in P), RSA is insecure Converse might not be true: RSA might have other problems Homomorphism Problems with vanilla RSA Multiply RSA ciphertexts ) multiply plaintexts This homomorphism is useful for some interesting applications Even more powerful: fully homomorphic encryption (e.g., both + and ) First demonstrated in 2009; still very inefficient Homomorphism leads to chosen-ciphertext attacks If message and e are both small compared to n, can compute M 1=e over the integers Many more complex attacks too

Hybrid encryption Padding, try #1 Public-key operations are slow In practice, use them just to set up symmetric session keys + Only pay RSA costs at setup time - Breaks at either level are fatal Need to expand message (e.g., AES key) size to match modulus PKCS#1 v. 1.5 scheme: prepend 00 01 FF FF.. FF Surprising discovery (Bleichenbacher 98): allows adaptive chosen ciphertext attacks on SSL Modern padding Much more complicated encoding schemes using hashing, random salts, Feistel-like structures, etc. Common examples: OAEP for encryption, PSS for signing Progress driven largely by improvement in random oracle proofs Simpler padding alternative Key encapsulation mechanism (KEM) For common case of public-key crypto used for symmetric-key setup Also applies to DH Choose RSA message r at random mod n, symmetric key is H(r) - Hard to retrofit, RSA-KEM insecure if e and r reused with different n Box and locks revisited Next time Alice and Bob s box scheme fails if an intermediary can set up two sets of boxes Man-in-the-middle (or middleperson) attack Real world analogue: challenges of protocol design and public key distribution Failures of cryptosystems Toward more paranoid crypto design