The School of Electrical Engineering and Computer Science (EECS) CS/ECE Network Security Dr. Attila Altay Yavuz Topic 5 Essential Public Key Crypto Methods.

Slides:



Advertisements
Similar presentations
Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
Advertisements

Computer Science CSC 405By Dr. Peng Ning1 CSC 405 Introduction to Computer Security Topic 2. Basic Cryptography (Part II)
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
Public Key Algorithms …….. RAIT M. Chatterjee.
Dr. Lo’ai Tawalbeh Summer 2007 Chapter 9 – Public Key Cryptography and RSA Dr. Lo’ai Tawalbeh New York Institute of Technology (NYIT) Jordan’s Campus INCS.
Public-key Cryptography Montclair State University CMPT 109 J.W. Benham Spring, 1998.
CNS2010handout 10 :: digital signatures1 computer and network security matt barrie.
ECOMMERCE TECHNOLOGY FALL 2003 COPYRIGHT © 2003 MICHAEL I. SHAMOS Cryptography.
WS Algorithmentheorie 03 – Randomized Algorithms (Public Key Cryptosystems) Prof. Dr. Th. Ottmann.
Cryptography1 CPSC 3730 Cryptography Chapter 9 Public Key Cryptography and RSA.
Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender and receiver if this key is disclosed communications.
WS Algorithmentheorie 03 – Randomized Algorithms (Public Key Cryptosystems) Prof. Dr. Th. Ottmann.
Public Key Algorithms 4/17/2017 M. Chatterjee.
1 Pertemuan 08 Public Key Cryptography Matakuliah: H0242 / Keamanan Jaringan Tahun: 2006 Versi: 1.
ELECTRONIC PAYMENT SYSTEMSFALL 2001COPYRIGHT © 2001 MICHAEL I. SHAMOS Electronic Payment Systems Lecture 6 Epayment Security II.
Public Key Cryptography RSA Diffie Hellman Key Management Based on slides by Dr. Lawrie Brown of the Australian Defence Force Academy, University College,
Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.5 Public Key Algorithms.
Cryptography and Network Security Chapter 13
Lecture 6: Public Key Cryptography
Introduction to Public Key Cryptography
Public Key Model 8. Cryptography part 2.
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
Andreas Steffen, , 4-PublicKey.pptx 1 Internet Security 1 (IntSi1) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications.
Information Security and Management 13. Digital Signatures and Authentication Protocols Chih-Hung Wang Fall
CS5204 – Fall Cryptographic Security Presenter: Hamid Al-Hamadi October 13, 2009.
Page 1 Secure Communication Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
The RSA Algorithm Rocky K. C. Chang, March
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.
Network and Communications Network Security Department of Computer Science Virginia Commonwealth University.
Cryptography: RSA & DES Marcia Noel Ken Roe Jaime Buccheri.
10/1/2015 9:38:06 AM1AIIS. OUTLINE Introduction Goals In Cryptography Secrete Key Cryptography Public Key Cryptograpgy Digital Signatures 2 10/1/2015.
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
1 Lecture 9 Public Key Cryptography Public Key Algorithms CIS CIS 5357 Network Security.
Public-Key Cryptography CS110 Fall Conventional Encryption.
Topic 22: Digital Schemes (2)
Digital Signatures A primer 1. Why public key cryptography? With secret key algorithms Number of key pairs to be generated is extremely large If there.
Chapter 21 Public-Key Cryptography and Message Authentication.
Private-Key Cryptography  traditional private/secret/single key cryptography uses one key  shared by both sender and receiver  if this key is disclosed.
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
1 Public-Key Cryptography and Message Authentication.
Cryptography and Network Security Chapter 13 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Cryptography and Network Security Chapter 9 - Public-Key Cryptography
CS461/ECE422 Spring 2012 Nikita Borisov — UIUC1.  Text Chapters 2 and 21  Handbook of Applied Cryptography, Chapter 8 
PUBLIC-KEY CRYPTOGRAPH IT 352 : Lecture 2- part3 Najwa AlGhamdi, MSc – 2012 /1433.
Chapter 3 (B) – Key Management; Other Public Key Cryptosystems.
Advanced Database Course (ESED5204) Eng. Hanan Alyazji University of Palestine Software Engineering Department.
Cryptography 1 Crypto Cryptography 2 Crypto  Cryptology  The art and science of making and breaking “secret codes”  Cryptography  making “secret.
Chapter 3 – Public Key Cryptography and RSA (A). Private-Key Cryptography traditional private/secret/single-key cryptography uses one key shared by both.
Public Key Cryptosystems RSA Diffie-Hellman Department of Computer Engineering Sharif University of Technology 3/8/2006.
Chapter 9 Public Key Cryptography and RSA. Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender.
The School of Electrical Engineering and Computer Science (EECS) CS/ECE Network Security Dr. Attila Altay Yavuz Authentication Protocols (I): Secure Handshake.
Public Key Algorithms Lesson Introduction ●Modular arithmetic ●RSA ●Diffie-Hellman.
PUBLIC-KEY CRYPTOGRAPHY AND RSA – Chapter 9 PUBLIC-KEY CRYPTOGRAPHY AND RSA – Chapter 9 Principles Applications Requirements RSA Algorithm Description.
CS 4803 Fall 04 Public Key Algorithms. Modular Arithmetic n Public key algorithms are based on modular arithmetic. n Modular addition. n Modular multiplication.
Computer Security Lecture 5 Ch.9 Public-Key Cryptography And RSA Prepared by Dr. Lamiaa Elshenawy.
Lecture 9 Overview. Digital Signature Properties CS 450/650 Lecture 9: Digital Signatures 2 Unforgeable: Only the signer can produce his/her signature.
Introduction to Pubic Key Encryption CSCI 5857: Encoding and Encryption.
Diffie-Hellman Key Exchange first public-key type scheme proposed by Diffie & Hellman in 1976 along with the exposition of public key concepts – note:
Introduction to Elliptic Curve Cryptography CSCI 5857: Encoding and Encryption.
ECE454/599 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2012.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
CSEN 1001 Computer and Network Security Amr El Mougy Mouaz ElAbsawi.
1 The RSA Algorithm Rocky K. C. Chang February 23, 2007.
Cryptography and Network Security Chapter 13
Public Key Cryptography
Asymmetric-Key Cryptography
Public-key Cryptography
Essential Public Key Crypto Methods Credit: Prof. Dr. Peng Ning
Presentation transcript:

The School of Electrical Engineering and Computer Science (EECS) CS/ECE Network Security Dr. Attila Altay Yavuz Topic 5 Essential Public Key Crypto Methods Credit: Prof. Dr. Peng Ning Network Security Dr. Attila Altay Yavuz1Spring 2015

OSU EECS 2 Outline I.RSA II.Diffie-Hellman Key Exchange III.Digital Signature Standard

OSU EECS 3 Trapdoor One-Way Functions Trapdoor one-way function –Y=f k (X): easy to compute if k and X are known –X=f  1 k (Y): easy to compute if k and Y are known – X=f  1 k (Y): hard if Y is known but k is unknown Goal of designing public-key algorithm is to find appropriate trapdoor one-way function

The School of Electrical Engineering and Computer Science (EECS) 4 The RSA Cipher

OSU EECS 5 RSA (Rivest, Shamir, Adleman) The most popular public key method –provides both public key encryption and digital signatures Basis: factorization of large numbers is hard Variable key length (2048 bits or greater) Variable plaintext block size –plaintext block size must be smaller than key size –ciphertext block size is same as key size

OSU EECS 6 Generating a Public/Private Key Pair Find (using Miller-Rabin) large primes p and q Let n = p*q do not disclose p and q!  (n) = ??? Choose an e that is relatively prime to  (n) public key = Find d = multiplicative inverse of e mod  (n) (i.e., e*d = 1 mod  (n)) private key =

OSU EECS 7 RSA Operations For plaintext message m and ciphertext c Signing: s = m d mod n, m < n Verification: m = s e mod n Encryption: c = m e mod n, m < n Decryption: m = c d mod n

