1 Network Security Lecture 6 Public Key Algorithms Waleed Ejaz

Slides:



Advertisements
Similar presentations
CSE331: Introduction to Networks and Security Lecture 19 Fall 2002.
Advertisements

22C:19 Discrete Structures Integers and Modular Arithmetic
Public Key Encryption Algorithm
Notation Intro. Number Theory Online Cryptography Course Dan Boneh
Great Theoretical Ideas in Computer Science.
YSLInformation Security -- Public-Key Cryptography1 Elliptic Curve Cryptography (ECC) For the same length of keys, faster than RSA For the same degree.
ELECTRONIC PAYMENT SYSTEMSFALL 2002COPYRIGHT © 2002 MICHAEL I. SHAMOS Electronic Payment Systems Lecture 6 Epayment Security II.
Public-key Cryptography Montclair State University CMPT 109 J.W. Benham Spring, 1998.
Dr Alejandra Flores-Mosri Message Authentication Internet Management & Security 06 Learning outcomes At the end of this session, you should be able to:
CS470, A.SelcukPublic Key Cryptography1 CS 470 Introduction to Applied Cryptography Instructor: Ali Aydin Selcuk.
Cryptography1 CPSC 3730 Cryptography Chapter 9 Public Key Cryptography and RSA.
Cryptography1 CPSC 3730 Cryptography Chapter 13 Digital Signature Standard (DSS)
Fall 2010/Lecture 311 CS 426 (Fall 2010) Public Key Encryption and Digital Signatures.
Public Key Algorithms 4/17/2017 M. Chatterjee.
Public Key Cryptography RSA Diffie Hellman Key Management Based on slides by Dr. Lawrie Brown of the Australian Defence Force Academy, University College,
RSA Encryption Caitlin O’Dwyer. What is an RSA Number? An RSA number n is a number s.t. n=pq Where p and q are distinct, large, prime integers.
ASYMMETRIC CIPHERS.
“RSA”. RSA  by Rivest, Shamir & Adleman of MIT in 1977  best known & widely used public-key scheme  RSA is a block cipher, plain & cipher text are.
Cryptography and Network Security Chapter 13
Lecture 6: Public Key Cryptography
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
The RSA Algorithm Based on the idea that factorization of integers into their prime factors is hard. ★ n=p . q, where p and q are distinct primes Proposed.
 Introduction  Requirements for RSA  Ingredients for RSA  RSA Algorithm  RSA Example  Problems on RSA.
Prime Numbers Prime numbers only have divisors of 1 and self
Network and Communications Network Security Department of Computer Science Virginia Commonwealth University.
RSA Public Key Algorithm. RSA Algorithm history  Invented in 1977 at MIT  Named for Ron Rivest, Adi Shamir, and Len Adleman  Based on 2 keys, 1 public.
Digital Signatures: Mathematics Zdeněk Říha. Data authentication Data integrity + data origin Digital signature Asymmetric cryptography public and private.
RSA and its Mathematics Behind
Great Theoretical Ideas in Computer Science.
RSA Ramki Thurimella.
10/1/2015 9:38:06 AM1AIIS. OUTLINE Introduction Goals In Cryptography Secrete Key Cryptography Public Key Cryptograpgy Digital Signatures 2 10/1/2015.
Prelude to Public-Key Cryptography Rocky K. C. Chang, February
Cryptography Dec 29. This Lecture In this last lecture for number theory, we will see probably the most important application of number theory in computer.
1 Lecture 9 Public Key Cryptography Public Key Algorithms CIS CIS 5357 Network Security.
BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.
Public Key Encryption CS432 – Security in Computing Copyright © 2005, 2008 by Scott Orr and the Trustees of Indiana University.
Public-Key Encryption
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
RSA Slides by Kent Seamons and Tim van der Horst Last Updated: Oct 1, 2013.
CS461/ECE422 Spring 2012 Nikita Borisov — UIUC1.  Text Chapters 2 and 21  Handbook of Applied Cryptography, Chapter 8 
Algebra of RSA codes Yinduo Ma Tong Li. Ron Rivest, Adi Shamir and Leonard Adleman.
The RSA Algorithm. Content Review of Encryption RSA An RSA example.
PUBLIC-KEY CRYPTOGRAPH IT 352 : Lecture 2- part3 Najwa AlGhamdi, MSc – 2012 /1433.
RSA and its Mathematics Behind July Topics  Modular Arithmetic  Greatest Common Divisor  Euler’s Identity  RSA algorithm  Security in RSA.
Public Key Cryptosystems RSA Diffie-Hellman Department of Computer Engineering Sharif University of Technology 3/8/2006.
Lecture 6.1: Misc. Topics: Number Theory CS 250, Discrete Structures, Fall 2011 Nitesh Saxena.
Public Key Algorithms Lesson Introduction ●Modular arithmetic ●RSA ●Diffie-Hellman.
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.
Digital Signature Standard (DSS) US Govt approved signature scheme designed by NIST & NSA in early 90's published as FIPS-186 in 1991 revised in 1993,
Week 4 - Wednesday.  What did we talk about last time?  Finished DES  AES.
Lecture 3 (Chapter 9) Public-Key Cryptography and RSA Prepared by Dr. Lamiaa M. Elshenawy 1.
Introduction to Elliptic Curve Cryptography CSCI 5857: Encoding and Encryption.
RSA Pubic Key Encryption 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.
1 Introduction to Information Security , Spring 2016 Lecture 4: Applied cryptography: asymmetric Zvi Ostfeld Slides credit: Eran Tromer.
Key Exchange in Systems VPN usually has two phases –Handshake protocol: key exchange between parties sets symmetric keys –Traffic protocol: communication.
Cryptography and Network Security Chapter 13
Lecture 5 Asymmetric Cryptography. Private-Key Cryptography Traditional private/secret/single key cryptography uses one key Shared by both sender and.
Public Key Cryptosystem
Asymmetric-Key Cryptography
Network Security Design Fundamentals Lecture-13
RSA Slides by Kent Seamons and Tim van der Horst
PUBLIC-KEY ENCRYPTION Focusing on RSA
RSA and El Gamal Cryptosystems
Analysis of the RSA Encryption Algorithm
Presentation transcript:

