Fall 2002CS 395: Computer Security1 Chapters 4 and 8: The Mathematics Required for Public Key Cryptography In case you’re beginning to worry that this.

Slides:



Advertisements
Similar presentations
Cryptography and Network Security Chapter 8 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Advertisements

Cryptography and Network Security Chapter 8 Fourth Edition by William Stallings Lecture slides by Lawrie Brown Modified – Tom Noack.
Cryptography and Network Security Chapter 8 Fourth Edition by William Stallings.
1 Lect. 12: Number Theory. Contents Prime and Relative Prime Numbers Modular Arithmetic Fermat’s and Euler’s Theorem Extended Euclid’s Algorithm.
Cryptography and Network Security, Finite Fields From Third Edition by William Stallings Lecture slides by Mustafa Sakalli so much modified..
Cryptography and Network Security
Cryptography and Network Security
Chapter 4 Finite Fields. Introduction of increasing importance in cryptography –AES, Elliptic Curve, IDEA, Public Key concern operations on “numbers”
Cryptography and Network Security Chapter 4 Fourth Edition by William Stallings.
Chapter 4 – Finite Fields. Introduction will now introduce finite fields of increasing importance in cryptography –AES, Elliptic Curve, IDEA, Public Key.
Applied Cryptography (Public key) Part I. Let’s first finish “Symmetric Key” before talking about public key John wrote the letters of the alphabet under.
Cryptography and Network Security
Chapter 8 – Introduction to Number Theory. Prime Numbers prime numbers only have divisors of 1 and self –they cannot be written as a product of other.
Chapter 8 Introduction To Number Theory. Prime Numbers Prime numbers only have divisors of 1 and Prime numbers only have divisors of 1 and self. self.
Chapter 8 Introduction to Number Theory. Prime Numbers prime numbers only have divisors of 1 and self –they cannot be written as a product of other numbers.
Primality Testing Patrick Lee 12 July 2003 (updated on 13 July 2003)
Chapter 8 More Number Theory. Prime Numbers Prime numbers only have divisors of 1 and itself They cannot be written as a product of other numbers Prime.
Notation Intro. Number Theory Online Cryptography Course Dan Boneh
CNS2010handout 8 :: introduction to number theory1 computer and network security matt barrie.
and Factoring Integers (I)
1 Chapter 7– Introduction to Number Theory Instructor: 孫宏民 Room: EECS 6402, Tel: , Fax :
Cryptography and Network Security Chapter 4
Cryptography and Network Security Chapter 4 Fourth Edition by William Stallings.
Chap. 8,9: Introduction to number theory and RSA algorithm
Chapter 4 – Finite Fields Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic Curve, IDEA, Public.
Chapter 8 – Introduction to Number Theory Prime Numbers  prime numbers only have divisors of 1 and self they cannot be written as a product of other numbers.
CSE 321 Discrete Structures Winter 2008 Lecture 8 Number Theory: Modular Arithmetic.
Chapter 8 – Introduction to Number Theory Prime Numbers
Cryptography and Network Security Chapter 8. Chapter 8 – Introduction to Number Theory The Devil said to Daniel Webster: "Set me a task I can't carry.
Chapter 8 – Introduction to Number Theory Prime Numbers  prime numbers only have divisors of 1 and self they cannot be written as a product of other numbers.
BY MISS FARAH ADIBAH ADNAN IMK
Prime Numbers Prime numbers only have divisors of 1 and self
Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Copyright © The McGraw-Hill Companies, Inc. Permission required.
Cryptography A little number theory Public/private key cryptography –Based on slides of William Stallings and Lawrie Brown.