OSU EECS 8 RSA Example: Encryption and Signing Choose p = 23, q = 11 (both primes) –n = p*q = 253 –  (n) = (p-1)(q-1) = 220 Choose e = 39 (relatively prime to 220) –public key = Find e -1 mod 220 = d = 79 (note: 39*79  1 mod 220) –private key =

OSU EECS 9 Example (Cont’d) Suppose plaintext m = 80 Encryption c = mod 253 = ____ (c = m e mod n) Decryption m = ____ 79 mod 253 = 80 (c d mod n) Signing (in this case, for entire message m) s = mod 253 = ____ (s = m d mod n) Verification m = ____ 39 mod 253 = 80 (s e mod n)

OSU EECS 10 Example (Cont’d) Suppose plaintext m = 80 Encryption c = mod 253 = 37 (c = m e mod n) Decryption m = mod 253 = 80 (c d mod n) Signing (in this case, for entire message m) s = mod 253 = 224 (s = m d mod n) Verification m = mod 253 = 80 (s e mod n)

OSU EECS 11 Another Example Choose p = 17, q = 11 (both primes) –n = p*q = 187 –  (n) = (p-1)(q-1) = 160 Choose e = 7 (relatively prime to 160) –public key = Find e -1 mod 160 = d = 23 i.e., 7*23 = 1 mod 160 –private key =

OSU EECS 12 Example (Cont’d) Suppose plaintext m = 88 Encryption –c = 11 = 88 7 mod 187 (c = m e mod n) Decryption –m = 88 = mod 187 (c d mod n) Signing (entire message, not just hash) –s = 11 = mod 187 (s = m d mod n) Verification –m = 88 = 11 7 mod 187 (s e mod n) why the same???!

OSU EECS 13 Using RSA for Key Negotiation Procedure 1.A sends random number R1 to B, encrypted with B’s public key 2.B sends random number R2 to A, encrypted with A’s public key 3.A and B both decrypt received messages using their respective private keys 4.A and B both compute K = H(R1  R2), and use that as the shared key

OSU EECS 14 Key Negotiation Example For Alice, e = 39, d = 79, n = 253 For Bob, e = 23, d = 47, n = 589 (=19*31) Let R1 = 15, R2 = 55 1.Alice sends 306 = mod 589 to Bob 2.Bob sends 187 = mod 253 to Alice 3.Alice computes R2 = 55 = mod Bob computes R1 = 15 = mod A and B both compute K = H(R1  R2), and use that as the shared key

OSU EECS 15 Proof of Correctness (D(E(m)) = m) Given –public key = and private key = –n =p*q,  (n) =(p-1)(q-1) –e*d  1 mod  (n) If encryption is c = m e mod n, decryption…  c d mod n = (m e ) d mod n = m ed mod n = m mod n (why?) = m (since m < n) (digital signature proof is similar)

OSU EECS 16 Is RSA Secure? is public information If you could factor n into p*q, then –could compute  (n) =(p-1)(q-1) –could compute d = e -1 mod  (n) –would know the private key ! But: factoring large integers is hard! –classical problem worked on for centuries; no known reliable, fast method

OSU EECS 17 Security (Cont’d) At present, key sizes of 1024 bits are considered to be secure, but 2048 bits is better Tips for making n difficult to factor 1.p and q lengths should be similar (ex.: ~500 bits each if key is 1024 bits) 2.both (p-1) and (q-1) should contain a “large” prime factor 3.gcd(p-1, q-1) should be “small” 4.d should be larger than n 1/4

OSU EECS 18 Attacks Against RSA Brute force: try all possible private keys –can be defeated by using a large enough key space (e.g., 1024 bit keys or larger) Mathematical attacks 1.factor n (possible for special cases of n) 2.determine d directly from e, without computing  (n) –at least as difficult as factoring n

OSU EECS 19 Attacks (Cont’d) Probable-message attack (using ) –encrypt all possible plaintext messages –try to find a match between the ciphertext and one of the encrypted messages –only works for small plaintext message sizes Solution: pad plaintext message with random text before encryption PKCS #1 v1 specifies this padding format: 0002R1R2R3R4R5R6R7R8data…00 each 8 bits long

