Cryptography Overview CS155. Cryptography Is A tremendous tool The basis for many security mechanisms Is not The solution to all security problems Reliable.

Slides:



Advertisements
Similar presentations
MAC Raushan. DES simple fiestel network 3131 PlainText Blocks 2*4=8bits 31 f f =0011 xor 0011=0000 = 0 f(r,k)=(2*r+k^2)%8 f(1,5)=(2*1+5^2)%8=3 xor 3 3.
Advertisements

“Advanced Encryption Standard” & “Modes of Operation”
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”
CS 483 – SD SECTION BY DR. DANIYAL ALGHAZZAWI (3) Information Security.
Internet and Intranet Protocols and Applications Lecture 9a: Secure Sockets Layer (SSL) March, 2004 Arthur Goldberg Computer Science Department New York.
Cryptography: Review Day David Brumley Carnegie Mellon University.
1 PRPs and PRFs CS255: Winter Abstract ciphers: PRPs and PRFs, 2.Security models for encryption, 3.Analysis of CBC and counter mode Dan Boneh, Stanford.
Authenticated Encryption and Cryptographic Network Protocols David Brumley Carnegie Mellon University.
CS 6262 Spring 02 - Lecture #7 (Tuesday, 1/29/2002) Introduction to Cryptography.
1 Introduction CSE 5351: Introduction to cryptography Reading assignment: Chapter 1 of Katz & Lindell.
Dan Boneh Message Integrity A Parallel MAC Online Cryptography Course Dan Boneh.
1 Brief PRP-PRF Recap CS255 Winter ‘06. 2 PRPs and PRFs PRF: F: K  X  Y such that: exists “efficient” algorithm to eval. F(k,x) PRP: E: K  X  X such.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
1 Message Integrity CS255 Winter ‘06. 2 Message Integrity Goal: provide message integrity. No confidentiality. –ex: Protecting public binaries on disk.
Chapter 5 Cryptography Protecting principals communication in systems.
Kemal AkkayaWireless & Network Security 1 Department of Computer Science Southern Illinois University Carbondale CS 591 – Wireless & Network Security Lecture.
Overview of Cryptography Anupam Datta CMU Fall A: Foundations of Security and Privacy.
Cryptography (continued). Enabling Alice and Bob to Communicate Securely m m m Alice Eve Bob m.
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)
Lecture 23 Symmetric Encryption
Chapter 13: Electronic Commerce and Information Security Invitation to Computer Science, C++ Version, Fourth Edition SP09: Contains security section (13.4)
1 Introduction to Information Security , Spring 2015 Lecture 6: Applied cryptography: symmetric Eran Tromer Slides credit: John Mitchell, Stanford.
CN8816: Network Security1 Confidentiality, Integrity & Authentication Confidentiality - Symmetric Key Encryption Data Integrity – MD-5, SHA and HMAC Public/Private.
Dan Boneh Public Key Encryption from trapdoor permutations Public key encryption: definitions and security Online Cryptography Course Dan Boneh.
Copyright © 2003 T. Trappenberg Overview E 1 E1. Security Module 1 Technology: GR01E - Electronic Commerce Overview.
© Neeraj Suri EU-NSF ICT March 2006 DEWSNet Dependable Embedded Wired/Wireless Networks MUET Jamshoro Computer Security: Principles and Practice Slides.
Lecture 19 Page 1 CS 111 Online Symmetric Cryptosystems C = E(K,P) P = D(K,C) E() and D() are not necessarily the same operations.
Dan Boneh Public key encryption from Diffie-Hellman The ElGamal Public-key System Online Cryptography Course Dan Boneh.
Message Authentication Requirements Disclosure Release of message contents to any person or process not possessing the appropriate cryptographic key Traffic.
Chapter 20 Symmetric Encryption and Message Confidentiality.
How cryptography is used to secure web services Josh Benaloh Cryptographer Microsoft Research.
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
Lecture 3.4: Public Key Cryptography IV CS 436/636/736 Spring 2013 Nitesh Saxena.
C HAPTER 15 MACs and Signatures Slides adapted from "Foundations of Security: What Every Programmer Needs To Know" by Neil Daswani, Christoph Kern, and.
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.
4 th lecture.  Message to be encrypted: HELLO  Key: XMCKL H E L L O message 7 (H) 4 (E) 11 (L) 11 (L) 14 (O) message + 23 (X) 12 (M) 2 (C) 10 (K) 11.
Basic Cryptography 1. What is cryptography? Cryptography is a mathematical method of protecting information –Cryptography is part of, but not equal to,
Cryptography Wei Wu. Internet Threat Model Client Network Not trusted!!
CS555Spring 2012/Topic 111 Cryptography CS 555 Topic 11: Encryption Modes and CCA Security.
Computer Security: Principles and Practice First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown Chapter 2 – Cryptographic.
Dan Boneh Public key encryption from Diffie-Hellman The ElGamal Public-key System Online Cryptography Course Dan Boneh.
CS426Fall 2010/Lecture 61 Computer Security CS 426 Lecture 6 Cryptography: Message Authentication Code.
Lecture 2: Introduction to Cryptography
Cryptography 1 Crypto Cryptography 2 Crypto  Cryptology  The art and science of making and breaking “secret codes”  Cryptography  making “secret.
Lecture 23 Symmetric Encryption
Lecture 5.1: Message Authentication Codes, and Key Distribution
Cryptography: Review Day David Brumley Carnegie Mellon University.
Presentation Road Map 1 Authenticated Encryption 2 Message Authentication Code (MAC) 3 Authencryption and its Application Objective Modes of Operation.
Dan Boneh Introduction Course Overview Online Cryptography Course Dan Boneh.
IT 221: Introduction to Information Security Principles Lecture 5: Message Authentications, Hash Functions and Hash/Mac Algorithms For Educational Purposes.
Dan Boneh Public Key Encryption from trapdoor permutations Constructions Online Cryptography Course Dan Boneh Goal: construct chosen-ciphertext secure.
CS555Spring 2012/Topic 151 Cryptography CS 555 Topic 15: HMAC, Combining Encryption & Authentication.
Dan Boneh Authenticated Encryption Constructions from ciphers and MACs Online Cryptography Course Dan Boneh.
@Yuan Xue CS 285 Network Security Secure Socket Layer Yuan Xue Fall 2013.
@Yuan Xue 285: Network Security CS 285 Network Security Message Authentication Code Data integrity + Source authentication.
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.
1 Introduction to Information Security , Spring 2016 Lecture 3: Applied cryptography: symmetric Zvi Ostfeld Slides credit: Eran Tromer.
Lecture 3 Overview of Cryptography A Practitioner Perspective
PRPs and PRFs CS255: Winter 2017
Security through Encryption
Introduction to Symmetric-key and Public-key Cryptography
Topic 13: Message Authentication Code
Cryptography Lecture 26.
Review of Cryptography: Symmetric and Asymmetric Crypto Advanced Network Security Peter Reiher August, 2014.
Secret-Key Encryption
Presentation transcript:

Cryptography Overview CS155

Cryptography Is A tremendous tool The basis for many security mechanisms Is not The solution to all security problems Reliable unless implemented properly Reliable unless used properly Something you should try to invent or implement yourself

Kerckhoff’s principle A cryptosystem should be secure even if everything about the system, except the secret key, is public knowledge.

Goal 1:secure communication Step 1: Session setup to exchange key Step 2: encrypt data HTTPS

5 Goal 2: Protected files Disk File 1 File 2 Alice No eavesdropping No tampering Analogous to secure communication: Alice today sends a message to Alice tomorrow

Symmetric Cryptography Assumes parties already share a secret key

Building block: sym. encryption E, D: cipher k: secret key (e.g. 128 bits) m, c: plaintext, ciphertext n: nonce (aka IV) publicly known Encryption algorithm is publicly known Never use a proprietary cipher Alice E m, n E(k,m,n)=c Bob D c, n D(k,c,n)=m k k nonce

Use Cases Single use key: (one time key) Key is only used to encrypt one message encrypted new key generated for every No need for nonce (set to 0) Multi use key: (many time key) Key used to encrypt multiple messages files: same key used to encrypt many files

9 First example: One Time Pad (single use key) Vernam (1917) Shannon ‘49: OTP is “secure” against ciphertext-only attacks Key: Plaintext:  Ciphertext:

10 Stream ciphers (single use key) Problem: OTP key is as long the message Solution: Pseudo random key -- stream ciphers Stream ciphers: RC4 (126 MB/sec), Salsa20/12 (643 MB/sec) key PRG message  ciphertext c  PRG (k)  m

