MA/CSSE 473 Day 11 Primality testing summary Data Encryption RSA.

Slides:



Advertisements
Similar presentations
RSA.
Advertisements

RSA COSC 201 ST. MARY’S COLLEGE OF MARYLAND FALL 2012 RSA.
Cryptography and Network Security
Announcements: 1. Congrats on reaching the halfway point once again! 2. DES graded soon 3. Short “pop” quiz on Ch 3. (Thursday at earliest) 4. Reminder:
Public Key Cryptosystems - RSA Receiver Sender Eavesdroppe r p q p q p q p and q prime.
Data encryption with big prime numbers
22C:19 Discrete Structures Integers and Modular Arithmetic
BY : Darshana Chaturvedi.  INTRODUCTION  RSA ALGORITHM  EXAMPLES  RSA IS EFFECTIVE  FERMAT’S LITTLE THEOREM  EUCLID’S ALGORITHM  REFERENCES.
Introduction to Modern Cryptography Lecture 6 1. Testing Primitive elements in Z p 2. Primality Testing. 3. Integer Multiplication & Factoring as a One.
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
Notation Intro. Number Theory Online Cryptography Course Dan Boneh
7. Asymmetric encryption-
1 The RSA Algorithm Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
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.
and Factoring Integers (I)
Attacks on Digital Signature Algorithm: RSA
Public-key Cryptography Montclair State University CMPT 109 J.W. Benham Spring, 1998.
Cryptography Lecture 11: Oct 12. Cryptography AliceBob Cryptography is the study of methods for sending and receiving secret messages. adversary Goal:
Announcements: 1. Congrats on reaching the halfway point once again! 2. Reminder: HW5 due tomorrow, HW6 due Tuesday after break 3. Term project groups.
1 Lecture #10 Public Key Algorithms HAIT Summer 2005 Shimrit Tzur-David.
Cryptography1 CPSC 3730 Cryptography Chapter 9 Public Key Cryptography and RSA.
CSE 321 Discrete Structures Winter 2008 Lecture 8 Number Theory: Modular Arithmetic.
Introduction to Modern Cryptography Lecture 7 1.RSA Public Key CryptoSystem 2.One way Trapdoor Functions.
Theory I Algorithm Design and Analysis (9 – Randomized algorithms) Prof. Dr. Th. Ottmann.
Lecture 6: Public Key Cryptography
Public Key Model 8. Cryptography part 2.
1 CIS 5371 Cryptography 8. Asymmetric encryption-.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 9: Cryptography.
The RSA Algorithm Rocky K. C. Chang, March
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.