1 Network Security Lecture 6 Public Key Algorithms Waleed Ejaz

2 Overview 1. Number Theory 2. RSA Public Key Encryption 3. Public-Key Cryptography Standards (PKCS) 4. Diffie-Hellman Key Agreement 5. Digital Signature Standard 6. Elliptic Curve Cryptography (ECC) 7. Zero-Knowledge Proof Systems

3 Public Key Encryption Invented in 1975 by Diffie and Hellman Encrypted_Message = Encrypt(Key1, Message) Message = Decrypt(Key2, Encrypted_Message)

4 Public Key Encryption Example Rivest, Shamir, and Adleman RSA: Encrypted_Message = m 3 mod 187 Message = Encrypted_Message 107 mod 187 Key1 =, Key2 = Message = 5 Encrypted Message = 5 3 = 125 Message = mod 187 = 5 = 125 ( ) mod 187 = {( mod 187)( mod 187)... (125 2 mod 187)(125 mod 187)} mod 187

5 Modular Arithmetic xy mod m = (x mod m) (y mod m) mod m x 4 mod m = (x 2 mod m)(x 2 mod m) mod m x ij mod m = (x i mod m) j mod m 125 mod 187 = mod 187 = mod 187 = mod 187 = (1252 mod 187) 2 mod 187 = mod 187 = mod 187 = mod 187 = mod 187 = mod 187 = mod 187 = mod 187 = mod 187 = mod 187 = mod 187 = mod 187 = 69×137×152×104×125 mod 187 = mod 187 = 5

6 Definitions Co-Prime = Relatively Prime: x and y are relatively prime if gcd(x,y)=1  Example: 6, 11 Inverse: x is inverse of y if xy=1 mod n  If ux + vn = 1, x -1 = u mod n  Example: what is inverse of 6 mod 11 2 × × 11 = 1 ⇒ Inverse of 6 mod 11 is 2. Smooth Number = Product of small primes

