Cryptography Page Page 2 Cryptography Outline Introduction: terminology, cryptanalysis, security Primitives: one-way functions, trapdoors, …

Slides:



Advertisements
Similar presentations
15-853Page 1 CPS 214 Computer Networks and Distributed Systems Cryptography Basics RSA SSL SSH Kerberos.
Advertisements

CPS 290 Computer Security Network Tools Cryptography Basics CPS 290Page 1.
Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
Computer Science CSC 405By Dr. Peng Ning1 CSC 405 Introduction to Computer Security Topic 2. Basic Cryptography (Part II)
Session 4 Asymmetric ciphers.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Cryptographic Security.
Windows Core Security1© 2006 Microsoft Corp Cryptography: Helping Number Theorists Bring Home the Bacon Since 1977 Dan Shumow SDE Windows Core Security.
ECOMMERCE TECHNOLOGY FALL 2003 COPYRIGHT © 2003 MICHAEL I. SHAMOS Cryptography.
Csci5233 Computer Security & Integrity 1 Cryptography: Basics (2)
Introduction to Modern Cryptography Lecture 3 (1) Finite Groups, Rings and Fields (2) AES - Advanced Encryption Standard.
How cryptography is used to secure web services Josh Benaloh Cryptographer Microsoft Research.
Fall 2010/Lecture 311 CS 426 (Fall 2010) Public Key Encryption and Digital Signatures.
15-853:Algorithms in the Real World
ECE454/CS594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2011.
CN8816: Network Security1 Confidentiality, Integrity & Authentication Confidentiality - Symmetric Key Encryption Data Integrity – MD-5, SHA and HMAC Public/Private.
Introduction to Public Key Cryptography
Public Key Model 8. Cryptography part 2.
Andreas Steffen, , 4-PublicKey.pptx 1 Internet Security 1 (IntSi1) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications.
Chapter 12 Cryptography (slides edited by Erin Chambers)
Page 1 Secure Communication Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
296.3:Algorithms in the Real World
15-499Page :Algorithms and Applications Cryptography III and IV – Private Key Cryptosystems – Public Key Cryptosystems.
Private Key Algorithms RSA SSL
How cryptography is used to secure web services Josh Benaloh Cryptographer Microsoft Research.
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
Module 3 – Cryptography Cryptography basics Ciphers Symmetric Key Algorithms Public Key Algorithms Message Digests Digital Signatures.
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
CPS 290 Computer Security Network Tools Cryptography Basics CPS 290Page 1.
15-499Page :Algorithms and Applications Cryptography I – Introduction – Terminology – Some primitives – Some protocols.
DATA & COMPUTER SECURITY (CSNB414) MODULE 3 MODERN SYMMETRIC ENCRYPTION.
15-853Page :Algorithms in the Real World Cryptography.
15-499Page :Algorithms and Applications Cryptography II – Number theory (groups and fields)
Public Key Cryptography. Asymmetric encryption is a form of cryptosystem in which Encryption and decryption are performed using the different keys—one.
@Yuan Xue CS 285 Network Security Public-Key Cryptography Yuan Xue Fall 2012.
Practical Aspects of Modern Cryptography Josh Benaloh & Brian LaMacchia.
Basics of Cryptography
Attacks on Public Key Encryption Algorithms
Asymmetric-Key Cryptography
CPS 512 Distributed Systems
Information Security message M one-way hash fingerprint f = H(M)
School of Computer Science and Engineering Pusan National University
Public Key Encryption and Digital Signatures
Network Tools Cryptography Basics
Basic Network Encryption
Private Key Algorithms Key Exchange Protocols SSL
Information Security message M one-way hash fingerprint f = H(M)
ICS 454 Principles of Cryptography
مروري برالگوريتمهاي رمز متقارن(كليد پنهان)
Public Key Cryptography Diffie-Hellman, Discrete Log, RSA
PART VII Security.
Introduction to Symmetric-key and Public-key Cryptography
Information Security message M one-way hash fingerprint f = H(M)
Introduction to Modern Symmetric-key Ciphers
Cryptography: Basics (2)
15-853:Algorithms in the Real World
ICS 454 Principles of Cryptography
Private Key Algorithms Feistel Networks AES
Chapter 3 - Public-Key Cryptography & Authentication
Basic Network Encryption
Introduction to Modern Cryptography
Cryptography and Network Security Chapter 5 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Introduction to Cryptography
Modular Arithmetic RSA Analysis SSL/TLS
Private Key Algorithms Feistel Networks AES
Network Tools Cryptography Basics
Private Key Algorithms Feistel Networks AES
Introduction to Modern Cryptography
Presentation transcript:

Cryptography Page 1

296.3 Page 2 Cryptography Outline Introduction: terminology, cryptanalysis, security Primitives: one-way functions, trapdoors, … Protocols: digital signatures, key exchange,.. Private-Key Algorithms: AES, DES Public-Key Algorithms: Knapsack, RSA, El-Gamal, … Case Studies: SSL/TLS, Kerberos, Bitcoin

Page 3 Basic Cryptography Definitions Symmetric: Key 1 = Key 2 Asymmetric: Key 1  Key 2 Key 1 or Key 2 may be public depending on the protocol Encryption Decryption Key 1 Key 2 Cyphertext C C = E key1 (M) M = D key2 (C) Original Plaintext M Plaintext M

Page 4 Private Key Algorithms Encryption Decryption Key 1 Cyphertext E k (M) = C D k (C) = M Original Plaintext Plaintext What granularity of the message does E k encrypt?

Page 5 Public Key Cryptosystems Introduced by Diffie and Hellman in Encryption Decryption K1K1 K2K2 Cyphertext E k (M) = C D k (C) = M Original Plaintext Plaintext Public Key systems K 1 = public key K 2 = private key Digital signatures K 1 = private key K 2 = public key Typically used as part of a more complicated protocol.

Page 6 Protocols: Digital Signatures Goals: 1.Convince recipient that message was actually sent by a trusted source 2.Do not allow repudiation, i.e., that’s not my signature. 3.Do not allow tampering with the message without invalidating the signature Item 2 turns out to be hard to do

296.3 Page 7 Cryptanalytic Attacks C = ciphertext messages M = plaintext messages Ciphertext Only:Attacker has multiple Cs but does not know the corresponding Ms Known Plaintext: Attacker knows some number of (C,M) pairs. Chosen Plaintext: Attacker chooses M and is given C. Chosen Ciphertext: Attacker chooses C and is given M.

296.3 Page 8 The Cast Alice – initiates a message or protocol Bob - second participant Trent – trusted middleman Eve – eavesdropper Mallory – malicious active attacker Trent AliceBob Eve Mallory

Page 9 What does it mean to be secure? Unconditionally Secure: Encrypted message cannot be decoded without the key Shannon showed in 1943 that key must be as long as the message to be unconditionally secure – this is based on information theory A one time pad – xor a random key with a message (Used in 2 nd world war) Security based on computational cost: it is computationally “infeasible” to decode a message without the key. E.g., there is no (probabilistic) polynomial time algorithm can decode the message.

Page 10 Primitives: One-Way Functions (Informally): A function Y = f(x) is one-way if it is easy to compute y from x but “hard” to compute x from y Building block of most cryptographic protocols The security of most protocols rely on their existence. Unfortunately, not proved to exist, even if we assume P  NP.

Page 11 One-way functions: possible definition 1.F(x) is polynomial time 2.F -1 (y) is NP-hard What is wrong with this definition? “F -1 (y) is NP-hard” is a statement only about worst-case complexity F -1 (y) may be NP-hard, but still easy to solve for most y Efforts to base cryptosystems on NP-hard problems have all failed. We don’t know how to generate difficult to solve instances.

CPS 290Page 12 One-way functions: better definition For almost all y no single PPT (probabilistic polynomial time) algorithm can compute x Roughly: at most a fraction 1/|x| k instances x are easy for any k and as |x| ->  This definition can be used to make the probability of hitting an easy instance arbitrarily small.

Page 13 Some examples (conjectures) Factoring: x = (u,v) y = f(u,v) = u*v If u and v are prime it is hard to generate them from y. Discrete Log: y = g x mod p where p is prime and g is a “generator” (i.e., g 1, g 2, g 3, … generates all values < p). DES with fixed message: y = DES x (m) This would assume a family of DES functions of increasing key size (for asymptotics)