Introduction to Modular Arithmetic and Public Key Cryptography.
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
1 Applications of Number Theory CS 202 Epp section 10.4 Aaron Bloomfield.
The Complexity of Primality Testing. What is Primality Testing? Testing whether an integer is prime or not. – An integer p is prime if the only integers.
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.
Cryptography Lecture 7: RSA Primality Testing Piotr Faliszewski.
Modular Arithmetic with Applications to Cryptography Lecture 47 Section 10.4 Wed, Apr 13, 2005.
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
MA/CSSE 473 Day 10 Primality testing summary Data Encryption 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.
ENCRYPTION TAKE 2: PRACTICAL DETAILS David Kauchak CS52 – Spring 2015.
Public Key Algorithms Lesson Introduction ●Modular arithmetic ●RSA ●Diffie-Hellman.
CS Modular Division and RSA1 RSA Public Key Encryption To do RSA we need fast Modular Exponentiation and Primality generation which we have shown.
Ch1 - Algorithms with numbers Basic arithmetic Basic arithmetic Addition Addition Multiplication Multiplication Division Division Modular arithmetic Modular.
RSA cryptosystem--preview Suppose n=p  q and  (n)=(p-1)(q-1), where p and q are big primes. Select (find) a and b, such that a  b=1 mod  (n). K=(n,p,q,a,b),
Introduction to Cryptography Lecture 9. Public – Key Cryptosystems Each participant has a public key and a private key. It should be infeasible to determine.
Chapter 12: Cryptography MAT 320 Spring Cryptography: Basic Ideas We want to encode information so that no one other than the intended recipient.
1 Applications of Number Theory CS/APMA 202 Rosen section 2.6 Aaron Bloomfield.
Primality Testing. Introduction The primality test provides the probability of whether or not a large number is prime. Several theorems including Fermat’s.
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
Data encryption with big prime numbers DANIEL FREEMAN, SLU.
Chapter 1 Algorithms with Numbers. Bases and Logs How many digits does it take to represent the number N >= 0 in base 2? With k digits the largest number.
MA/CSSE 473 Day 10 Primality Testing. MA/CSSE 473 Day 10 In-class exam: Friday, Sept 28 –You may bring a two-sided 8.5x11 inch piece of paper containing.
MA/CSSE 473 Day 09 Modular Division Revisited Fermat's Little Theorem Primality Testing.
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.
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
1 The RSA Algorithm Rocky K. C. Chang February 23, 2007.
Intro to Cryptography ICS 6D Sandy Irani. Cryptography Intro Alice wants to send a message to Bob so that even if Eve can see the transmitted information,
Key Exchange in Systems VPN usually has two phases –Handshake protocol: key exchange between parties sets symmetric keys –Traffic protocol: communication.
MA/CSSE 473 Day 9 Primality Testing Encryption Intro.
MA/CSSE 473 Day 9 Primality Testing Encryption Intro.
Public Key Encryption Major topics The RSA scheme was devised in 1978
MA/CSSE 473 Day 10 Data Encryption RSA.
Presentation transcript:

MA/CSSE 473 Day 11 Primality testing summary Data Encryption RSA

MA/CSSE 473 Day 11 HW 5 is due today HW 6 due Thursday Exam September 28 Tomorrow I hope to discuss the Knuth interview (read it if you have not already done so – linked from schedule page, Session 3) –and Brute Force Algorithms Today: –Primality testing summary –Cryptography Introduction –RSA

Accuracy of the Primality Test Rabin* showed that if N is composite, this test will demonstrate its non-primality for at least ¾ of the numbers a that are in the range 1…N-1, even if a is a Carmichael number. Note that 3/4 is the worst case; randomly-chosen composite numbers have a much higher percentage of witnesses to their non-primeness. If we test several values of a, we have a very low chance of flagging a composite number as prime. *Journal of Number Theory 12 (1980) no. 1, pp

Efficiency of the Test Testing an n-bit number is Ѳ(n 3 ) If we use the fastest-known integer multiplication techniques (based on Fast Fourier Transforms), this can be pushed to Ѳ(n 2 * log n * log log n)

Testing "small" numbers From Wikipedia article on the Miller-Rabin primality test: When the number N we want to test is small, smaller fixed sets of potential witnesses are known to suffice. For example, Jaeschke* has verified that –if N < 9,080,191, it is sufficient to test a = 31 and 73 –if N < 4,759,123,141, it is sufficient to test a = 2, 7, and 61 –if N < 2,152,302,898,747, it is sufficient to test a = 2, 3, 5, 7, 11 –if N < 3,474,749,660,383, it is sufficient to test a = 2, 3, 5, 7, 11, 13 –if N < 341,550,071,728,321, it is sufficient to test a = 2, 3, 5, 7, 11, 13, 17 * Gerhard Jaeschke, “On strong pseudoprimes to several bases”, Mathematics of Computation 61 (1993)

Generating Random Primes For cryptography, we want to be able to quickly generate random prime numbers with a large number of bits Are prime numbers abundant among all integers? Fortunately, yes Lagrange's prime number theorem –Let  (N) be the number of primes that are ≤ N, then  (N) ≈ N / ln N. – Thus the probability that an n-bit number is prime is approximately (2 n / ln (2 n ) )/ 2 n ≈ 1.44/ n Q1-2

Random Prime Algorithm To generate a random n-bit prime: –Pick a random n-bit number N –Run a primality test on N –If it passes, output N –Else repeat the process –Expected number of iterations is Ѳ(n)

