Network and Communications Network Security Department of Computer Science Virginia Commonwealth University.

Slides:



Advertisements
Similar presentations
Chapter 3 Public Key Cryptography and Message authentication.
Advertisements

CSE331: Introduction to Networks and Security Lecture 19 Fall 2002.
Public Key Encryption Algorithm
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.
Henric Johnson1 Chapter3 Public-Key Cryptography and Message Authentication Henric Johnson Blekinge Institute of Technology, Sweden
Cryptography and Network Security Chapter 9. Chapter 9 – Public Key Cryptography and RSA Every Egyptian received two names, which were known respectively.
Public Key Cryptography and the RSA Algorithm
Cryptography & Number Theory
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.
Chapter3 Public-Key Cryptography and Message Authentication.
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.
1 Pertemuan 08 Public Key Cryptography Matakuliah: H0242 / Keamanan Jaringan Tahun: 2006 Versi: 1.
Chapter 9 – Public Key Cryptography and RSA Private-Key Cryptography  traditional private/secret/single key cryptography uses one key  shared by both.
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.
The RSA Algorithm JooSeok Song Tue.
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.
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.
 Introduction  Requirements for RSA  Ingredients for RSA  RSA Algorithm  RSA Example  Problems on RSA.
1 Public-Key Cryptography and Message Authentication Ola Flygt Växjö University, Sweden
Prime Numbers Prime numbers only have divisors of 1 and self
Cryptography A little number theory Public/private key cryptography –Based on slides of William Stallings and Lawrie Brown.
1 Network Security Lecture 6 Public Key Algorithms Waleed Ejaz
10/1/2015 9:38:06 AM1AIIS. OUTLINE Introduction Goals In Cryptography Secrete Key Cryptography Public Key Cryptograpgy Digital Signatures 2 10/1/2015.
1 Lecture 9 Public Key Cryptography Public Key Algorithms CIS CIS 5357 Network Security.
Midterm Review Cryptography & Network Security
BASIC CRYPTOGRAPHIC CONCEPTS. Public Key Cryptography  Uses two keys for every simplex logical communication link.  Public key  Private key  The use.
Chapter 21 Public-Key Cryptography and Message Authentication.
Information Security -- Part II Public-Key Encryption and Hash Functions Frank Yeong-Sung Lin Information Management Department National Taiwan University.
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 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.
Cryptography and Network Security Chapter 9 - Public-Key Cryptography
The RSA Algorithm. Content Review of Encryption RSA An RSA example.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
PUBLIC-KEY CRYPTOGRAPH IT 352 : Lecture 2- part3 Najwa AlGhamdi, MSc – 2012 /1433.
PUBLIC KEY CRYPTOGRAPHY ALGORITHM Concept and Example 1IT352 | Network Security |Najwa AlGhamdi.
Cryptography & Network Security : Topic Seminar Description & Analysis Madhava.N 1RV06SCN05 2 nd Semester M.Tech CNE RVCE RSA ALGORITHM.
Cryptography and Network Security Public Key Cryptography and RSA.
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.
Fall 2002CS 395: Computer Security1 Chapter 9: Public Key Cryptography.
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.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Computer Security Lecture 5 Ch.9 Public-Key Cryptography And RSA Prepared by Dr. Lamiaa Elshenawy.
Lecture 3 (Chapter 9) Public-Key Cryptography and RSA Prepared by Dr. Lamiaa M. Elshenawy 1.
RSA Pubic Key Encryption CSCI 5857: Encoding and Encryption.
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.
Lecture 6. RSA Use in Encryption to encrypt a message M the sender: – obtains public key of recipient PU={e,n} – computes: C = M e mod n, where 0≤M
CSEN 1001 Computer and Network Security Amr El Mougy Mouaz ElAbsawi.
Public Key Cryptography. Asymmetric encryption is a form of cryptosystem in which Encryption and decryption are performed using the different keys—one.
Lecture 5 Asymmetric Cryptography. Private-Key Cryptography Traditional private/secret/single key cryptography uses one key Shared by both sender and.
Public Key Encryption ● Diffie and Hellman – 1976 Famous Paper: New Directions In Cryptography New Directions In Cryptography ● First revolutionary.
Public Key Cryptography
Public Key Encryption.
Private-Key Cryptography
ICS 353: Design and Analysis of Algorithms
PUBLIC-KEY CRYPTOGRAPHY AND RSA – Chapter 9
Introduction to Cryptography
Presentation transcript:

Network and Communications Network Security Department of Computer Science Virginia Commonwealth University

Topics Elements of Number Theory Public-Key Cryptography – Principles – Knapsack Algorithm – RSA algorithm – Computational aspects – Diffie – Hellman Key Exchange

Elements of Number Theory

Modular Arithmetic Modular Arithmetic is commutative, associative and distributive (a+b) mod n = ((a mod n) + (b mod n)) mod n (a*b) mod n = ((a mod n ) * (b mod n)) mod n (a*(b+c)) mod n = (((a*b) mod n) + ((a*c) mod n)) mod n 23 = 11 (mod 12) A = b (mod n) if a = b+kn for some integer k

Why Modular Arithmetic? Easy to compute with computer! Since it restricts the range of all intermediate values and result. For a k bit modulus, n, operation, the intermediate results of any +, -, *,/ will not be more than 2 k bit long Ex. a x mod n (a*a*a*a*a*a*a*a) mod n (a 2 mod n) 2 mod n) 2 mod n What id x is not a power of 2? a 25 mod n ? 25 = a 25 mod n = (a 16 * a 8 * a) mod n = ((a 2 *a) 8 *a) mod n = (a 2 *a) 2 ) 2 ) 2 *a) mod n = ((((((a 2 % n)*a) mod n) 2 ) mod n) 2 ) mod n) 2 ) mod n*a) mod n

Prime and Relatively Prime Numbers Any integer p>1 is a prime number if its only divisors are ±1 and ±p. Two integers a and b are relatively prime if they have no prime factors in common, that is, if their only common factor is 1. Equivalently, a and b are relatively prime if gcd(a,b)=1

Prime numbers >2 512

Fermat’s Theorem If p is prime and a is a positive integer not divisible by p, then a p-1 Ξ 1 mod p Alternatively, a p Ξ a mod p

Euler’s Totient Function Euler’s Totient Function Φ(n) is the number of positive integers less than n and relatively prime to n.

Euler’s Theorem For every a and n that are relatively prime, if GCD(a,n) = 1, then a Φ(n) Ξ 1 mod n Alternatively, a Φ(n)+1 Ξ a (mod n)

Inverse Modulo a Number What is the inverse of 4 in modulo 7 system 4*x = 1 (mod 7) Inverse of 2, modulo 14 In general a -1 = x (mod n) if a & n are relatively prime a Φ(n) mod n Ξ 1 x= a Φ(n)-1 mod n Inverse of 5, modulo7? Since Φ(n) = 6, X = mod 7 = 5 5 mod 7 = 3

Primitive Root Primitive Root of a prime number p is one whose powers generate all integers from 1 to p-1. If a is a primitive root of the prime number p, then the numbers a mod p, a 2 mod p, … a p-1 mod p are distinct and consist of integers from 1 to (p-1) in some permutation. 7? 3 0 = 13 1 = 33 2 = 23 3 = 63 4 = = 5

Public-Key Cryptography

Public Key Cryptography All Cryptographic Systems before this were based on Substitutions and Permutations Public-key cryptography is based on mathematical Functions Asymmetric – Uses two separate keys Use of two keys has profound consequences in : – Confidentiality – Authentication – Key Distribution