CPS 290Page 14 One-way functions in private-key protocols y = ciphertext m = plaintext k = key y = E k (m) = E(k,m) = E m (k) (i.e. f = E m ) Given y and m, should E m be a one-way function? In a known-plaintext attack we know a (y,m) pair. The m along with E defines f E m (k) needs to be easy (plug in k and compute) E m -1 (y) should be hard Otherwise we could extract the key k.

Page 15 One-way functions in public-key protocols y = ciphertext m = plaintext k = public key Consider: y = E k (m) (i.e., f = E k ) We know k and thus f E k (m) needs to be easy E k -1 (y) should be hard Otherwise we could decrypt y. But what about the intended recipient, who should be able to decrypt y?

Page 16 One-Way Trapdoor Functions A one-way function with a “trapdoor” The trapdoor is a key that makes it easy to invert the function y = f(x) Example: RSA (conjectured to be hard to invert without trapdoor) y = x e mod n Where n = pq (p, q are prime) p or q or d (where ed = 1 mod (p-1)(q-1)) can be used as trapdoors In public-key algorithms f(x) = public key (e.g., e and n in RSA) Trapdoor = private key (e.g., d in RSA)

Page 17 One-way Hash Functions Y = h(x) where –y is a fixed length independent of the size of x. In general this means h is not invertible since it is many to one. –Calculating y from x should be easy –Preimage resistance: calculating any x such that y = h(x) give y is hard –Second preimage resistance: given y = h(x 1 ), finding x 2 such that h(x 1 )=h(x 2 )=y is hard –Collision resistance: finding any x 1 and x 2 such that h(x 1 ) = h(x 2 ) is hard Used in digital signatures and other protocols. Examples: SHA-1, SHA-256, MD5

Page 18 Private Key Exchange Private Key method Public Key method Trent AliceBob E ka (k)E kb (k) Generates k Alice Bob Generates k E k1 (k) k1 = Bob’s public key Or we can use a direct private-key-exchange protocol, such as Diffie-Hellman (discussed later) Trusted third party Trent has already exchanged private keys ka and kb with Alice and Bob, respectively.

Page 19 Private Key Algorithms Block Ciphers: blocks of bits at a time –DES (Data Encryption Standard) Banks, linux passwords (almost), SSL, kerberos, … –Blowfish (SSL as option) –IDEA (used in PGP, SSL as option) –AES– the new standard Stream Ciphers: one bit (or a few bits) at a time –RC4 (SSL as option) –PKZip –Sober, Leviathan, Panama, …

Page 20 Private Key: Block Ciphers Encrypt one block at a time (e.g. 64 bits) c i = f(k,m i ) m i = f ’ (k,c i ) Keys and blocks are often about the same size. Equal message blocks will encrypt to equal codeblocks –Why is this a problem? Various ways to avoid this: –E.g. c i = f(k,c i-1  m i ) “Cipher block chaining” (CBC) Why could this still be a problem? Solution: attach random block to the front of the message

Page 21 Iterated Block Ciphers Consists of n rounds R = the “round” function s i = state after round i k i = the i th round key R R R s1s m c key k1k1 k2k2 knkn s2s2

Page 22 Iterated Block Ciphers: Decryption Run the rounds in reverse. Requires that R has an inverse. R -1 s1s m c key k2k2 knkn s2s2 k1k1

Page 23 Feistel Networks Even if function F is not invertible, rounds can still be made invertible. Requires 2 rounds to mix all bits. F kiki XOR F kiki high-order bits low-order bits ForwardsBackwards RR -1 Used by DES (the Data Encryption Standard)

Page 24 Product Ciphers Each round has two components: –Substitution on smaller blocks Decorrelate input and output: “confusion” –Permutation across the smaller blocks Mix the bits: “diffusion” Substitution-Permutation Product Cipher Avalanche Effect: 1 bit of input should affect all output bits, ideally evenly, and for all settings of other bits

Page 25 AES Selected by NIST as the new private-key encryption standard. Based on an open “competition”. –Competition started Sept –Narrowed to 5 Sept MARS by IBM, RC6 by RSA, Twofish by Counterplane, Serpent, and Rijndael –Rijndael selected Oct –Official Oct. 2001? (AES page on Rijndael)AES page on Rijndael Designed by Rijmen and Daemen (Dutch)

