Systems Architecture I

Slides:



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

Primality Testing Patrick Lee 12 July 2003 (updated on 13 July 2003)
Public Key Encryption Algorithm
Session 4 Asymmetric ciphers.
Complexity1 Pratt’s Theorem Proved. Complexity2 Introduction So far, we’ve reduced proving PRIMES  NP to proving a number theory claim. This is our next.
and Factoring Integers
ElGamal Public Key Cryptography CS 303 Alg. Number Theory & Cryptography Jeremy Johnson Taher ElGamal, "A Public-Key Cryptosystem and a Signature Scheme.
Introduction to Modular Arithmetic and Public Key Cryptography.
Prelude to Public-Key Cryptography Rocky K. C. Chang, February
Midterm Review Cryptography & Network Security
Modular Arithmetic with Applications to Cryptography Lecture 47 Section 10.4 Wed, Apr 13, 2005.
RSA Slides by Kent Seamons and Tim van der Horst Last Updated: Oct 1, 2013.
Algebra of RSA codes Yinduo Ma Tong Li. Ron Rivest, Adi Shamir and Leonard Adleman.
Chinese Remainder Theorem Dec 29 Picture from ………………………
1 Network and Computer Security (CS 475) Modular Arithmetic and the RSA Public Key Cryptosystem Jeremy R. Johnson.
Scott CH Huang COM 5336 Cryptography Lecture 6 Public Key Cryptography & RSA Scott CH Huang COM 5336 Cryptography Lecture 6.
Lecture 6.1: Misc. Topics: Number Theory CS 250, Discrete Structures, Fall 2011 Nitesh Saxena.
Network and Computer Security (CS 475) Modular Arithmetic
1 Section Congruences In short, a congruence relation is an equivalence relation on the carrier of an algebra such that the operations of the algebra.
1 Thinking the Impossible “Modern Cryptography” Jeremy R. Johnson.
Ch1 - Algorithms with numbers Basic arithmetic Basic arithmetic Addition Addition Multiplication Multiplication Division Division Modular arithmetic Modular.
Great Theoretical Ideas in Computer Science for Some.
Modular Arithmetic and the RSA Cryptosystem Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 9Sept 27, 2005Carnegie.
Great Theoretical Ideas in Computer Science.
Great Theoretical Ideas In Computer Science COMPSCI 102 Fall 2010 Lecture 16October 27, 2010Duke University Modular Arithmetic and the RSA Cryptosystem.
Cryptography Lecture 14 Arpita Patra © Arpita Patra.
RSA Cryptosystem Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS Spring 2006 Lecture 8Feb. 09, 2006Carnegie Mellon University.
May 9, 2001Applied Symbolic Computation1 Applied Symbolic Computation (CS 680/480) Lecture 6: Multiplication, Interpolation, and the Chinese Remainder.
Lecture 5 Asymmetric Cryptography. Private-Key Cryptography Traditional private/secret/single key cryptography uses one key Shared by both sender and.
Revision. Cryptography depends on some properties of prime numbers. One of these is that it is rather easy to generate large prime numbers, but much harder.
Public Key Cryptography
Outline Primitive Element Theorem Diffie Hellman Key Distribution
Modular Arithmetic and the RSA Cryptosystem
Thinking the Impossible “Modern Cryptography”
Mathematics of Cryptography
Chapter Applications of Number Theory Some Useful Results
RSA Slides by Kent Seamons and Tim van der Horst
Topic 12: Number Theory Basics (2)
CS 2210:0001Discrete Structures Modular Arithmetic and Cryptography
Prelude to Public-Key Cryptography
Advanced Algorithms Analysis and Design
Lecture 3.2: Public Key Cryptography II
Advanced Algorithms Analysis and Design
RSA Preliminaries.
Number-Theoretic Algorithms (UNIT-4)
Introduction to Number Theory
RSA and El Gamal Cryptosystems
Number Theory and Modular Arithmetic
Coin Flipping Protocol
Applied Symbolic Computation (CS 300) Modular Arithmetic
Number Theory and Euclidean Algorithm
Number Theory.
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Public-key encryption
Analysis of the RSA Encryption Algorithm
Applied Symbolic Computation (CS 300) Modular Arithmetic
Modular Arithmetic and the RSA Cryptosystem
Classical Ciphers – 2 CSCI284 Spring 2004 GWU
Applied Symbolic Computation (CS 300) Modular Arithmetic
Algorithmic Number Theory and Cryptography (CS 303) Modular Arithmetic
Applied Symbolic Computation (CS 300) Modular Arithmetic
Applied Symbolic Computation (CS 300) Modular Arithmetic
CSCI284 Spring 2009 GWU Sections 5.1, 5.2.2, 5.3
Introduction to Algorithms Second Edition by
Applied Symbolic Computation (CS 300) Modular Arithmetic
Patrick Lee 12 July 2003 (updated on 13 July 2003)
Rayat Shikshan Sanstha’s S.M.Joshi College, Hadapsar -28
Clements MAΘ October 30th, 2014
Presentation transcript:

Systems Architecture I September 4, 1997 Applied Symbolic Computation (CS 680/480) Lecture 5: Modular Arithmetic and the RSA Public Key Cryptosystem Jeremy R. Johnson April 25, 2001 April 2, 2001 Systems Architecture I

Systems Architecture I September 4, 1997 Introduction Objective: To understand what a public key cryptosystem is and how the RSA algorithm works. To review the number theory behind the RSA algorithm. Public Key Cryptosystems RSA Algorithm Modular Arithmetic Euler’s Identity Chinese Remainder Theorem References: Rivest, Shamir, Adelman. April 2, 2001 Systems Architecture I

Modular Arithmetic (Zn) Definition: a  b (mod n)  n | (b - a) Alternatively, a = qn + b Properties (equivalence relation) a  a (mod n) [Reflexive] a  b (mod n)  b  a (mod n) [Symmetric] a  b (mod n) and b  c (mod n)  a  c (mod n) [Transitive] Definition: An equivalence class mod n [a] = { x: x  a (mod n)} = { a + qn | q  Z} April 2, 2001 Systems Architecture I

Modular Arithmetic (Zn) It is possible to perform arithmetic with equivalence classes mod n. [a] + [b] = [a+b] [a] * [b] = [a*b] In order for this to make sense, you must get the same answer (equivalence) class independent of the choice of a and b. In other words, if you replace a and b by numbers equivalent to a or b mod n you end of with the sum/product being in the same equivalence class. a1  a2 (mod n) and b1  b2 (mod n)  a1+ b1  a2 + b2 (mod n) a1* b1  a2 * b2 (mod n) (a + q1n) + (b + q2n) = a + b + (q1 + q2)n (a + q1n) * (b + q2n) = a * b + (b*q1 + a*q2 + q1* q2)n April 2, 2001 Systems Architecture I

Systems Architecture I Representation of Zn The equivalence classes [a] mod n, are typically represented by the representatives a. Positive Representation: Choose the smallest positive integer in the class [a] then the representation is {0,1,…,n-1}. Symmetric Representation: Choose the integer with the smallest absolute value in the class [a]. The representation is {-(n-1)/2 ,…, n/2 } E.G. Z6 = {-2,-1,0,1,2,3}, Z5 = {-2,-1,0,1,2} April 2, 2001 Systems Architecture I

Systems Architecture I Modular Inverses Definition: x is the inverse of a mod n, if ax  1 (mod n) The equation ax  1 (mod n) has a solution iff gcd(a,n) = 1. By the Extended Euclidean Algorithm, there exist x and y such that ax + ny = gcd(a,n). When gcd(a,n) = 1, we get ax + ny = 1. Taking this equation mod n, we see that ax  1 (mod n) April 2, 2001 Systems Architecture I

Systems Architecture I Fermat’s Theorem Theorem: If a  0  Zp, then ap-1  1 (mod p). More generally, if a  Zp, then ap  a (mod p). Proof: Assume that a  0  Zp. Then a * 2a * … (p-1)a = (p-1)! * ap-1 Also, since a*i  a*j (mod p)  i  j (mod p), the numbers a, 2a, …, (p-1)a are distinct elements of Zp. Therefore they are equal to 1,2,…,(p-1) and their product is equal to (p-1)! mod p. This implies that (p-1)! * ap-1  (p-1)! (mod p)  ap-1  1 (mod p). April 2, 2001 Systems Architecture I