CPSC 3730 Cryptography and Network Security
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
Cryptography and Network Security Introduction to Finite Fields.
By: Hector L Contreras SSGT / USMC
Prelude to Public-Key Cryptography Rocky K. C. Chang, February
Basic Number Theory Divisibility Let a,b be integers with a≠0. if there exists an integer k such that b=ka, we say a divides b which is denoted by a|b.
Chapter 4 – Finite Fields
Data Security and Encryption (CSE348) 1. Lecture # 12 2.
YSLInformation Security -- Public-Key Cryptography1 Prime and Relatively Prime Numbers Divisors: We say that b  0 divides a if a = mb for some m, where.
Chapter 3 Public Key Cryptography MSc. NGUYEN CAO DAT Dr. TRAN VAN HOAI.
Information Security Lab. Dept. of Computer Engineering 87/121 PART I Symmetric Ciphers CHAPTER 4 Finite Fields 4.1 Groups, Rings, and Fields 4.2 Modular.
9/22/15UB Fall 2015 CSE565: S. Upadhyaya Lec 7.1 CSE565: Computer Security Lecture 7 Number Theory Concepts Shambhu Upadhyaya Computer Science & Eng. University.
Cryptography and Network Security Chapter 4. Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2015 Nitesh Saxena.
Pertemuan #5 Pengantar ke Number Theory Kuliah Pengaman Jaringan.
9.1 Primes and Related Congruence Equations 23 Sep 2013.
Cryptography and Network Security Chapter 4 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Chapter 4 With Question/Answer Animations 1. Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their.
Discrete Math II Howon Kim
Introduction to Number Theory
CSE565: Computer Security Lecture 7 Number Theory Concepts
Advanced Algorithms Analysis and Design
Cryptography and Network Security
Introduction to Number Theory
Cryptography and Network Security Chapter 8
Number Theory (Chapter 7)
Cryptography and Network Security
Cryptography and Network Security
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Cryptography and Network Security
Mathematical Background for Cryptography
Presentation transcript:

Fall 2002CS 395: Computer Security1 Chapters 4 and 8: The Mathematics Required for Public Key Cryptography In case you’re beginning to worry that this is actually a math course, we’ll be skipping the proofs…

Fall 2002CS 395: Computer Security2 Introduction A look at finite fields, a concept of increasing importance in cryptography –AES, Elliptic Curve, IDEA, Public Key concern operations on “numbers” –where what constitutes a “number” and the type of operations varies considerably start with concepts of groups, rings, fields from abstract algebra

Fall 2002CS 395: Computer Security3 Group a set of elements or “numbers” with some operation whose result is also in the set (closure) obeys: –associative law: (a.b).c = a.(b.c) –has identity e : e.a = a.e = a –has inverses a -1 : a.a -1 = e if commutative a.b = b.a –then forms an abelian group

Fall 2002CS 395: Computer Security4 Cyclic Group define exponentiation as repeated application of operator –example: a -3 = a.a.a and let identity be: e=a 0 a group is cyclic if every element is a power of some fixed element –ie b = a k for some a and every b in group a is said to be a generator of the group

Fall 2002CS 395: Computer Security5 Ring a set of “numbers” with two operations (addition and multiplication) which are: an abelian group with addition operation multiplication: –has closure –is associative –distributive over addition: a(b+c) = ab + ac if multiplication operation is commutative, it forms a commutative ring if multiplication operation has inverses and no zero divisors, it forms an integral domain

Fall 2002CS 395: Computer Security6 Field a set of numbers with two operations: –abelian group for addition –abelian group for multiplication (ignoring 0) –Every field is a ring, not vice-versa Essentially, a field is a set on which we can do addition, subtraction, multiplication, and division without leaving the set.

Fall 2002CS 395: Computer Security7 Modular Arithmetic define modulo operator a mod n to be remainder when a is divided by n use the term congruence for: a ≡ b mod n –when divided by n, a & b have same remainder –eg. 100 = 34 mod 11 b is called the residue of a mod n –since with integers can always write: a = qn + b usually have 0 <= b <= n mod 7 ≡ -5 mod 7 ≡ 2 mod 7 ≡ 9 mod 7

Fall 2002CS 395: Computer Security8 Modulo 7 Example

Fall 2002CS 395: Computer Security9 Divisors say a non-zero number b divides a if for some m have a=mb ( a,b,m all integers) that is b divides into a with no remainder denote this b|a and say that b is a divisor of a eg. all of 1,2,3,4,6,8,12,24 divide 24

Fall 2002CS 395: Computer Security10 Modular Arithmetic Operations is 'clock arithmetic' uses a finite number of values, and loops back from either end modular arithmetic is when do addition & multiplication and modulo reduce answer can do reduction at any point, I.e. –a+b mod n = [a mod n + b mod n] mod n

Fall 2002CS 395: Computer Security11 Modular Arithmetic can do modular arithmetic with any group of integers: Z n = {0, 1, …, n-1} form a commutative ring for addition with a multiplicative identity note some peculiarities –if (a+b)≡(a+c) mod n then b≡c mod n –but (ab)≡(ac) mod n then b≡c mod n only if a is relatively prime to n

