Homework #4 Solutions Brian A. LaMacchia Portions © 2002-2006, Brian A. LaMacchia. This material is provided without.

Slides:



Advertisements
Similar presentations
L8. Reviews Rocky K. C. Chang, May Foci of this course 2 Rocky K. C. Chang  Understand the 3 fundamental cryptographic functions and how they are.
Advertisements

ECE454/CS594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2011.
CS 483 – SD SECTION BY DR. DANIYAL ALGHAZZAWI (3) Information Security.
CIS 725 Key Exchange Protocols. Alice ( PB Bob (M, PR Alice (hash(M))) PB Alice Confidentiality, Integrity and Authenication PR Bob M, hash(M) M, PR Alice.
SSL CS772 Fall Secure Socket layer Design Goals: SSLv2) SSL should work well with the main web protocols such as HTTP. Confidentiality is the top.
Interlock Protocol - Akanksha Srivastava 2002A7PS589.
Chapter 13 IPsec. IPsec (IP Security)  A collection of protocols used to create VPNs  A network layer security protocol providing cryptographic security.
CS470, A.SelcukReal-Time Communication Issues1 Real-Time Communication Security IPsec & SSL Issues CS 470 Introduction to Applied Cryptography Instructor:
Session 4 Asymmetric ciphers.
Public Key Algorithms …….. RAIT M. Chatterjee.
CS555Spring 2012/Topic 161 Cryptography CS 555 Topic 16: Key Management and The Need for Public Key Cryptography.
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.
Feb 25, 2003Mårten Trolin1 Previous lecture More on hash functions Digital signatures Message Authentication Codes Padding.
UCB Security Jean Walrand EECS. UCB Outline Threats Cryptography Basic Mechanisms Secret Key Public Key Hashing Security Systems Integrity Key Management.
Public-key Cryptography Montclair State University CMPT 109 J.W. Benham Spring, 1998.
Wireless Security In wireless networks. Security and Assurance - Goals Integrity Modified only in acceptable ways Modified only by authorized people Modified.
Mar 5, 2002Mårten Trolin1 Previous lecture More on hash functions Digital signatures Message Authentication Codes Padding.
EEC 693/793 Special Topics in Electrical Engineering Secure and Dependable Computing Lecture 7 Wenbing Zhao Department of Electrical and Computer Engineering.
CMSC 414 Computer and Network Security Lecture 22 Jonathan Katz.
More on AuthenticationCS-4513 D-term More on Authentication CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
EEC 688/788 Secure and Dependable Computing Lecture 7 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
How cryptography is used to secure web services Josh Benaloh Cryptographer Microsoft Research.
CMSC 414 Computer and Network Security Lecture 6 Jonathan Katz.
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.
The School of Electrical Engineering and Computer Science (EECS) CS/ECE Network Security Dr. Attila Altay Yavuz Topic 5 Essential Public Key Crypto Methods.
Public Key Algorithms 4/17/2017 M. Chatterjee.
Key Distribution CS 470 Introduction to Applied Cryptography
Homework #8 Solutions Brian A. LaMacchia Portions © , Brian A. LaMacchia. This material is provided without.
Network Security – Part 2 V.T. Raja, Ph.D., Oregon State University.
Homework #5 Solutions Brian A. LaMacchia Portions © , Brian A. LaMacchia. This material is provided without.
Diffie-Hellman Key Exchange
CSCI 172/283 Fall 2010 Public Key Cryptography. New paradigm introduced by Diffie and Hellman The mailbox analogy: Bob has a locked mailbox Alice can.
Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.5 Public Key Algorithms.
C HAPTER 13 Asymmetric Key Cryptography Slides adapted from "Foundations of Security: What Every Programmer Needs To Know" by Neil Daswani, Christoph Kern,
Lecture 6: Public Key Cryptography
Public Key Model 8. Cryptography part 2.
Great Theoretical Ideas in Computer Science.
ECE 454/CS 594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall.
How cryptography is used to secure web services Josh Benaloh Cryptographer Microsoft Research.
ECE 454/CS 594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall.
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.
Cryptography and Network Security Chapter 10 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
IPsec IPsec (IP security) Security for transmission over IP networks –The Internet –Internal corporate IP networks –IP packets sent over public switched.
PUBLIC-KEY CRYPTOGRAPH IT 352 : Lecture 2- part3 Najwa AlGhamdi, MSc – 2012 /1433.
Cryptography 1 Crypto Cryptography 2 Crypto  Cryptology  The art and science of making and breaking “secret codes”  Cryptography  making “secret.
Lecture 8 Overview. Analysis of Algorithms Algorithms – Time Complexity – Space Complexity An algorithm whose time complexity is bounded by a polynomial.
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.
COMP 424 Computer Security Lecture 09 & 10. Protocol ● An orderly sequence of steps agreed upon by two or more parties in order to accomplish a task ●
CS 4803 Fall 04 Public Key Algorithms. Modular Arithmetic n Public key algorithms are based on modular arithmetic. n Modular addition. n Modular multiplication.
1 Authenticated Key Exchange Rocky K. C. Chang 20 March 2007.
1 Diffie-Hellman (Key Exchange) Protocol Rocky K. C. Chang 9 February 2007.
1 Secure Key Exchange: Diffie-Hellman Exchange Dr. Rocky K. C. Chang 19 February, 2002.
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.
1 Diffie-Hellman (Key Exchange) Protocol Rocky K. C. Chang 9 February 2007.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
Lesson Introduction ●Authentication protocols ●Key exchange protocols ●Kerberos Security Protocols.
@Yuan Xue CS 285 Network Security Key Distribution and Management Yuan Xue Fall 2012.
Cryptography CSS 329 Lecture 13:SSL.
Reviews Rocky K. C. Chang 20 April 2007.
CSE 4095 Transport Layer Security TLS, Part II
Homework #5 Solutions Brian A. LaMacchia
Assignment #4 – Solutions
Homework #4 Solutions Brian A. LaMacchia
Secure Diffie-Hellman Algorithm
Presentation transcript:

Homework #4 Solutions Brian A. LaMacchia Portions © , Brian A. LaMacchia. This material is provided without warranty of any kind including, without limitation, warranty of non-infringement or suitability for any purpose. This material is not guaranteed to be error free and is intended for instructional use only.

January 31, 2006Practical Aspects of Modern Cryptography2 Question 1a  Question 1(a): Compute the relative cost of RSA encryption to RSA decryption in SSL in terms of modular multiplications mod n. The server’s public key is (n, e), where n is a 1024-bit composite, n = p*q (p, q 512-bit primes), and e = The server’s public key is (n, e), where n is a 1024-bit composite, n = p*q (p, q 512-bit primes), and e = The server’s private decryption exponent is d where ed  1 mod (p-1)(q-1). Assume for this problem that half the bits in d are 1’s and |d| = The server’s private decryption exponent is d where ed  1 mod (p-1)(q-1). Assume for this problem that half the bits in d are 1’s and |d| = 1024.

January 31, 2006Practical Aspects of Modern Cryptography3 Question 1a  Recall Josh's description of how to multiply fast Follow the bits in the exponent (high to low, ignoring the high bit since it's always 1), a 0 is a square and a 1 is a square followed by a side multiply. Follow the bits in the exponent (high to low, ignoring the high bit since it's always 1), a 0 is a square and a 1 is a square followed by a side multiply. So the cost of exponentiating is determined by the size of the exponent and the number of 1 bits it has. So the cost of exponentiating is determined by the size of the exponent and the number of 1 bits it has.  The cost of encrypting (exponentiating to e) is thus going to involve 16 squares and 1 side multiply, since |e| = 17 and has only the high & low bit set.  The cost of decrypting (exponentiating to d) is going to involve 1023 squares and 511 side multiplies (because |d| = 1024 and half the bits in d are 1s).

January 31, 2006Practical Aspects of Modern Cryptography4 Question 1b - Rebalanced RSA  n = pq, |p| = |q| = 512, p, q prime  Server chooses the decryption exponent d first such that d  r1 mod p-1, d  r2 mod q-1, |r1| = |r2| = 160 d  r1 mod p-1, d  r2 mod q-1, |r1| = |r2| = 160 Assume half the bits in r1 & r2 are 1s Assume half the bits in r1 & r2 are 1s  The server then computes e such that ed  1 mod (p-1)(q-1). |e| = 1024, assume half the bits in e are 1s |e| = 1024, assume half the bits in e are 1s  Encryption E(X) = X e mod n  Decryption D(X) is now done by computing X r1 mod p, X r2 mod q, and using CRT to construct X d mod n.

January 31, 2006Practical Aspects of Modern Cryptography5 Question 1b  Question 1(b): Compute the relative cost of RSA encryption to RSA decryption in the Rebalanced RSA case for |n| = 1024, |r1| = |r2| = 160, again in terms of modular multiplications in the exponentiations.  What’s the speedup for a server compared to the “regular” RSA in Question 1(a)?

January 31, 2006Practical Aspects of Modern Cryptography6 Question 1b  We proceed as in 1(a), looking at the sizes and number of 1 bits in the various exponents.  Encrypting: e is now "full size“, so |e| = 1024 and half the bits in e are 1s Computing X e mod n will involve 1023 squares and 511 side multiplies Computing X e mod n will involve 1023 squares and 511 side multiplies  Decrypting: we need to compute X r1 mod p and X r2 mod q. |r 1 | = |r 2 | = 160 (by definition), and each has 80 1 bits. |r 1 | = |r 2 | = 160 (by definition), and each has 80 1 bits. Each exponentiation will involve 159 squares and 79 side multiplies. So together, the server has to perform 318 squares and 158 side multiplies. Each exponentiation will involve 159 squares and 79 side multiplies. So together, the server has to perform 318 squares and 158 side multiplies.

January 31, 2006Practical Aspects of Modern Cryptography7 Question 1b  Just comparing the number of exponentiations, we've reduced the server's workload from 1023 squares & 511 side multiplies to 318 squares and 158 side multiplies, which is about a 3.2X speedup for the server. Plus, the server gets to do these calculations mod p and mod q, which means it's dealing with smaller numbers. Plus, the server gets to do these calculations mod p and mod q, which means it's dealing with smaller numbers.  The client is a lot slower squares and 511 side multiplies vs. 16 squares and 1 side multiply in 1(a) squares and 511 side multiplies vs. 16 squares and 1 side multiply in 1(a).

January 31, 2006Practical Aspects of Modern Cryptography8 Question 2 – IPSEC cost  C sends data to S in packets of varying length; for each packet S and C have to perform an IKE key establishment once to agree on a symmetric encryption key, and then perform repeated symmetric encryptions until the entire packet is encrypted.  Assume the following performance characteristics for C’s encryption capabilities: C can perform IKE key establishment with S in 25,000  s to derive a symmetric encryption key for the session. C can perform IKE key establishment with S in 25,000  s to derive a symmetric encryption key for the session. C can perform a single symmetric encryption operation on a 16-byte plaintext in 0.25  s. C can perform a single symmetric encryption operation on a 16-byte plaintext in 0.25  s.

January 31, 2006Practical Aspects of Modern Cryptography9 Question 2a  Question 2(a): If the average packet of data sent from C to S is 1KB (1024 bytes) in length, what’s the maximum bandwidth that can be achieved between C and S?  Encrypting each packet requires one IKE key establishment and some number of symmetric encryption operations. Bandwidth = bits/second Bandwidth = bits/second

January 31, 2006Practical Aspects of Modern Cryptography10 Question 2a - Solution  For a 1K packet, we need one IKE + (1K/16) block encryptions The IKE takes  s The IKE takes  s The block encryptions take 64*.25  s = 16  s The block encryptions take 64*.25  s = 16  s The total time is  s, and we’ve processed 1K bytes in that time, or about bytes/sec. The total time is  s, and we’ve processed 1K bytes in that time, or about bytes/sec.

January 31, 2006Practical Aspects of Modern Cryptography11 Question 2a - Solution  But wait, what about the additional bytes ESP adds? No effect on bandwidth limits from encryption, but ESP does add overhead, so it’s fair to look at that cost too. No effect on bandwidth limits from encryption, but ESP does add overhead, so it’s fair to look at that cost too.  We don’t know the actual wire speed, but we know that ESP adds some bytes to each packet. Assume 56 bytes added to each packet Assume 56 bytes added to each packet So we have to send = 1080 bytes to actually transmit 1024 data bytes. So we have to send = 1080 bytes to actually transmit 1024 data bytes. 1080/1024 = 1024/X  X = bytes 1080/1024 = 1024/X  X = bytes bytes in  s = bytes/sec bytes in  s = bytes/sec

January 31, 2006Practical Aspects of Modern Cryptography12 Question 2b  Question 2(b): Now assume the average packet is 100KB; what’s the maximum achievable bandwidth?  What’s the maximum bandwidth in the limiting case (i.e. one persistent session with an infinite-length packet to be sent)?

January 31, 2006Practical Aspects of Modern Cryptography13 Question 2b - Solution  For a 100K packet, we need one IKE + (1K/16) block encryptions The IKE takes  s, 100K = bytes The IKE takes  s, 100K = bytes (100K/16) block encryptions take (100K/16)*.25  s = 6400*.25  s = 1600  s (100K/16) block encryptions take (100K/16)*.25  s = 6400*.25  s = 1600  s Total time:  s, or about 3,849,624 bytes/sec. Total time:  s, or about 3,849,624 bytes/sec. Adding in 56 header bytes, we have to send bytes instead of bytes. Adding in 56 header bytes, we have to send bytes instead of bytes / = /X  X = bytes / = /X  X = bytes bytes in  s = 3,847,518 bytes/sec bytes in  s = 3,847,518 bytes/sec  In the limit, the limiting factor is that it takes.25  s to encrypt 16 bytes, so that's an upper limit of 64,000,000 bytes/sec.

January 31, 2006Practical Aspects of Modern Cryptography14 Question 3 – KDC Eavesdropping  KDC, S and C are members of the same Kerberos realm  When C obtains a ticket for S, KDC assigns ephemeral key K C,S  KDC knows K C,S and can eavesdrop on all traffic protected with K C,S  Assume KDC is passive (i.e. KDC cannot modify messages it sees on the wire).  Question 3(a): Show how C and S can establish key K’ known only to them

January 31, 2006Practical Aspects of Modern Cryptography15 Question 3a  Key establishment is easy, right? All we have to do is have C and S perform a Diffie-Hellman key exchange.

January 31, 2006Practical Aspects of Modern Cryptography16 Question 3a  Key establishment is easy, right? All we have to do is have C and S perform a Diffie-Hellman key exchange.  But how do C and S know they’re talking to each other while doing so?

January 31, 2006Practical Aspects of Modern Cryptography17 Question 3a  Key establishment is easy, right? All we have to do is have C and S perform a Diffie-Hellman key exchange.  But how do C and S know they’re talking to each other while doing so?  One of the benefits of Kerberos is that it give you mutual authentication “for free” C and S authenticate each other as a side- effect of running the Kerberos protocol. C and S authenticate each other as a side- effect of running the Kerberos protocol.

January 31, 2006Practical Aspects of Modern Cryptography18 Question 3a  Key establishment is easy, right? All we have to do is have C and S perform a Diffie-Hellman key exchange.  But how do C and S know they’re talking to each other while doing so?  One of the benefits of Kerberos is that it give you mutual authentication “for free” C and S authenticate each other as a side- effect of running the Kerberos protocol. C and S authenticate each other as a side- effect of running the Kerberos protocol.

January 31, 2006Practical Aspects of Modern Cryptography19 Question 3a  So one way to solve the problem is to add mutual authentication to Diffie-Hellman. Here’s how:  First, have C and S run the Kerberos protocol to obtain shared secret K C,S (known to C, S and the KDC).  Now have C and S run ephemeral Diffie-Hellman (using some common set of parameters).  Initialization: each party (C and S) chooses a secret exponent (a and b respectively) C computes A = g a mod p, S computes B = g b mod p C computes A = g a mod p, S computes B = g b mod p  C  S: A, HMAC-SHA1(A, K C,S ). S verifies the keyed MAC and knows that A really came from C. S verifies the keyed MAC and knows that A really came from C.  S  C: B, HMAC-SHA1(B, K C,S ). C verifies the keyed MAC and knows that B really came from S. C verifies the keyed MAC and knows that B really came from S.  C computes B a mod p to get K’ = g ab mod p.  S computes A b mod p to get K’ = g ab mod p.  Now C and S hold a new shared secret, K’, which is unknown to the KDC. C and S used K C,S to authenticate a later, public key-based exchange. C and S used K C,S to authenticate a later, public key-based exchange.

January 31, 2006Practical Aspects of Modern Cryptography20 Question 3b  What happens if the KDC is active?

January 31, 2006Practical Aspects of Modern Cryptography21 Question 3b  What happens if the KDC is active?  If the KDC is active then it can intercept messages, rewrite A & B to A' and B' and conduct a man-in-the- middle attack.

January 31, 2006Practical Aspects of Modern Cryptography22 Man-in-the-Middle  An active KDC can play a man-in-the- middle attack. KDC can also defeat the modified D-H in 3(a) because it knows K C,S KDC can also defeat the modified D-H in 3(a) because it knows K C,S Server S Client C KDC g a’ mod p g a mod p g b mod p g b’ mod p Negotiated key: g ab’ mod p Negotiated key: g a’b mod p

January 31, 2006Practical Aspects of Modern Cryptography23 Question 3c (Extra Credit)  Assume C and S are jointly members of two independent Kerberos realms: Realm 1: KDC1, yielding key K C,S,1 Realm 1: KDC1, yielding key K C,S,1 Realm 2: KDC2, yielding key K C,S,2 Realm 2: KDC2, yielding key K C,S,2  Assuming that KDC1 and KDC2 do not collude with each other, devise a protocol between C and S to create an encrypted channel that is secure against active eavesdropping from both KDC1 and KDC2.  > 3c) With two independent keys, so long as the KDCs don't collude they can't play man- in-the-middle.