Group A group consists of a set S and a binary operator  on S with the following properties: Closure: for all a,b  S, a  b  S Associativity: for all a,b,c  S, (a  b)  c = a  (b  c) Identity element: there exists an element e such that for each a  S, e  a = a  e = a Inverses: for each a  S there exists an element b such at a  b = b  a = e Examples: integers and addition {1,2,3,4} and multiplication mod 5 non-zero rational numbers and multiplication Page 26

Abelian Group A group is abelian or commutative if for every a and b, a  b = b  a Page 27

Field A field consists of a set S and two operations, addition (  ) and multiplication (  ) with the following properties: Closure under addition and multiplication Associativity of both addition and multiplication Commutativity of both addition and multiplication Identity elements for both addition and multiplication Inverses: additive inverse for every element, multicative inverses for all elements except additive identity Distributivity of multiplication over addition: a  (b  c) = (a  b)  (a  c) (a  b)  c = (a  c)  (b  c) Page 28

Examples of Fields Rational numbers with addition, multiplication Real numbers with addition, multiplication Complex numbers with addition, multiplication Finite fields: Z p = {0,1,2,…,p-1} (p prime), addition and multiplication mod p Galois Fields CPS 290 Page 29

296.3 Page 30 High-level overview of AES An iterated block cipher with –10–14 rounds, – bit blocks, and – bit keys Mathematically reasonably sophisticated

296.3 Page 31 Blocks and Keys The blocks and keys are organized as matrices of bytes. For the 128-bit case, it is a 4x4 matrix. Data blockKey b 0, b 1, …, b 15 is the order of the bytes in the stream.

Page 32 Galois Fields Finite fields of size P n for P prime, any n  0. Let Z P [x] denote the set of polynomials on variable x with coefficients drawn from Z P. Then the polynomials Z P [x] mod p(x) where p(x)  Z P [x] p(x) is irreducible (cannot be factored) and deg(p(x)) = n (i.e., n+1 coefficients) form a finite field. Such a field has p n elements. (Irreducibility ensures multiplicative inverses.) These fields are called Galois Fields or GF(P n ). The special case n = 1 reduces to the fields Z P The multiplicative group of GF(P n )/{0} is cyclic (this will be important later).

296.3 Page 33 Galois Fields in AES Uses GF(2 8 ) where each degree-7 polynomial (with coefficients drawn from 0 or 1) is stored in a byte. Example: z 5 + z 2 + z + 1 is stored as = 0x27 The irreducible polynomial is: z 8 + z 4 + z 3 + z + 1 Also uses degree-3 polynomials with coefficients from GF(2 8 ). I.e., each coefficient is represented as a byte. These are kept as 4 bytes (used for the columns) The polynomial used as a modulus is: M(x) = x or x (= x 4 - 1) Not irreducible (hence no Galois field), but we only need to find inverses of polynomials that are relatively prime to it.

296.3 Page 34 Round i: Shift Rows.... Byte substitution Mix columns + Key i out in To invert, run the steps and rounds backwards. Each step must be reversible! bit-wise XOR

296.3 Page 35 Byte Substitution b is a byte Non linear: y = b -1 (done over GF(2 8 )), 0 mapped to 0 Linear: z = Ay + B (done over GF(2)=Z 2, i.e., binary) To invert the substitution: y = A -1 (z - B) (the matrix A is nonsingular) b = y -1 (over GF(2 8 ))

296.3 Page 36 Shift Rows Cyclic shift of each row. Four 4 columns, row i is shifted left i positions, or, equivalently, shifted right 4-i positions. 

296.3 Page 37 Mix Columns For each column a in data block a0a1a2a3a0a1a2a3 compute b(x) = (a 3 x 3 +a 2 x 2 +a 1 x+a 0 )(’03’x 3 +’01’x 2 +’01’x+’02’) mod x 4 +1 where coefficients are taken over GF(2 8 ). New column b is b0b1b2b3b0b1b2b3 where b(x)=b 3 x 3 +b 2 x 2 +b 1 x+b 0 hex representation of polynomial in GF(2 8 )