Fall 2002CS 395: Computer Security12 Modulo 8 Example

Fall 2002CS 395: Computer Security13 Greatest Common Divisor (GCD) a common problem in number theory GCD (a,b) of a and b is the largest number that divides evenly into both a and b –eg GCD(60,24) = 12 often want no common factors (except 1) and hence numbers are relatively prime –eg GCD(8,15) = 1 –hence 8 & 15 are relatively prime

Fall 2002CS 395: Computer Security14 Euclid's GCD Algorithm an efficient way to find the GCD(a,b) uses theorem that: –GCD(a,b) = GCD(b, a mod b) Euclid's Algorithm to compute GCD(a,b): –A=a, B=b –while B>0 R = A mod B A = B, B = R –return A

Fall 2002CS 395: Computer Security15 Example GCD(1970,1066) 1970 = 1 x gcd(1066, 904) 1066 = 1 x gcd(904, 162) 904 = 5 x gcd(162, 94) 162 = 1 x gcd(94, 68) 94 = 1 x gcd(68, 26) 68 = 2 x gcd(26, 16) 26 = 1 x gcd(16, 10) 16 = 1 x gcd(10, 6) 10 = 1 x gcd(6, 4) 6 = 1 x gcd(4, 2) 4 = 2 x gcd(2, 0) ABR

Fall 2002CS 395: Computer Security16 Chapter 8 – Introduction to Number Theory The Devil said to Daniel Webster: "Set me a task I can't carry out, and I'll give you anything in the world you ask for." Daniel Webster: "Fair enough. Prove that for n greater than 2, the equation a n + b n = c n has no non-trivial solution in the integers." They agreed on a three-day period for the labor, and the Devil disappeared. At the end of three days, the Devil presented himself, haggard, jumpy, biting his lip. Daniel Webster said to him, "Well, how did you do at my task? Did you prove the theorem?' "Eh? No... no, I haven't proved it." "Then I can have whatever I ask for? Money? The Presidency?' "What? Oh, that—of course. But listen! If we could just prove the following two lemmas—" —The Mathematical Magpie, Clifton Fadiman

Fall 2002CS 395: Computer Security17 Prime Numbers prime numbers only have divisors of 1 and self –they cannot be written as a product of other numbers –note: 1 is prime, but is generally not of interest eg. 2,3,5,7 are prime, 4,6,8,9,10 are not prime numbers are central to number theory list of prime number less than 200 is:

Fall 2002CS 395: Computer Security18 Prime Factorization to factor a number n is to write it as a product of other numbers: n=a × b × c note that factoring a number is relatively hard compared to multiplying the factors together to generate the number the prime factorization of a number n is writing n as a product of primes –eg. 91=7×13 ; 3600=2 4 ×3 2 ×5 2

Fall 2002CS 395: Computer Security19 Relatively Prime Numbers & GCD two numbers a, b are relatively prime if have no common divisors apart from 1 –eg. 8 & 15 are relatively prime since factors of 8 are 1,2,4,8 and of 15 are 1,3,5,15 and 1 is the only common factor conversely can determine the greatest common divisor by comparing their prime factorizations and using least powers –eg. 300=2 1 ×3 1 ×5 2 18=2 1 ×3 2 hence GCD(18,300)=2 1 ×3 1 ×5 0 =6

Fall 2002CS 395: Computer Security20 Relatively Prime and the GCD Theorem: For any nonzero integers a and b, there exist integers s and t such that gcd(a,b) = as + bt. Moreover, gcd(a,b) is the smallest positive integer of the form as + bt. Proof: (Sorry) Consider the set S, given by

Fall 2002CS 395: Computer Security21 Proof (cont) S is obviously nonempty Well Ordering Principle asserts that S has a smallest element, say d = as + bt. Claim: d is gcd(a,b). Why?

Fall 2002CS 395: Computer Security22 Proof (cont.)

Fall 2002CS 395: Computer Security23 We’ll Need This

Fall 2002CS 395: Computer Security24 Bottom Line: d has an inverse modulo n if and only if d and n are relatively prime!

Fall 2002CS 395: Computer Security25 Fermat's Theorem a p-1 mod p = 1 –where p is prime and gcd(a,p)=1 also known as Fermat’s Little Theorem useful in public key and primality testing