Systems Architecture I Euler phi function Definition: phi(n) = #{a: 0 < a < n and gcd(a,n) = 1} Properties: (p) = p-1, for prime p. (p^e) = (p-1)*p^(e-1)  (m*n) =  (m)* (n) for gcd(m,n) = 1. (p*q) = (p-1)*(q-1) Examples: (15) = (3)* (5) = 2*4 = 8. = #{1,2,4,7,8,11,13,14} (9) = (3-1)*3^(2-1) = 2*3 = 6 = #{1,2,4,5,7,8} April 2, 2001 Systems Architecture I

Systems Architecture I Euler’s Identity The number of elements in Zn that have multiplicative inverses is equal to phi(n). Theorem: Let (Zn)* be the elements of Zn with inverses (called units). If a  (Zn)*, then a(n)  1 (mod n). Proof. The same proof presented for Fermat’s theorem can be used to prove this theorem. April 2, 2001 Systems Architecture I

Chinese Remainder Theorem Theorem: If gcd(m,n) = 1, then given a and b there exist an integer solution to the system: x  a (mod m) and x = b (mod n). Proof: Consider the map x  (x mod m, x mod n). This map is a 1-1 map from Zmn to Zm  Zn, since if x and y map to the same pair, then x  y (mod m) and x  y (mod n). Since gcd(m,n) = 1, this implies that x  y (mod mn). Since there are mn elements in both Zmn and Zm  Zn, the map is also onto. This means that for every pair (a,b) we can find the desired x. April 2, 2001 Systems Architecture I

Alternative Interpretation of CRT Let Zm  Zn denote the set of pairs (a,b) where a  Zm and b  Zn. We can perform arithmetic on Zm  Zn by performing componentwise modular arithmetic. (a,b) + (c,d) = (a+b,c+d) (a,b)*(c,d) = (a*c,b*d) Theorem: Zmn  Zm  Zn. I.E. There is a 1-1 mapping from Zmn onto Zm  Zn that preserves arithmetic. (a*c mod m, b*d mod n) = (a mod m, b mod n)*(c mod m, d mod n) (a+c mod m, b+d mod n) = (a mod m, b mod n)+(c mod m, d mod n) The CRT implies that the map is onto. I.E. for every pair (a,b) there is an integer x such that (x mod m, x mod n) = (a,b). April 2, 2001 Systems Architecture I

Constructive Chinese Remainder Theorem Theorem: If gcd(m,n) = 1, then there exist em and en (orthogonal idempotents) em  1 (mod m) em  0 (mod n) en  0 (mod m) en  1 (mod n) It follows that a*em + b* en  a (mod m) and  b (mod n). Proof. Since gcd(m,n) = 1, by the Extended Euclidean Algorithm, there exist x and y with m*x + n*y = 1. Set em = n*y and en = m*x April 2, 2001 Systems Architecture I

Public Key Cryptosystem Let M be a message and let C be the encrypted message (ciphertext). A public key cryptosystem has a separate method E() for encrypting and D() decrypting. D(E(M)) = M Both E() and D() are easy to compute Publicly revealing E() does not make it easy to determine D() E(D(M)) = M - needed for signatures The collection of E()’s are made publicly available but the D()’s remain secret. Called a one-way trap-door function (hard to invert, but easy if you have the secret information) April 2, 2001 Systems Architecture I

RSA Public Key Cryptosystem Based on the idea that it is hard to factor large numbers. First encode M as an integer (e.g. use ASCII). Large messages will need to be blocked. Choose n = p*q, the product of two large prime numbers. Choose e such that gcd(e,phi(n)) = 1. Choose d such that de  1 (mod  (n)) E = (e,n) and E(M) = Me mod n D = (d,n) and D(M) = Md mod n April 2, 2001 Systems Architecture I

Correctness of the RSA Algorithm Theorem: D(E(M)) = E(D(M)) = M. Proof. D(E(M)) = (Me)d (mod n) = Med (mod n). Since ed  1 (mod  (n)), ed = k*  (n) + 1, for some integer k. Mk* (n)+1  (Mk* (n)+1 mod p, Mk* (n)+1 mod q) = (Mk* (n) * M mod p, Mk* (n) * M mod q) = (M(p-1)*(q-1)*k * M mod p, M(q-1)*(p-1)*k * M mod q) [since n = pq] = ((M(p-1))(q-1)*k * M mod p, (M(q-1))(p-1)*k * M mod q) = (M mod p, M mod q) [By Fermat’s theorem] Therefore, by the CRT, Mk* (n)+1  M (mod n). April 2, 2001 Systems Architecture I