Cryptography and RSA. Group (1854, Cayley) Upcoming Interview? Outline. Commutative or Abelian Groups

Similar documents
Definition: For a positive integer n, if 0<a<n and gcd(a,n)=1, a is relatively prime to n. Ahmet Burak Can Hacettepe University

during transmission safeguard information Cryptography: used to CRYPTOGRAPHY BACKGROUND OF THE MATHEMATICAL

Topics in Cryptography. Lecture 5: Basic Number Theory

Public-Key Cryptosystems CHAPTER 4

CPSC 467b: Cryptography and Computer Security

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2

Cryptography. pieces from work by Gordon Royle

Lecture 1: Introduction to Public key cryptography

Powers in Modular Arithmetic, and RSA Public Key Cryptography

L7. Diffie-Hellman (Key Exchange) Protocol. Rocky K. C. Chang, 5 March 2015

Introduction to Cryptography. Lecture 8

Chapter 8 Public-key Cryptography and Digital Signatures

RSA RSA public key cryptosystem

Introduction to Cryptography. Lecture 6

Lecture V : Public Key Cryptography

Ma/CS 6a Class 3: The RSA Algorithm

Great Theoretical Ideas in Computer Science

Lecture Notes, Week 6

Public Key 9/17/2018. Symmetric Cryptography Review. Symmetric Cryptography: Shortcomings (1) Symmetric Cryptography: Analogy

Overview. Background / Context. CSC 580 Cryptography and Computer Security. March 21, 2017

Theme : Cryptography. Instructor : Prof. C Pandu Rangan. Speaker : Arun Moorthy CS

Public-key Cryptography and elliptic curves

Introduction to Modern Cryptography. Benny Chor

Chapter 4 Asymmetric Cryptography

Asymmetric Cryptography

Number Theory & Modern Cryptography

and Other Fun Stuff James L. Massey

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS

Lemma 1.2. (1) If p is prime, then ϕ(p) = p 1. (2) If p q are two primes, then ϕ(pq) = (p 1)(q 1).

Discrete Mathematics GCD, LCM, RSA Algorithm

CIS 551 / TCOM 401 Computer and Network Security

Public-key Cryptography and elliptic curves

Slides by Kent Seamons and Tim van der Horst Last Updated: Oct 1, 2013

RSA. Ramki Thurimella

Number theory (Chapter 4)

ECE596C: Handout #11

Mathematics of Cryptography

Other Public-Key Cryptosystems

2. Cryptography 2.5. ElGamal cryptosystems and Discrete logarithms

Final Exam Math 105: Topics in Mathematics Cryptology, the Science of Secret Writing Rhodes College Tuesday, 30 April :30 11:00 a.m.

Asymmetric Encryption

ECE 646 Lecture 9. RSA: Genesis, operation & security

Lecture 1: Perfect Secrecy and Statistical Authentication. 2 Introduction - Historical vs Modern Cryptography

Other Public-Key Cryptosystems

Security Issues in Cloud Computing Modern Cryptography II Asymmetric Cryptography

Introduction to Modern Cryptography. Lecture RSA Public Key CryptoSystem 2. One way Trapdoor Functions

Review. CS311H: Discrete Mathematics. Number Theory. Computing GCDs. Insight Behind Euclid s Algorithm. Using this Theorem. Euclidian Algorithm

10 Modular Arithmetic and Cryptography

Network Security Technology Spring, 2018 Tutorial 3, Week 4 (March 23) Due Date: March 30

Encryption: The RSA Public Key Cipher

Public Key Cryptography

Notes for Lecture 17

Practice Assignment 2 Discussion 24/02/ /02/2018

Public Key Cryptography

CIS 6930/4930 Computer and Network Security. Topic 5.2 Public Key Cryptography

Carmen s Core Concepts (Math 135)

Public-Key Cryptography. Lecture 9 Public-Key Encryption Diffie-Hellman Key-Exchange

An Introduction to Probabilistic Encryption

Lecture 19: Public-key Cryptography (Diffie-Hellman Key Exchange & ElGamal Encryption) Public-key Cryptography