Fall 2002CS 395: Computer Security26 Euler Totient Function  (n) when doing arithmetic modulo n complete set of residues is: 0..n-1 reduced set of residues is those numbers (residues) which are relatively prime to n –eg for n=10, –complete set of residues is {0,1,2,3,4,5,6,7,8,9} –reduced set of residues is {1,3,7,9} number of elements in reduced set of residues is called the Euler Totient Function  (n)

Fall 2002CS 395: Computer Security27 Euler Totient Function  (n) to compute  (n) need to count number of elements to be excluded in general need prime factorization, but –for p (p prime)  (p) = p-1 –for p.q (p,q prime)  (p.q) = (p-1)(q-1) eg. –  (37) = 36 –  (21) = (3–1)×(7–1) = 2×6 = 12

Fall 2002CS 395: Computer Security28 Euler's Theorem a generalization of Fermat's Theorem a  (n) mod N = 1 –where gcd(a,N)=1 eg. –a=3;n=10;  (10)=4; –hence 3 4 = 81 = 1 mod 10 –a=2;n=11;  (11)=10; –hence 2 10 = 1024 = 1 mod 11 A Useful corollary: Given two primes, p and q, and integers n=pq and m with 0<m<n, we have

Fall 2002CS 395: Computer Security29 Primality Testing often need to find large prime numbers traditionally sieve using trial division –ie. divide by all numbers (primes) in turn less than the square root of the number –only works for small numbers alternatively can use statistical primality tests based on properties of primes –for which all primes numbers satisfy property –but some composite numbers, called pseudo-primes, also satisfy the property

Fall 2002CS 395: Computer Security30 Miller Rabin Algorithm a test based on Fermat’s Theorem algorithm is: TEST (n) is: 1. Find integers k, q, k > 0, q odd, so that (n–1)=2 k q 2. Select a random integer a, 1<a<n–1 3. if a q mod n = 1 then return (“maybe prime"); 4. for j = 1 to k – 1 do 5. if ( a 2 j q mod n = n-1 ) then return(" maybe prime ") 6. return ("composite")

Fall 2002CS 395: Computer Security31 Probabilistic Considerations if Miller-Rabin returns “composite” the number is definitely not prime otherwise is a prime or a pseudo-prime chance it detects a pseudo-prime is < ¼ hence if repeat test with different random a then chance n is prime after t tests is: –Pr(n prime after t tests) = 1-4 -t –eg. for t=10 this probability is >

Fall 2002CS 395: Computer Security32 Prime Distribution prime number theorem states that primes occur roughly every ( ln n ) integers since can immediately ignore evens and multiples of 5, in practice only need test 0.4 ln(n) numbers of size n before locate a prime –note this is only the “average” sometimes primes are close together, at other times are quite far apart

Fall 2002CS 395: Computer Security33 Chinese Remainder Theorem used to speed up modulo computations working modulo a product of numbers –eg. mod M = m 1 m 2..m k Chinese Remainder theorem lets us work in each moduli m i separately since computational cost is proportional to size, this is faster than working in the full modulus M Don’t need to read it, just know it helps with some of the computations in RSA public-key scheme

Fall 2002CS 395: Computer Security34 Primitive Roots from Euler’s theorem have a  (n) mod n=1 consider a m mod n=1, GCD(a,n)=1 –must exist for m=  (n) but may be smaller –once powers reach m, cycle will repeat if smallest is m=  (n) then a is called a primitive root if p is prime, then successive powers of a "generate" the group mod p these are useful but relatively hard to find

Fall 2002CS 395: Computer Security35 Discrete Logarithms or Indices the inverse problem to exponentiation is to find the discrete logarithm of a number modulo p that is to find x where a x = b mod p written as x=log a b mod p or x=ind a,p (b) if a is a primitive root then always exists, otherwise may not –x = log 3 4 mod 13 (x st 3 x = 4 mod 13) has no answer –x = log 2 3 mod 13 = 4 by trying successive powers whilst exponentiation is relatively easy, finding discrete logarithms is generally a hard problem

Fall 2002CS 395: Computer Security36 Summary have considered: –prime numbers –Fermat’s and Euler’s Theorems –Primality Testing –Chinese Remainder Theorem –Discrete Logarithms