Public-Key Encryption: Myths and Realities Myth: More Secure than conventional encryption Reality: Security of any encryption depends on key length and computational effort required in breaking a cipher Myth: General purpose technique that has made conventional encryption obsolete Reality: Public-key cryptography has lot of computational overhead that makes it impractical in many applications Myth: Facilitates easy key distribution Reality: Requires some protocol, generally involving a central agent

Public-key Cryptography: Basics Six ingredients of the Scheme Plaintext, Public Key, Private Key, Encryption algorithm, Decryption Algorithm, Ciphertext Essential Steps (for communication from A to B at each end System/User) A and B Generate a pair of keys (public, private) A and B publish public key in a public register/file A encrypts message using B’s public key (for confidentiality) or using A’s private key (for authentication) B decrypts message using B’s private key (for confidentiality) or using A’s public key (for authentication)

Confidentiality Using Public-key System

Authentication Using Public-key System

Confidentiality and Authentication Using Public-key System

Conventional and Public-Key Encryption: A Comparison Conventional Encryption Needed to Work: 1. The same algorithm with the same key is used for encryption and decryption. 2. The sender and receiver must share the algorithm and the key. Needed for Security: 1. The key must be kept secret. 2. It must be impossible or at least impractical to decipher a message if no other information is available. 3. Knowledge of the algorithm plus samples of ciphertext must be insufficient to determine the key. Public Key Encryption Needed to Work: 1. One algorithm is used for encryption and decryption with a pair of keys, one for encryption and one for decryption. 2. The sender and receiver must each have one of the matched pair of keys (not the same one). Needed for Security: 1. One of the two keys must be kept secret. 2. It must be impossible or at least impractical to decipher a message if no other information is available. 3. Knowledge of the algorithm plus one of the keys plus samples of ciphertext must be insufficient to determine the other key.

Requirements for Public-Key Cryptography 1. Computationally easy for a party B to generate a pair (public key KU b, private key KR b ) 2. Easy for sender to generate ciphertext: 3. Easy for the receiver to decrypt ciphertect using private key:

Requirements for Public-Key Cryptography (contd.) 4. Computationally infeasible to determine private key (KRb) knowing public key (KUb) 5. Computationally infeasible to recover message M, knowing KUb and ciphertext C 6. Either of the two keys can be used for encryption, with the other used for decryption:

Public-Key Cryptographic Algorithms KnapSack, Diffie-Hellman and RSA Diffie-Hellman – Exchange a secret key securely – Based on difficulty of discrete logarithms RSA - Ron Rivest, Adi Shamir and Len Adleman at MIT, in – RSA is a block cipher – Based on difficulty of prime factorization – The most widely implemented

Knapsack Algorithm Given a set of values M 1, M 2,..M n and a sum S compute b i such that S = b 1 M 1 + b 2 M 2 + … + b n M n 1, 5, 6, 11, 14, 20 S = 22 Super increasing Knapsack {1,3,13,27,52} 5, 6, 11 What if S = 24?

Example {2,3,6,13,27,52} Fins n > sum of all weight and multiplier such that gcd(m,n) = 1 Do multiplication (31,105) 2*31 mod 105 = 62,… – {62,93,81,88,102,37} = = 174 = C 174 *61 mod 105 = 9 = 3+6 = mod 105 ? mod 105

RSA Algorithm: Basics Block Cipher – Block has binary value Block Size ≤ log 2 (n) – Block Size k bits: 2 k <n ≤2 k+1 M: message; C: ciphertext; {e,n}: public key; {d,n}: private key Both Sender and receiver know n; Sender knows e, receiver knows d. C = M e mod n M = C d mod n = (M e ) d mod n = M e d mod n Requirements: – Possible to find e,d,n s.t. M e d = M mod n for all M<n – Relatively easy to compute M e and C d for all M<n – Infeasible to determine d given e and n

