15-349 Introduction to Computer and Network Security Iliano Cervesato 2 September 2008 – Public-key Encryption.

Slides:



Advertisements
Similar presentations
RSA COSC 201 ST. MARY’S COLLEGE OF MARYLAND FALL 2012 RSA.
Advertisements

CSE331: Introduction to Networks and Security Lecture 19 Fall 2002.
22C:19 Discrete Structures Integers and Modular Arithmetic
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
Notation Intro. Number Theory Online Cryptography Course Dan Boneh
7. Asymmetric encryption-
Great Theoretical Ideas in Computer Science.
Session 4 Asymmetric ciphers.
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.
CNS2010handout 8 :: introduction to number theory1 computer and network security matt barrie.
Introduction to Modern Cryptography Lecture 5 Number Theory: 1. Quadratic residues. 2. The discrete log problem. Intro to Public Key Cryptography Diffie.
CS470, A.SelcukPublic Key Cryptography1 CS 470 Introduction to Applied Cryptography Instructor: Ali Aydin Selcuk.
Cryptography & Number Theory
CMSC 414 Computer and Network Security Lecture 6 Jonathan Katz.
Cryptography1 CPSC 3730 Cryptography Chapter 9 Public Key Cryptography and RSA.
CSE 321 Discrete Structures Winter 2008 Lecture 8 Number Theory: Modular Arithmetic.
Theory I Algorithm Design and Analysis (9 – Randomized algorithms) Prof. Dr. Th. Ottmann.
Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender and receiver if this key is disclosed communications.
Dr.Saleem Al_Zoubi1 Cryptography and Network Security Third Edition by William Stallings Public Key Cryptography and RSA.
Public Key Algorithms 4/17/2017 M. Chatterjee.
Introduction to Computer and Network Security Iliano Cervesato 26 August 2008 – Modern Cryptography.
1 Pertemuan 08 Public Key Cryptography Matakuliah: H0242 / Keamanan Jaringan Tahun: 2006 Versi: 1.
Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.5 Public Key Algorithms.
The RSA Algorithm JooSeok Song Tue.
ASYMMETRIC CIPHERS.
Lecture 6: Public Key Cryptography
Introduction to Public Key Cryptography
Public Key Model 8. Cryptography part 2.
 Introduction  Requirements for RSA  Ingredients for RSA  RSA Algorithm  RSA Example  Problems on RSA.
1 CIS 5371 Cryptography 8. Asymmetric encryption-.
Prime Numbers Prime numbers only have divisors of 1 and self

Network and Communications Network Security Department of Computer Science Virginia Commonwealth University.
1 Network Security Lecture 6 Public Key Algorithms Waleed Ejaz
1 Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown Chapter 4 – Finite Fields.
Information Security and Management 4. Finite Fields 8
Great Theoretical Ideas in Computer Science.
RSA Ramki Thurimella.
Prelude to Public-Key Cryptography Rocky K. C. Chang, February
1 Lecture 9 Public Key Cryptography Public Key Algorithms CIS CIS 5357 Network Security.
Midterm Review Cryptography & Network Security
Public-Key Encryption
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
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.
CS461/ECE422 Spring 2012 Nikita Borisov — UIUC1.  Text Chapters 2 and 21  Handbook of Applied Cryptography, Chapter 8 
The RSA Algorithm. Content Review of Encryption RSA An RSA example.
PUBLIC-KEY CRYPTOGRAPH IT 352 : Lecture 2- part3 Najwa AlGhamdi, MSc – 2012 /1433.
22C:19 Discrete Structures Integers and Modular Arithmetic Fall 2014 Sukumar Ghosh.
Chapter 3 – Public Key Cryptography and RSA (A). Private-Key Cryptography traditional private/secret/single-key cryptography uses one key shared by both.
Scott CH Huang COM 5336 Cryptography Lecture 6 Public Key Cryptography & RSA Scott CH Huang COM 5336 Cryptography Lecture 6.
Chapter 9 Public Key Cryptography and RSA. Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender.
Lecture 6.1: Misc. Topics: Number Theory CS 250, Discrete Structures, Fall 2011 Nitesh Saxena.
CS 4803 Fall 04 Public Key Algorithms. Modular Arithmetic n Public key algorithms are based on modular arithmetic. n Modular addition. n Modular multiplication.
Ch1 - Algorithms with numbers Basic arithmetic Basic arithmetic Addition Addition Multiplication Multiplication Division Division Modular arithmetic Modular.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2015 Nitesh Saxena.
Dan Boneh Intro. Number Theory Fermat and Euler Online Cryptography Course Dan Boneh.
Great Theoretical Ideas in Computer Science.
Foundations of Network and Computer Security J J ohn Black CSCI 6268/TLEN 5550, Spring 2014.
ECE454/599 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2012.
Chapter 9 – Public Key Cryptography and RSA Every Egyptian received two names, which were known respectively as the true name and the good name, or the.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
CSEN 1001 Computer and Network Security Amr El Mougy Mouaz ElAbsawi.
Key Exchange in Systems VPN usually has two phases –Handshake protocol: key exchange between parties sets symmetric keys –Traffic protocol: communication.
Lecture 5 Asymmetric Cryptography. Private-Key Cryptography Traditional private/secret/single key cryptography uses one key Shared by both sender and.
RSA and El Gamal Cryptosystems
Number Theory (Chapter 7)
Private-Key Cryptography
ICS 353: Design and Analysis of Algorithms
Presentation transcript:

Introduction to Computer and Network Security Iliano Cervesato 2 September 2008 – Public-key Encryption

2 Where we are  Course intro  Cryptography  Intro to crypto  Modern crypto  Symmetric encryption  Asymmetric encryption  Beyond encryption  Cryptographic protocols  Attacking protocols  Program/OS security & trust  Networks security  Beyond technology

3 Outline  Public-key cryptography – motivations  The Merkle-Hellman encryption algorithm  The knapsack problem  How Merkle-Hellman works  Cryptoanalysis  Basic number theory  Modular arithmetic  Primality and inverses  The El Gamal encryption scheme  The discrete logarithm problem  RSA  The factorization problem  RSA cryptographic challenges

4 Asymmetric Encryption – Review D k (E k (m)) = m E D M M X X k Cleartext Ciphertext Public key Decryption box Encryption box k -1 Private key Public data k

5 Motivations  Can 2 keys be better than 1?  How do we make data public?  Why bother?  Key management problem  Added flexibility  E.g., digital signatures

6 Naïve Key Management Principals A 1, …, A n want to talk  Each pair needs a key  n(n-1)/2 keys  Keys must be established  Physical exchange  Secure channel …… A1A1 A2A2 A3A3 A4A4 A5A5

7 Improved Solution Centralized key- distribution center  n key pairs needed  However  KDC must be trusted  KDC is single point of failure  Still n direct exchanges KDC A1A1 A2A2 A3A3 A4A4 A5A5 k1k1 k2k2 k3k3 k4k4 k5k5 … if A i wants to talk to A j …  A i  KDC: “connect me to A j ”  KDC generates new key k ij  KDC  A i : E ki (k ij )  KDC  A j : E kj (k ij, “A i wants to talk”) Still naïve  KDC online all the time

8 Public-Key Solution  Pair (k i, k i -1 ) for each A i  k i ’s are published  Phonebook  Simple setup  A i generates (k i, k i -1 )  A i publishes k i  … details later  Secure web sites would be impossible without  https A1A1 k -1 1 AiAi k -1 i Public data A 1  k 1 … A i  k i …

9 The Knapsack problem  Given objects of size s 1, s 2, … s n, is it possible to completely fill a knapsack of size s?  Is there binary vector v such that  i v i s i = s ?  NP-complete  What if s i+1 >  j<i s j ?  Easy: O(n)  Super-increasing knapsack  Hmm, this feels like encryption material … for (i=n; i > 0; i--) { if (s > s i ) s = s – s i } return (s == 0)

10 Merkle-Hellman Encryption  Pick  a super-increasing sequence S = ( s 1,s 2,…,s n )  a prime p > s n digits long  a multiplier w  (S, w) is the private key  Compute  h i = w s i mod p  H = (h 1, h 2, …, h n ) is the public key  Encryption of binary m  x =  i h i m i  Attacker has to solve general knapsack in H – hard  Decryption of x  Multiply x by w -1  Solve super-increasing knapsack problem in S – easy