7 Euclid’s Algorithm Goal: To find greatest common divisor Example: gcd(10,25)=5 using long division 10) 25 ( )10 (

8 Euclid's Algorithm: Tabular Method

9 Chinese Remainder Theorem The solution to the following equations: x = a 1 mod n 1 x = a 2 mod n 2 x = a k mod n k where n 1, n 2,..., n k are relatively prime is found as follows: N = n 1 n 2... N k Standard Representation: x mod n 1, n 2,..., n k Decomposed Form: a 1 mod n 1, a 2 mod n 2 ………..a k mod n k

10 Chinese Remainder Theorem (contd.)

11 Euler's Totient Function Z n = Set of all numbers mod n = {0, 1, 2,., n-1} Z n * = Set of all numbers relatively primes to n Φ(n) = Number of elements in Z n * If n is prime, Φ(n)=n-1 Example: Z 10 ={0, 1, 2, 3,..., 9} Z 10 * = {1, 3, 7, 9} Φ(10)=4

12 Euler’s Theorem

13 Fermat’s Theorm

14 Miller and Rabin Method Prime Test Express n-1 as 2 b c where c is odd. Pick a random a. a n-1 = a 2 b c = (a c ) 2 b Compute a c mod n Square it b times: a 2c, a 4c, a 8c,..., a {2 b }c If the final result is not one ⇒ n is not a prime If any of the intermediate results is 1, check if the previous number is ±1. If ±1 then n is potentially prime. Pick another a and try again.

15 RSA Public Key Encryption Ron Rivest, Adi Shamir, and Len Adleman at MIT 1978 Both plain text M and cipher text C are integers between 0 and n- 1. Key 1 = {e, n}, Key 2 = {d, n} C = M e mod n M = C d mod n How to construct keys:  Select two large primes: p, q, p ≠ q  n = p×q  Calculate Euler’s Totient Fn Φ(n) = (p-1)(q-1)  Select e relatively prime to Φ ⇒ gcd(Φ, e) = 1; 0 < e < Φ  Calculate d = inverse of e mod Φ ⇒ de mod Φ = 1  Euler.s Theorem: x ed = x kΦ(n)+1 = x mod n

16 RSA Key Construction: Example Select two large primes: p, q, p ≠ q p = 17, q = 11 n = p×q = 17×11 = 187 Calculate Φ = (p-1)(q-1) = 16x10 = 160 Select e, such that gcd(Φ, e) = 1; 0 < e < Φ say, e = 7 Calculate d such that de mod Φ = 1  160k+1 = 161, 321, 481, 641  Check which of these is divisible by 7  161 is divisible by 7 giving d = 161/7 = 23 Key 1 = {7, 187}, Key 2 = {23, 187}

17 RSA Issues RSA is computationally intense. Commonly used key lengths are 512 bits The plain text should be smaller than the key length The encrypted text is same size as the key length Generally used to encrypt secret keys. Basis: Factoring a big number is hard

18 Finding d and e de = 1 mod Φ(n) Select e first, e.g., e= or ⇒ Exponentiation is easy. Find inverse of e using Euler’s algorithm The public key can be small. The private key should be large. ⇒ Don’t select d=3. Both d and n are 512 bit numbers.

19 Optimizing Private Key Operations

20 Attacks on RSA

21 Public Key Cryptography Standards

22 Million Message Attack on RSA In SSL if padding is incorrect, some Servers send “Incorrect Padding" error Attacker sends random variations until server accepts (decrypted message begins with 02) Would need 2 16 tries to get the correct 16 bits PKCS#1 Rev 2 fixes this problem. Not sending error message is easier fix.

23 Deffie-Hellman Key Agreement

24 Deffie-Hellman (contd.) Example: g=5, p=19  A selects 6 and sends 5 6 mod 19 = 7  B selects 7 and sends 5 7 mod 19 = 16  A computes K = 16 6 mod 19 = 7  B computes K = 7 7 mod 19 = 7 Preferably (p-1)/2 should also be a prime. Such primes are called safe prime.

25 Man-in-Middle Attack on Deffie-Hellman

26 EIGamal Signatures

27 Digital Signature Standard FIPS 186 in 1991, in 1993, in A variation of ElGamal signature Choose a hash. Default = SHA-1 Select a key size L: multiple of 64 between 512 to requires recommends 2048 or 3072 for lifetimes beyond Algorithm Parameters: Choose a prime q with the same number of bits as hash Select a L-bit prime p such that p-1 is a multiple of q Select a generator g such that g q = 1 mod p This can be done by g=h (p-1)/q mod p for some arbitrary h 1<h<p- 1. Algorithm parameters (p, q, g) may be shared among users.

28 DSS (contd.) 2. User Keys: public and private key for a user  Choose S randomly 0 <S <p  T = g S mod p  Public key is (p, q, g, T). Private key is S. 3. Signing: Generate per message key S m, 0<S m <q  Tm = (g S m mod p) mod q  Compute S m -1 mod q  Calculate message digest d m  Signature X = S m -1 (d m + ST m ) mod q  Transmit message m, per message public number T m, and signature X

29 DSS (contd.) 4. Verification:  Calculate inverse of signature X -1 mod q  Calculate message digest d m  Calculate x = d m X -1 mod q  y = T m x -1 mod q  z = (g x T y mod p)mod q  If z = T m then signature is verified.

30 DSS Insecurity is shared. Anyone who breaks can break all the users sharing it. Slower than RSA with e=3 Both RSA and Diffie-Hellman require sub- exponential super-polynomial effort

31 Elliptic Curve Cryptography (ECC) Based on algebraic structure of elliptic curves over finite fields Elliptic curve is a plane curve y 2 +axy+by = x 3 +cx 2 +d x +e The set of points on the curve along with the point at infinity form a set over which operations similar to modular arithmetic can be defined. Multiplying two points results in a third point. The point at infinity is the identity element. ECC is still exponential difficulty and so key lengths can be shorter.

32 Zero-Knowledge Proof Systems The verifier can verify that you possess the secret but gets no knowledge of the secret. Any NP-complete problem can be used. In graph theory, if you know Hamiltonian cycle of a large graph you can easily generate isomorphic graphs. [Source: Wikipedia]

33 Summary Public key cryptography uses two keys: public key and private key Modular Arithmetic, Euler.s algorithm, Euler.s theorm, Fermat.s theorem, Chinese remainder theorem RSA is based on difficulty of factorization Diffie-Hellman is based on difficulty of discrete logarithms. Digital signature standard is similar to Diffie-Hellman

34 References Chapter 6 and 7 of the text book Wikepedia entries:         

35 Questions!