Dangers in using stream ciphers One time key !! “Two time pad” is insecure: C 1  m 1  PRG(k) C 2  m 2  PRG(k) Eavesdropper does: C 1  C 2  m 1  m 2 Enough redundant information in English that: m 1  m 2  m 1, m 2

Block ciphers: crypto work horse E, D CT Block n Bits PT Block n Bits Key k Bits Canonical examples: 1.3DES: n= 64 bits, k = 168 bits 2.AES: n=128 bits, k = 128, 192, 256 bits IV handled as part of PT block

13 Building a block cipher Input: (m, k) Repeat simple “mixing” operation several times  DES:Repeat 16 times:  AES-128:Mixing step repeated 10 times Difficult to design: must resist subtle attacks  differential attacks, linear attacks, brute-force, … m L  m R m R  m L  F(k,m R )

Block Ciphers Built by Iteration R(k,m): round function for DES (n=16), for AES-128 (n=10) key k key expansion k1k1 k2k2 k3k3 knkn R(k 1,  )R(k 2,  )R(k 3,  )R(k n,  ) mc

15 Incorrect use of block ciphers Electronic Code Book (ECB): Problem: if m 1 =m 2 then c 1 =c 2 PT: CT: m1m1 m2m2 c1c1 c2c2

16 In pictures

Correct use of block ciphers I: CBC mode E(k,  ) m[0]m[1]m[2]m[3]IV  E(k,  )  c[0]c[1]c[2]c[3]IV ciphertext E a secure PRP. Cipher Block Chaining with random IV: Q: how to do decryption?

Use cases: how to choose an IV Single use key: no IV needed (IV=0) Multi use key: (CPA Security) Best: use a fresh random IV for every message Can use unique IV(e.g counter) but then first step in CBC must be IV’  E(k 1,IV) benefit: may save transmitting IV with ciphertext 18

CBC with Unique IVs E(k,  ) m[0]m[1]m[2]m[3]  E(k,  )  c[0]c[1]c[2]c[3]IV ciphertext IV E(k 1,  ) IV ′ unique IV means: (k,IV) pair is used for only one message. generate unpredictable IV’ as E(k 1,IV)

20 In pictures

21 Correct use of block ciphers II: CTR mode Counter mode with a random IV: (parallel encryption) m[0]m[1]… E(k,IV)E(k,IV+1)… m[L] E(k,IV+L)  c[0]c[1]…c[L] IV ciphertext Why are these modes secure? not today.

Performance: Crypto [ Wei Dai ] Intel Core 2 (on Windows Vista) CipherBlock/key size Speed (MB/sec) RC4 126 Salsa20/ DES64/ AES/GCM128/ AES is about 8x faster with AES-NI : Intel Westmere and onwards

Data integrity