11 Cryptanalysis of Merkel-Hellman  Scheme based on a special instance of knapsack problem  modular knapsack generated from super- increasing sequence  Not as hard as general knapsack  If p is known  If s 1 can be found, all s i can be found  Can deduce w and p from H  Try successive values of w and observe where wh i rolls over  Right w is where they all roll over at the same time

12 Number Theory – Divisors  Z  Z = {…, -1, 0, 1, …}  + is commutative, associative and invertible w.r.t. 0  * is commutative, associative with identity 1  a|b if  c. ac = b  E.g., 3|6  E.g., 3|10 Z  gcd(a, b) = largest d  Z s.t. d|a and d|b  E.g. gcd(18,15) = 3  Modular arithmetic  a = b mod n if  c. an + c = b  Z n = {0, …, n-1}  All operations modulo n  Also a ring Euclid’s algorithm Given a > b  r 0 = b, r 1 = a  r i-2 = q i r i-1 + r i  When r n+1 = 0, set gcd(a,b) = r n   u,v. gcd(a,b) = ua + vb Z Z is a ring

13 Number Theory – Prime numbers  p>1 prime if 1 and p are its only divisors  E.g. 3, 5, 7, …  p and q are relatively prime if gcd(p,q) = 1  E.g. 4 and 5 are relative primes  There are infinitely many primes

14 Arithmetic Modulo a Prime  p prime number  For us, at least 1024 bits (~ 300 digits)  Z  Z p = {0, 1, …, p-1}  Addition and multiplication are modulo p  Exponentiation is iterated multiplication  x is the inverse of y  0 if xy = 1 mod p Z  All non-null elements of Z p are invertible  x -1 = x p-2 mod p Z  We can solve linear equations in Z * p  If ax = b mod p, then x = ba p-2 mod p  Z  Z * p = {1, …, p-1} Z  Contains all invertible elements of Z p  ZZ  Z p = Z * p U {0} Fermat’s little theorem If a  0, then a p-1 = 1 mod p Z Z p is a Galois field

15 Z Computing in Z p  Let n be the length of p  Usually around 1024 bits Z  Addition in Z p done in O(n)  Multiplication is O(n 2 )  Clever (and practical) algorithms achieve O(n 1.7 )  Same for inverse  x r mod p computed in O((log r) n 2 )  Repeated squares  E.g.: g 23 = g = g. g 2. g 4. g 16 (7 multiplications)  Addition chains  Saves 20% in average (but shortest chain is NP-complete)  g, g 2, g 3, g 5, g 10, g 20, g 23 (6 multiplications)

16 Z Complexity in Z p  Easy problems  Generating p  Addition, multiplication, exponentiation  Inversion, solving linear equations  Problems believed to be hard  DL: Discrete logarithm Z  Given g and x  Z p, find r s.t. x = g r mod p  DH: Diffie-Hellman Z  Given g, g r, g s  Z p, find g rs mod p  Note  DL implies DH  Unknown if DH implies DL  Best known attack on DL requires space and O(2  n ) time

17 Diffie-Hellman Key Exchange Public data p, g A B Choose random a 1  a  p-1 send g a mod p Receive g b mod p (g b ) a = g ab mod p k = f(g ab ) Receive g a mod p Choose random b 1  b  p-1 Send g b mod p (g a ) b = g ab mod p k = f(g ab ) g a mod p g b mod p

18 Diffie-Hellman Key Exchange [2]  Allows 2 principals to produce a shared secret  Without secure channel or physical exchange  Without a key distribution center  f is typically a hash function  Agreed upon in advance  However, no authentication  Can be fixed with some infrastructure  Security relies on hardness of DH

19 El Gamal Encryption Scheme  Security rests on hardness of DL  Criticisms  Transmitted message double of m  Public data has to be managed  Very slow (~10Kb/sec vs. 250Kb/s of DES) Public data A 1  p 1,g 1,g 1  1 … A i  p i,g i,g i  i … A B Choose random a Send g B a, g B  B a m mod p B Receive g B a, g B  B a m mod p B (g B a )  B = g B  B a mod p B Compute g B -  B a mod p B g B -  B a g B  B a m mod p B = m g B a, g B  B a m mod p B A wants to send AA BB Z secret m  Z p B to B