January 31, 2006Practical Aspects of Modern Cryptography24 Question 3c (Extra Credit)  With two independent keys shared between C and S, so long as the KDCs don't collude neither can perform a man-in-the-middle attack. “Independent” here means “Neither key is known to both KDC1 and KDC2”. “Independent” here means “Neither key is known to both KDC1 and KDC2”.  Solution: as in 3(a) above, but use both keys in the HMAC authenticators Neither KDC1 or KDC2 knows both, so even if they’re active they can’t switch messages on C or S Neither KDC1 or KDC2 knows both, so even if they’re active they can’t switch messages on C or S

January 31, 2006Practical Aspects of Modern Cryptography25 Question 3c  C and S run Kerberos in both realms, obtaining K C,S,1 and K C,S,2  Now have C and S run ephemeral Diffie-Hellman (using some common set of parameters).  Initialization: C computes A = g a mod p, S computes B = g b mod p  C  S: A, HMAC-SHA1(A, K C,S,1, K C,S,2 ). S verifies the keyed MAC and knows that A really came from C. S verifies the keyed MAC and knows that A really came from C.  S  C: B, HMAC-SHA1(B, K C,S,1, K C,S,2 ). C verifies the keyed MAC and knows that B really came from S. C verifies the keyed MAC and knows that B really came from S.  C computes B a mod p to get K’ = g ab mod p.  S computes A b mod p to get K’ = g ab mod p.  Now C and S hold a new shared secret, K’, which is unknown to the KDC.