OSU EECS 20 Timing Attacks Against RSA Recovers the private key from the running time of the decryption algorithm Computing m = c d mod n using repeated squaring algorithm: m = 1; for i = k-1 downto 1 m = m*m mod n; if d i == 1 then m = m*c mod n; return m;

OSU EECS 21 Timing Attacks (Cont’d) The attack proceeds bit by bit Attacker assumed to know c, m Attacker is able to determine bit i of d because for some c and m, the highlighted step is extremely slow if d i = 1

OSU EECS 22 Countermeasures to Timing Attacks 1.Delay the result if the computation is too fast –disadvantage: ? 2.Add a random delay –disadvantage? 3.Blinding: multiply the ciphertext by a random number before performing decryption

OSU EECS 23 RSA’s Blinding Algorithm To confound timing attacks during decryption 1.generate a random number r between 0 and n–1 such that gcd(r, n) = 1 2.compute c’ = c * r e mod n 3.compute m’ = (c’) d mod n 4.compute m = m’ * r –1 mod n Attacker will not know what the bits of c’ are Performance penalty: < 10% slowdown in decryption speed this is where timing attack would occur

The School of Electrical Engineering and Computer Science (EECS) 24 Diffie-Hellman Key Exchange

OSU EECS 25 Diffie-Hellman Protocol For negotiating a shared secret key using only public communication Does not provide authentication of communicating parties What’s involved? –p is a large prime number (about 1024 bits) –g is a primitive root of p, and g < p –p and g are publicly known

OSU EECS 26 D-H Key Exchange Protocol AliceBob Publishes or sends g and pReads g and p Picks random number S A (and keeps private) Picks random number S B (and keeps private) Computes public key T A = g S A mod p Computes public key T B = g S B mod p Sends T A to Bob, reads T B from Bob Sends T B to Alice, reads T A from Alice Computes T B S A mod pComputes T A S B mod p =

OSU EECS 27 Key Exchange (Cont’d) Alice and Bob have now both computed the same secret g S A S B mod p, which can then be used as the shared secret key K S A is the discrete logarithm of g S A mod p and S B is the discrete logarithm of g S B mod p =

OSU EECS 28 Why is This Secure? Discrete log problem: –given T A ( = g S A mod p), g, and p, it is computationally infeasible to compute S A –(note: as always, to the best of our knowledge; doesn’t mean there isn’t a method out there waiting to be found) –same statement can be made for T B, g, p, and S B

OSU EECS 29 D-H Limitations Expensive exponential operation is required –possible timing attacks?? Algorithm is useful for key negotiation only –i.e., not for public key encryption Not for user authentication –In fact, you can negotiate a key with a complete stranger!

OSU EECS 30 Man-In-The-Middle Attack Trudy impersonates as Alice to Bob, and also impersonates as Bob to Alice Alice Bob Trudy g S A = 3 97 mod 353 g S ”A” gSBgSB g S ”B” = mod 353 K1 = mod 353 = mod 353 = 160 K2 = (g S B ) S ”A”

OSU EECS 31 Man-In-The-Middle Attack (Cont’d) Now, Alice thinks K1 is the shared key, and Bob thinks K2 is the shared key Trudy intercepts messages from Alice to Bob, and –decrypts (using K1), substitutes her own message, and encrypts for Bob (using K2) –likewise, intercepts and substitutes messages from Bob to Alice Solution???

OSU EECS 32 Encryption Using D-H? How to do key distribution + message encryption in one step Everyone computes and publishes their own individual, where T i =g i S i mod p i For Alice to communicate with Bob… 1.Alice picks a random secret S A 2.Alice computes g B S A mod p B 3.Alice uses K AB = T B S A mod p B to encrypt the message 4.Alice sends encrypted message along with (unencrypted) g B S A mod p B

OSU EECS 33 Encryption (Cont’d) For Bob to decipher the encrypted message from Alice 1.Bob computes K AB = (g B S A ) S B mod p B 2.Bob decrypts message using K AB