CRYPTOGRAPHY INTRODUCTION We'll only scratch the surface, but there is MA/CSSE 479

Cryptography Scenario I want to transmit a message m to you –in a form e(m) that you can readily decode by running d(e(m)), –And that an eavesdropper has little chance of decoding Private-key protocols –You and I meet beforehand and agree on e and d. Public-key protocols –You publish an e for which you know the d, but it is very difficult for someone else to guess the d. –Then I can use e to encode messages that only you* can decode * and anyone else who can figure out what d is if they know e.

Messages can be integers Since a message is a sequence of bits … We can consider the message to be a sequence of b-bit integers (where b is fairly large), and encode each of those integers. Here we focus on encoding and decoding a single integer.

RSA Public-key Cryptography Rivest-Shamir-Adleman (1977) –A reference : Mark Weiss, Data Structures and Problem Solving Using Java, Section 7.4 Consider a message to be a number modulo N, an k-bit number (longer messages can be broken up into k-bit pieces) The encryption function will be a bijection on {0, 1, …, N-1}, and the decryption function will be its inverse How to pick the N and the bijection? bijection: a function f from a set X to a set Y with the property that for every y in Y, there is exactly one x in X such that f(x) = y. In other words, f is both one-to-one and onto.

N = p q Pick two large primes, p and q, and let N = pq. Property: If e is any number that is relatively prime to N' = (p-1)(q-1), then –the mapping x  x e mod N is a bijection on {0, 1, …, N-1} –If d is the inverse of e mod (p-1)(q-1), then for all x in {0, 1, …, N-1}, (x e ) d  x (mod N). We'll first apply this property, then prove it. Q3-4

Public and Private Keys The first (bijection) property tells us that x  x e mod N is a reasonable way to encode messages, since no information is lost –If you publish (N, e) as your public key, anyone can encrypt and send messages to you The second tells how to decrypt a message –When you receive a message m', you can decode it by calculating (m') d mod N.

Example (from Wikipedia) p=61, q=53. Compute N = pq = 3233 (p-1)(q-1) = 60∙52 = 3120 Choose e=17 (relatively prime to 3120) Compute multiplicative inverse of 17 (mod 3120) –d = 2753 (evidence: 17∙2753 = = ∙3120) To encrypt m=123, take (mod 3233) = 855 To decrypt 855, take (mod 3233) = 123 In practice, we would use much larger numbers for p and q. Q5-6

Recap: RSA Public-key Cryptography Consider a message to be a number modulo N, n k-bit number (longer messages can be broken up into n-bit pieces) Pick any two large primes, p and q, and let N = pq. Property: If e is any number that is relatively prime to (p-1)(q-1), then –the mapping x  x e mod N is a bijection on {0, 1, …, N-1} –If d is the inverse of e mod (p-1)(q-1), then for all x in {0, 1, …, N-1}, (x e ) d  x (mod N). We have applied the property, now we prove it

Proof of the property Property: If N=pq for 2 primes p and q, and if e is any number that is relatively prime to N' = (p-1)(q-1), then –the mapping x  x e mod N is a bijection on {0, 1, …, N-1} –If d is the inverse of e mod (p-1)(q-1), then for all x in {0, 1, …, N-1}, (x e ) d  x (mod N) The 2 nd condition implies the 1 st, so we prove the 2 nd e is invertible mod (p-1)(q-1) because it is relatively prime to it. Let d be its inverse ed  1 mod (p-1)(q-1), so ed = 1 + k(p-1)(q-1) for some integer k x ed – x = x 1 + k(p-1)(q-1) – x. Show that this is  0 (mod N) By Fermat's Little Theorem, this expression is divisible by p. Similarly, divisible by q Since p and q are primes, x ed – x is divisible by pq = N Q7-9

RSA security Assumption (Factoring is hard!): –Given N, e, and x e mod N, it is computationally intractable to determine x –What would it take to determine x? Presumably this will always be true if we choose N large enough But people have found other ways to attack RSA, by gathering additional information So these days, more sophisticated techniques are needed. MA/CSSE 479

Student questions On primality testing, RSA or anything else?