Relationship between d and e Required: M ed = M mod n Corollary to Euler’s theorem – Given two prime numbers p and q and two integers m and n such that n=pq and 0<m<n and an arbitrary integer k,: m kΦ(n)+1 = m k(p-1)(q-1)+1 Ξ m mod n, where Φ(n) is the Euler Totient Function From the above, ed = KΦ(n)+1 satisfies the requirement  ed =1 mod Φ(n) d Ξ e -1 mod Φ(n)  e and d are multiplicative inverses mod Φ(n)

The RSA Algorithm – Key Generation 1. Select p,q p and q both prime 2. Calculate n = p x q 3. Calculate 4. Select integer e 5. Calculate d 6. Public KeyKU = {e,n} 7. Private keyKR = {d,n}

The RSA Algorithm - Encryption Plaintext:M<n Ciphertext:C = M e (mod n)

The RSA Algorithm - Decryption Ciphertext:C Plaintext:M = C d (mod n)

Example of RSA Algorithm For this example, they keys were generated as follows: 1.Select two prime numbers, p = 7 and q = 17 2.Calculate n = pq = 7 x 17 = Calculate Φ(n) = (p-1)(q-1) = 96 4.Select e such that e is relatively prime to Φ(n)=96 and less than Φ(n); in this case e = 5 5.Determine d such that de = 1 mod 96 and d< 96. The correct value is d=77, because 77 x 5 = 385 = 4 x The resulting keys are public key KU = {5, 119} are private key KR= {77, 119}. The example shows the use of these keys for a plaintext input of M = 19.

Computational Aspects Raising an integer to an integer power mod n (M e, C d ) – fast exponentiation algorithms – Useful property of modular arithmetic: (a x b) mod n = [(a mod n) x (b mod n)] mod n Finding Large Prime Numbers (p,q) – Currently, no useful techniques to yield arbitrarily large primes – Generate a random odd number and test for primality Probabilistic algorithms (ex Miller-Rabin algorithm) Selecting e(d) and calculating d(e) – Extended Euclid’s algorithm

Security of RSA Three kinds of attacks: Brute force: trying all possible private keys Mathematical attacks: approaches to factoring the product of two primes Suggestions: – p,q differ in length by only a few digits. (p,q order of to ) – Both (p-1) and (q-1) should contain a large prime factor – gcd(p-1, q-1) should be small Timing attacks: based on running time of decryption algorithm Countermeasures: – Ensure constant exponentiation time – Add random delay to exponentiation algorithm – Bliding (multiply ciphertext by a random number before exponentiation)

Diffie - Hellman Key Exchange Scheme First published public-key algorithm (1976) Based on difficulty of computing Discrete Logarithms Enables two users to exchange a key securely to be used for subsequent message encryption Several commercial products based on this technique

Diffie - Hellman Key Exchange Algorithm

Diffie – Hellman Key Exchange Operation q, α are required to be known ahead of time ( or A could pick q and α and include in the first message)

Diffie – Hellman Exchange Example Key exchange is based on the use of prime number q=97 and a primitive root of 97, in this case α = 5. A and B select secret keys X A =36 and X B =58, respectively. Each computes its public key: K = (Y B ) X A mod 97 = = 75 mod 97 K = (Y A ) X B mod 97 = = 75 mod 97 From X A, X B, an attacker cannot easily compute 75.

Diffie – Hellman Exchange Example Key exchange is based on the use of prime number q=97 and a primitive root of 97, in this case α = 5. A and B select secret keys XA=36 and XB=58, respectively. Each computes its public key: K = (Y B ) X A mod 97 = = 75 mod 97 K = (Y A ) X B mod 97 = = 75 mod 97 From [50,44], an attacker cannot easily compute 75.

For any integer ‘b’ and a primitive root ‘a’ of prime number ‘p’, one can find a unique exponent ‘i’ such that b = a i mod p where 0 ≤ i ≤ (p-1) The exponent ‘i’ is called the Discrete Logarithm or index of b for the base a mod p. Given a,i, and p, it is straightforward to compute b. Given a,b, and p, it is computationally infeasible to compute the discrete logarithm i.