10 Public Key Cryptography : RSA

basics of security/cryptography

The RSA public encryption scheme: How I learned to stop worrying and love buying stuff online

Public Key Cryptography. All secret key algorithms & hash algorithms do the same thing but public key algorithms look very different from each other.

Candidates must show on each answer book the type of calculator used. Only calculators permitted under UEA Regulations may be used.

Public-Key Encryption: ElGamal, RSA, Rabin

Outline. Number Theory and Modular Arithmetic. p-1. Definition: Modular equivalence a b [mod n] (a mod n) = (b mod n) n (a-b)

Elliptic Curves: Theory and Application

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

Public Key Algorithms

THE RSA CRYPTOSYSTEM

Theory of Computation Chapter 12: Cryptography

1 Number Theory Basics

OWO Lecture: Modular Arithmetic with Algorithmic Applications

Circuit Complexity. Circuit complexity is based on boolean circuits instead of Turing machines.

Introduction to Modern Cryptography. Benny Chor

Lecture 22: RSA Encryption. RSA Encryption

ENEE 457: Computer Systems Security 10/3/16. Lecture 9 RSA Encryption and Diffie-Helmann Key Exchange

MATH 158 FINAL EXAM 20 DECEMBER 2016

CRYPTOGRAPHY AND NUMBER THEORY

Mathematical Foundations of Public-Key Cryptography

8 Elliptic Curve Cryptography

Fundamentals of Modern Cryptography

Cryptography IV: Asymmetric Ciphers

Lecture 28: Public-key Cryptography. Public-key Cryptography

CPSC 467: Cryptography and Computer Security

My brief introduction to cryptography

8.1 Principles of Public-Key Cryptosystems

Innovation and Cryptoventures. Cryptography 101. Campbell R. Harvey. Duke University, NBER and Investment Strategy Advisor, Man Group, plc

Cryptography and Security Final Exam

Final Report. Cryptography and Number Theory Boot Camp NSF-REU. Summer 2017

Evidence that the Diffie-Hellman Problem is as Hard as Computing Discrete Logs

Lecture 7: ElGamal and Discrete Logarithms

CPSC 467: Cryptography and Computer Security

1 What are Physical Attacks. 2 Physical Attacks on RSA. Today:

Cryptography. P. Danziger. Transmit...Bob...

CPSC 467b: Cryptography and Computer Security

14 Diffie-Hellman Key Agreement

ASYMMETRIC ENCRYPTION

International Electronic Journal of Pure and Applied Mathematics IEJPAM, Volume 9, No. 1 (2015)

Intro to Public Key Cryptography Diffie & Hellman Key Exchange

Transcription:

Great Theoretical Ideas in CS V. Adamchik CS 15-251 Upcoming Interview? Lecture 24 Carnegie Mellon University Cryptography and RSA How the World's Smartest Company Selects the Most Creative Thinkers Groups Generators Outline Euler s theorem Fermat s little theorem Diffie-Hellman Key Exchange RSA algorithm Z n = {0, 1, 2,, n-1} Define + n : a + n b = a + b (mod n) Define - n : a - n b = a + n (-b) (-b) is an additive inverse b + n (-b) = 0 Special element 0 is called an identity element Group (1854, Cayley) A group G is a pair (S, ), where S is a set and is a binary operation S S S such that: 1. (Closure ) For all a and b S, a b S 2. is associative, (a b) c= a (b c) 3. (Identity) There exists an element e S s.t. e a = a e = a, for all a S 4. (Inverses) For every a S there is b S s.t. Commutative or Abelian Groups If G = (S, ) and is commutative, then G is called a commutative group remember, commutative means a b = b a for all a, b in S a b = b a = e 1