OSU EECS 34 Picking g and p Advisable to change g and p periodically –the longer they are used, the more info available to an attacker Advisable not to use same g and p for everybody For “obscure mathematical reasons”… –(p-1)/2 should be prime –g (p-1)/2 should be  -1 mod p –Sofie-German Primes

The School of Electrical Engineering and Computer Science (EECS) 35 Digital Signature Algorithm (DSA)

OSU EECS 36 Digital Signature Standard (DSS) Useful only for digital signing (no encryption or key exchange) Components –SHA-1 to generate a hash value (some other hash functions also allowed now) –Digital Signature Algorithm (DSA) to generate the digital signature from this hash value Designed to be fast for the signer rather than verifier –e.g., for use in smart cards

OSU EECS 37 Digital Signature Algorithm (DSA) 1.Announce public parameters used for signing –pick p (a prime with >= 1024 bits) –pick q (a 160 bit prime) such that q|(p  1) –choose g  h (p  1)/q mod p, where 1 1 –note: g is of order q mod p ex.: if h = 2, g = 2 6 mod 103 = 64 ex.: p = 103 ex.: q = 17 (divides 102) ex.: powers of 64 mod 103 = values

OSU EECS 38 DSA (Cont’d) 2.User Alice generates a long-term private key x M –random integer with 0 < x M < q 3.Alice generates a long-term public key y M –y M = g x M mod p ex.: x M = 13 ex.: y M = mod 103 = 76

OSU EECS 39 DSA (Cont’d) 4.Alice randomly picks a private key k such that 0 < k < q, and generates k -1 mod q 5.Signing message M –public key r = (g k mod p) mod q –signature s = [k  1 (H(M)+x M r)] mod q –transmitted info = M, r, s ex.: k = 12, mod 17 = 10 ex.: r = (64 12 mod 103) mod 17 = 4 ex.: s = [10 * ( *4)] mod 17 = 12 ex.: H(M) = 75 ex.: M, 4, 12 ex.: p = 103, q = 17, g = 64, x M = 13, y M = 76

OSU EECS 40 Verifying a DSA Signature Known : g, p, q, y M Received from signer: M, r, s 1.w = (s)  1 mod q 2.u 1 = [H(M)w] mod q 3.u 2 = (r*w) mod q 4.v = [(g u1 *y M u2 ) mod p] mod q 5.If v = r, then the signature is verified ex.: M, 4, 12 ex.: w = mod 17 = 10 ex.: u 1 = 75*10 mod 17 = 2 ex.: u 2 = 4*10 mod 17 = 6 ex.: v = [(64 2 * 76 6 ) mod 103] mod 17 = 4 ex.: p = 103, q = 17, g = 64, y M = 76, H(M) = 75

OSU EECS 41 Verifying DSA Signature Received: M, r= 13, s=24 1.w = (s)  1 mod q = 24 2.u 1 = [H(M)w] mod q = 22*24 mod 25 = 3 3.u 2 = (r)w mod q = 13 * 24 mod 25 = 12 4.v = [(g u1 y A u2 ) mod p] mod q = [5 3 * mod 101] mod 25 = 13 5.If v = r, then the signature is verified

OSU EECS 42 Why Does it Work? Correct? The signer computes s = k -1 * (H(m) + x*r) mod q so k  H(m)*s -1 + x*r*s -1  H(m)*w + x*r*w mod q Since g has order q: g k  g H(m)w * g xrw  g H(m)w * y rw  g u1 * y u2 mod p, and r = (g k mod p) mod q = (g u1 *y u2 mod p) mod q = v

OSU EECS 43 Is it Secure? Given y M, it is difficult to compute x M — x M is the discrete log of y M to the base g, mod p Likewise, given r, it is difficult to compute k Cannot forge a signature without x M Signatures are not repeated (only used once per message) and cannot be replayed

OSU EECS 44 Assessment of DSA Slower to verify than RSA, but faster signing than RSA Key lengths of 2048 bits and greater are also allowed