Message Integrity: MACs Goal: message integrity. No confidentiality. ex: Protecting public binaries on disk. 24 AliceBob k k Message mtag Generate tag: tag  S(k, m) Verify tag: V(k, m, tag) = `yes’ ? note: non-keyed checksum (CRC) is an insecure MAC !!

Secure MACs Attacker information: chosen message attack for m 1,m 2,…,m q attacker is given t i  S(k,m i ) Attacker’s goal: existential forgery. produce some new valid message/tag pair (m,t). (m,t)  { (m 1,t 1 ), …, (m q,t q ) } A secure PRF gives a secure MAC: S(k,m) = F(k,m) V(k,m,t): `yes’ if t = F(k,m) and `no’ otherwise.

Construction 1: ECBC 26 Raw CBC E(k,  ) m[0]m[1]m[2]m[3]  E(k,  )  E(k 1,  ) tag key = (k, k 1 )

27 Construction 2: HMAC (Hash-MAC) Most widely used MAC on the Internet. H: hash function. example: SHA-256 ; output is 256 bits Building a MAC out of a hash function: Standardized method: HMAC S( k, m ) = H( k  opad || H( k  ipad || m ))

SHA-256: Merkle-Damgard h(t, m[i]): compression function Thm 1: if h is collision resistant then so is H “Thm 2”: if h is a PRF then HMAC is a PRF hhh m[0]m[1]m[2]m[3] h IV H(m)

29 Construction 3: PMAC – parallel MAC ECBC and HMAC are sequential. PMAC: m[0]m[1]m[2]m[3]  F(k,  ) F(k 1,  ) tag  P(k,0)P(k,1) P(k,2) P(k,3)

Why are these MAC constructions secure? … not today – take CS255 Why the last encryption step in ECBC? CBC (aka Raw-CBC) is not a secure MAC: Given tag on a message m, attacker can deduce tag for some other message m’ How: good crypto exercise … 30

Authenticated Encryption: Encryption + MAC

Combining MAC and ENC (CCA) Option 1: MAC-then-Encrypt (SSL) Option 2: Encrypt-then-MAC (IPsec) Option 3: Encrypt-and-MAC (SSH) Msg M MAC Enc K E MAC(M,K I ) Msg M Enc K E MAC MAC(C, K I ) Msg M Enc K E MAC MAC(M, K I ) Encryption key K E MAC key = K I Secure for all secure primitives

OCB More efficient authenticated encryption m[0]m[1]m[2]m[3]  E(k,  ) P(N,k,0)P(N,k,1) P(N,k,2) P(N,k,3)  P(N,k,0)P(N,k,1) P(N,k,2) P(N,k,3) c[0]c[1]c[2]c[3] checksum E(k,  )   c[4] P(N,k,0) auth offset codebook mode Rogaway, …

Public-key Cryptography

Public key encryption: (Gen, E, D) E E D D pk mccm sk Gen

Applications Session setup (for now, only eavesdropping security) Non-interactive applications: (e.g. ) Bob sends to Alice encrypted using pk alice Note: Bob needs pk alice (public key management) Generate (pk, sk) Alice choose random x (e.g. 48 bytes) choose random x (e.g. 48 bytes) Bob pk E(pk, x) x

Applications Encryption in non-interactive settings: Encrypted File Systems Bob write E(k F, File) E(pk A, K F ) E(pk B, K F ) Alice read File sk A

Applications Encryption in non-interactive settings: Key escrow: data recovery without Bob’s key Bob write E(k F, File) E(pk escrow, K F ) E(pk B, K F ) Escrow Service Escrow Service sk escrow

Trapdoor functions (TDF) Def: a trapdoor func. XY is a triple of efficient algs. (G, F, F -1 ) G(): randomized alg. outputs key pair (pk, sk) F(pk, ⋅ ): det. alg. that defines a func. X Y F -1 (sk, ⋅ ): defines a func. Y X that inverts F(pk, ⋅ ) Security: F(pk, ⋅ ) is one-way without sk

Public-key encryption from TDFs (G, F, F -1 ): secure TDF X Y (E s, D s ) : symm. auth. encryption with keys in K H: X K a hash function We construct a pub-key enc. system (G, E, D): Key generation G: same as G for TDF

Public-key encryption from TDFs (G, F, F -1 ): secure TDF X Y (E s, D s ) : symm. auth. encryption with keys in K H: X K a hash function E ( pk, m ) : x X, y F(pk, x) k H(x), c E s (k, m) output (y, c) D ( sk, (y,c) ) : x F -1 (sk, y), k H(x), m D s (k, c) output m R

In pictures: Security Theorem: If (G, F, F -1 ) is a secure TDF, (E s, D s ) provides auth. enc. and H: X K is a “random oracle” then (G,E,D) is CCA ro secure. F(pk, x) E s ( H(x), m ) headerbody

Digital Signatures Public-key encryption Alice publishes encryption key Anyone can send encrypted message Only Alice can decrypt messages with this key Digital signature scheme Alice publishes key for verifying signatures Anyone can check a message signed by Alice Only Alice can send signed messages

Digital Signatures from TDPs (G, F, F -1 ): secure TDP X X H: M X a hash function Security: existential unforgeability under a chosen message attack (in the random oracle model) Sign ( sk, m ∈ X ) : output sig = F -1 ( sk, H(m) ) Verify ( pk, m, sig ) : output 1 if H(m) = F(pk, sig) 0 otherwise

Public-Key Infrastructure (PKI) Anyone can send Bob a secret message Provided they know Bob’s public key How do we know a key belongs to Bob? If imposter substitutes another key, can read Bob’s mail One solution: PKI Trusted root Certificate Authority (e.g. Symantec)  Everyone must know the verification key of root CA  Check your browser; there are hundreds!! Root authority signs intermediate CA Results in a certificate chain

Back to SSL/TLS C Version, Crypto choice, nonce Version, Choice, nonce, Signed certificate containing server’s public key Ks S Secret key K encrypted with server’s key Ks Hash of sequence of messages switch to negotiated cipher data transmission

Limitations of cryptography Cryptography works when used correctly !! … but is not the solution to all security problems XKCD 538