Some examples (Z n, + n ) is a group Z n = {x Z n GCD(x,n) =1} (Z, +) is a group (N, +) is not a group (Z n, n ) is a group (Z n, n ) is not a group Identity Is Unique Theorem: A group has exactly one identity element Some properties of groups Proof: Suppose e f are both identities of G=(S, ) Then f = e f = e. Contradiction! We will always denote an identity by e. Inverses Are Unique Theorem: Every element in a group has a unique inverse A group G=(S, Order of a group ) is finite if S is a finite set Define G = S to be the order of the group (i.e. the number of elements in the group) Proof: Suppose b c are both inverses of a. Then b = b e = b (a c) = (b a) c = c Contradiction! What is the group with the least number of elements? G = ({e}, ) where e e = e Z n = ( {1}, + n ) Z n can be generated by a single element 2

Generators An element g S is called a generator of G=(S, ) if the set {g} generates G A set T S is said to generate the group G = (S, ) if every element of S can be expressed as a finite combination of elements in T under. A group G is cyclic if it is generated by a single element. A cyclic group can have more than one generator. (Z n, + n ) is cyclic (Z, +) is cyclic More generators for (Z n,+ n ) Consider (Z 4,+ 4 ) 2+0=2; 2+2=0; 2+2+2=2; 2+2+2+2=0 3+0=3; 3+3=2; 3+3+3=1; 3+3+3+3=0 3 is a generator, but 2 is not. Claim: Any a Z n s.t. GCD(a,n)=1 generates (Z n,+) Def: The order of an element g is the least k s.t. g k = e Z n = {x Z n GCD(x,n) =1} g (Z n, n ) is a generator if the powers of g hit every element of Z n Example, (Z n, n ) Z 7 = {1,2,3,4,5,6} 2 0 = 1; 2 1 = 2; 2 2 = 4; 2 3 = 1 This will mean that Z p has an alternative representation as the powers of g: {g, g 2, g 3,, g p-1 }. 3 0 =1; 3 1 = 3; 3 2 = 2; 3 3 = 6; 3 4 =4; 3 5 = 5; 3 6 = 1 3 is a generator, but 2 is not. 5 is another generator Generator Theorem: If p prime, then (Z n, n ) has a generator g. In fact, it has (p-1) generators. Proof is not given here. Open Problem (Gauss) Is there an efficient algorithm, given a prime p, to find a single generator in Z p? That is, for every integer a Z p, find an integer k such that g k a (mod p). Such k is called the discrete logarithm of a to the base g modulo p. 3

Euler Phi Function (n) Fundamental lemma of powers. (n) = size of Z n If a Z n then a x n ax mod (n) p prime (p) = p-1 p, q distinct primes (p q) = (p-1)(q-1) 5 121242653 (mod 11) = 5 121242653(mod 10) (mod 11) = 5 3 (mod 11) = 4 Note, a (n)-1 n a -1 This can be used to compute a -1. for a Z n, a x n ax mod (n) Euler stheorem Hence, we can compute a m (mod n) while performing at most 2 log 2 (n) multiplies where each time we multiply together numbers with log 2 n + 1 bits For a Z n, a (n) n 1 Note, a (n)-1 n a -1 This can be used to compute a -1. Proof of Euler s Theorem Define a Z n = {a n x x Z n } for a Z n By the permutation property, Z n = az n x n ax [as x ranges over Z n ] Fermat s Little Theorem If n is prime, a Z n a n-1 n 1 x n x (a size of Zn ) [Commutativity] 1 = n a size of Zn [Cancellation] a (n) = n 1 Note, a n-2 n a -1 This can be used to compute a -1. 4

Cryptography Basic Cryptography Cryptography is the mathematics of devising secure communication systems Cryptanalysis is the mathematics of breaking such systems. RSA Cryptography One Time Pads Basically unbreakable method for encoding messages CIA, KGB, Mossad, Mi6 in old times A code book A sheet of random numbers Convert a message according to a code book and then XOR with a sequence of random numbers. One Time Pads Agreeing on a secret Gives perfect security! For random shared key, leaks no information about message To be able to read a message encrypted like this, the receiver has to know the details of the encryption process. One time pads rely on having a shared secret! Alice and Bob have never talked before but they want to agree on a secret How can they do this? 5