20 Arithmetic Modulo a Composite  n natural number  For us, typically 1024 bits or ~ 300 digits  Typically n = pq, with p and q primes  Z  Z n = {0, 1, …, n-1}  x is inverse of y  0 if xy = 1 mod n  x has inverse iff gcd(x,n) = 1  ux + vn = 1 by Euclid’s algorithm so x -1 = u Z  Works also in Z p where more efficient than x -1 = x p-2 Z  We can solve linear equations in Z n  Z  Z * n = {x : gcd(x,n) = 1} Z  Contains all invertible elements of Z n

21 Euler’s Totient Function   (n) is the number of positive integers relatively prime to n Z   (n) is the size of Z * n  If n =  i p i e i, then  (n) =  i p i e i-1 (p i -1)  If n=pq, then  (n) = (p-1)(q-1) = n – p – q – 1  a is invertible with inverse a  (n)-1 Euler’s theorem Z If a  Z * n, then a  (n) = 1 mod n

22 Cyclic Groups Z   (n) is the size of Z * n (Euler’s totient function)  If n =  i p i e i, then  (n) =  i p i e i-1 (p i -1)  If n=p, then  (n) = n-1  ZZZ  Z * n is cyclic if  g  Z * n s.t. Z * n = {g 0,g 1,g 2,…g  (n)-1 } ZZ  g is a generator of Z * n ( Z * n = )  Z  Z * n is cyclic iff n = 2, 4, p a, 2p a for an odd prime p Z  Every Z * n is cyclic Z  The order of a  Z * n is the smallest non-null d s.t. a d =1 mod n  If factorization of p-1 is known, –ord p (g) Z –A generator of Z * p can be found efficiently Lagrange theorem Z If a  Z * n, then ord p (a) | p-1 

23 Z Computing in Z n  Easy problems  Generating p  Addition, multiplication, exponentiation  Inversion, solving linear equations  Hard problems  Factoring  Given n, find p,q s.t. n = pq

24 The set-up of RSA  n = pq  n is the product of 2 (large) primes  By Euler’s theorem,  (n) = (p – 1)(q – 1)  Select e and d such that (m e ) d = m  How?  Pick e relative prime to  (n)  E.g., a prime greater than  (n)  By Fermat’s theorem, compute d = e  (n)-1  ed = 1 mod  (n)  ed = k  (n) + 1 = k(p-1)(q-1) + 1 = k’(p-1) + 1  Now:  m p-1 = 1 mod p  m k’  (n) = 1 mod p  m k’  (n)+1 = m mod p  m ed = m mod p

25 RSA [Rivest,Shamir,Adelman ’76]  Security of RSA rests on  Hard to factorize n = pq  Hard to compute  (n) from n  Factoring implies RSA  Unknown if RSA implies factoring Public data A 1  n 1,e 1 … A i  n i,e i … A B Send m e B mod n B Receive m e B mod n B (m e B ) d B mod n B = m e B d B mod n B = m k  (n B )+1 mod n B = (m  (n B ) ) k m mod n B = (1) k m mod n B = m mod n B m e B mod n B Z A wants to send secret m  Z n B to B p A,q A,d A p B,q B,d B n i = p i q i e i d i = 1 mod  (n i )

26 Attacks on RSA  Small d for fast decryption  But easy to crack if d < (n 1/4 )/3 [Wiener]  d should be at least  Small e for fast encryption  If m sent to more than e recipients, then m easily extracted  Popular e =  Same message should not be sent more than times  Modify message (still dangerous)  Timing attacks  Time to compute m d mod n for many m can reveal d  Homomorphic properties of RSA  If c i = m i e mod n (i=1,2), then c 1 c 2 = (m 1 m 2 ) e mod n  Easy chosen plaintext attack  Eliminated in standards based on RSA

27 RSA Cryptographic Challenges  Factoring given primes set as challenge by RSA Labs  –RSA-ddd: challenge in digits –RSA-bbb: challenge in bits  RSA-140: 1999 in 1 month  RSA-155: 1999 in 4 months  RSA-160: 2003 in 20 days  RSA-200: 2005 in 18 months  Challenges no longer active

28 Key length  Public-key crypto has very long keys  1024, 2048, 4096 are common  Is it more secure than symmetric crypto?  56, 128, 192, 256  Key lengths don’t compare!  1024  80 bit  2048  112 bit  3072  128 bit  7680  192 bit  15,360  256 bit