296.3 Page 38 Implementation Using x j mod (x 4 + 1) = x (j mod 4) M(x) is not irreducible, but 3x 3 +x 2 +x+2 and M(x) are co-prime, so the transform can be inverted. (a 3 x 3 +a 2 x 2 +a 1 x+a 0 )(3x 3 +x 2 +x+2) mod x 4 +1 = (2a 0 +3a 1 +a 2 +a 3 ) + (a 0 +2a 1 +3a 2 +a 3 )x + (a 0 +a 1 +2a 2 +3a 3 )x 2 + (3a 0 +a 1 +a 2 +2a 3 )x 3 Therefore, b = C  a

296.3 Page 39 Generating the round keys f ++++ Words corresponding to columns of the key f = b1b1 b2b2 b3b3 b4b4 b2b2 b3b3 b4b4 b1b1 + rotate byte subst. const i Use “key schedule” to generate round keys from cypher key. round i round i+1 (In first round, use cypher key.)

296.3 Page 40 Linear Cryptanalysis A known plaintext attack used to extract the key Round i1i1 imim k1k1 kmkm o1o1 omom Consider a linear equality involving i, o, and k –e.g.: k 1  k 6 = i 2  i 4  i 5  o 4 To be secure this should be true with p =.5 (probability over all inputs and keys) If true with p = 1, then linear and easy to break If true with p =.5 +  then you might be able to use this to help break the system

296.3 Page 41 Differential Cryptanalysis A chosen plaintext attack used to extract the key Round Considers fixed “differences” between inputs,  I = I 1 - I 2, and sees how they propagate into differences in the outputs,  O = O 1 - O 2. “difference” is often exclusive OR Assigns probabilities to different keys based on these differences. With enough and appropriate samples (I 1, I 2, O 1, O 2 ), the probability of a particular key will converge to 1. IK O

Page 42 Public Key Cryptosystems Introduced by Diffie and Hellman in Encryption Decryption K1K1 K2K2 Cyphertext E k (M) = C D k (C) = M Original Plaintext Plaintext Public Key systems K 1 = public key K 2 = private key Digital signatures K 1 = private key K 2 = public key Typically used as part of a more complicated protocol.

Page 43 One-way trapdoor functions Both Public-Key and Digital signatures make use of one-way trapdoor functions. Public Key: –Encode: c = f(m) –Decode: m = f -1 (c) using trapdoor Digital Signatures: –Sign: c = f -1 (m) using trapdoor –Verify: m = f(c)

Page 44 Example of SSL (3.0) SSL (Secure Socket Layer) is the standard for the web (https). Protocol (somewhat simplified): Bob -> amazon.com B->A: client hello: protocol version, acceptable ciphers A->B: server hello: cipher, session ID, |amazon.com| verisign B->A: key exchange, {masterkey} amazon’s public key A->B: server finish: ([amazon,prev-messages,masterkey]) key1 B->A: client finish: ([bob,prev-messages,masterkey]) key2 A->B: server message: (message1,[message1]) key1 B->A: client message: (message2,[message2]) key2 |h| issuer = Certificate = Issuer, issuer’s private key private key = Digital signature {…} public key = Public-key encryption [..] = Secure Hash (…) key = Private-key encryption key1 and key2 are derived from masterkey and session ID hand- shake data

Server Name Issue The client expects the server to send a certificate matching the domain of the requested Web site. But the client doesn’t tell the server which Web site it is requesting -- not a problem if server hosts only one site. For servers hosting multiple secure Web sites, the “solution” is to assign multiple IP addresses to the network interface, one for each certificate. Akamai uses approximately 13M IPv4 addresses for this purpose. Better solution: “server name” extension in successor to SSL, TLS Page 45

TLS Client Hello – TLS Version 1.0 (SSL 3.1) Page 46

TLS Client Hello Message – Cipher Suite Page 47

TLS Client Hello – Server Name Extension Page 48

TLS Server Hello -- Cypher Page 49

TLS Server Hello – Certificate Page 50

Page 51 Signatures Using Public Keys More Efficiently AliceBob D k1 (m) AliceBob D k1 (h(m)) + m K1 = Alice’s private key Bob decrypts it with her public key h(m) is a one-way hash of m