Diffie-Hellman Key Exchange (1976) Suppose we have two people wishing to communicate: Alice and Bob. They do not want Eve (eavesdropper) to know their message. Diffie-Hellman Key Exchange (1976) Alice chooses a random a Z p and computes g a (mod p) and sends it to Bob. Bob chooses a random b Z p and computes g b (mod p) and sends it to Alice. Alice and Bob agree upon and make public two numbers prime p, and a generator g in Z p Punchline: Now both Alice & Bob can compute the shared secret m=g ab (mod p) p and g are public! What about Eve? If Eve wants to compute g ab she needs either a or b Otherwise, she needs to compute g ab (mod p) directly. This is so-called a discrete logarithm problem: Solve for in x for y= g x (mod p), given y, g and p, Diffie Hellman requires both parties to exchange information to share a secret, so Eve might intercept can we get rid of this assumption? There is no algorithm to accomplish this in a reasonable amount of time. Public Key Cryptography Goal: Enable Bob to send encrypted message to Alice without their sharing any secret Anyone should be able to send Alice a message in encrypted form. Only Alice should be able to decrypt. Anyone can send Alice a message in encrypted form. Only Alice should be able to decrypt. HOW??? Alice holds a special secret key or trapdoor info that enables her to decrypt Physical analogy: key to a locked box 6

Alice holds a secret key that enables her to decrypt aka a key to a locked box Encryption (Physical analogy): Place message in a locked box with a lock that Alice s key can open. How to get hold of such lock? Alice gives it to everyone!! Alice has a public key known to everyone which can be used for encryption, and a private key for decryption. Public Key Crypto Alice generates public (P) and private (S) keys. Encryption of message m: c = Enc(m, P) Anyone can encrypt (as P is public) Decryption of ciphertext c: Dec(c, S) Alice knows a secret key S, so can decrypt. Of course, must have Dec(Enc(m,P),S) = m The RSA Cryptosystem (1977) Rivest Shamir Adleman Pick secret, random large primes: p,q Multiply n = pq Publish : n (n) = (p-1)(q-1) Pick random e Publish : e Z (n) Euler Fermat Compute d = inverse of e in Z (n) Hence, ed = 1 [ mod (n) ] Private Key : d p,q random primes e random Z (n) n = pq ed = 1 [ mod (n) ] p,q prime, e random n = pq ed = 1 [ mod (n) ] Z (n) n, e Message m (n,e) is my public key. Use it to send me a message. (m e ) d n m m e [mod n] 7

RSA Example RSA Example n = 187=1117 e = 7 Z 160 S M I L E Y 19 13 09 12 05 2 From a codebook n = 187=1117 e = 7 Z 160 S M I L E Y 19 13 09 12 05 25 Compute message m e (mod n) 19 7 =145 mod 187 13 7 =106 mod 187 Compute message m e (mod n) 19 7 =145 mod 187 13 7 =106 mod 187 RSA Example n = 187=1117 e = 7 S M I L E Y m 19 13 09 12 05 25 m e mod n 145 106 70 177 146 185 How hard is cracking RSA? If we can factor products of two large primes, can we crack RSA? p,q random primes e random Z (n) n = pq ed = 1 [ mod (n) ] m ed mod n, where d = e -1 = 23 145 23 = 19 mod 187 If we know n and (n), can we crack RSA? (m e ) d n m Cracking RSA (125-dec.digit) Cracking RSA Team from Bellcore and MIT solved (in 1993-1994) this by using 1600 computers (over the internet) within 8 months. THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE The current record: RSA-768 (232 dec.digits): Dec., 2009 8

RSA example 1. p = 61, q = 53 2. n = 3233, (n) = 6052 = 3120 3. e = 37 (there are many to choose from) 4. EEA: d = 253 since 1 = (-3)3120+25337 Groups Generators Euler s theorem Fermat s little theorem Diffie-Hellman Key Exchange RSA algorithm Public key (3233, 37) Private key 253 Send: c = m 37 mod 3233 Read: m = c 253 mod 3233 Here s What You Need to Know 9