1 / 21

RSA

RSA. Prime Numbers. An integer p is a prime number if it has no factors other than 1 and itself. An integer which is greater than 1 and not a prime number is said to be composite. Thus given a composite number c we know that c=r*s for some non-trivial integers r and s .

arlais
Download Presentation

RSA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. RSA

  2. Prime Numbers • An integer p is a prime number if it has no factors other than 1 and itself. • An integer which is greater than 1 and not a prime number is said to be composite. • Thus given a composite number c we know that c=r*s for some non-trivial integers r and s.

  3. Factorisation • Given an integer n, there is an efficient algorithm to determine whether n is composite or prime. • However determining the factors of a large composite number is a very hard problem. • Known as the factorisation problem – this is the basis of the RSA cryptosystem.

  4. The fastest factorisation algorithm at the moment is called the “Number Field Sieve” but even this is not all that efficient. • To find the factors of a composite number n which is the product of 2 large primes, and has about 640 binary bits (approximately 200 decimal digits) is an impossible task even if you could use all of the computing power in the world!

  5. Important to Note: • Determining whether a large number is prime or composite is easy; • Multiplying 2 large numbers together is easy; • Factorising a large number which is the product of 2 large primes (i.e. retrieving the original prime factors) is very difficult.

  6. Fermat’s Little Theorem If p is a prime number and a is any number between 1 and p-1 inclusive, then ap-1 mod p = 1 This is not true in general, which gives us a method to decide if a given number n is prime or composite.

  7. Solving a problem Suppose I have • a prime number p; • a number m between 1 and p-1 inclusive; • another number e also between 1 and p-1; And I compute • c = me mod p If I give you c,e and p can you find m?

  8. Yes you can if you take the following steps: • Find a number d such that e*d=1 mod p-1 • Compute cd mod p = m

  9. Why does that work? • We found d such that e*d = 1 mod p-1 That means that e*d – 1 = k(p-1) for some value of k. Or ed = k(p-1) +1

  10. 2. We computed cd mod p But cd = (me)d mod p = med mod p = mk(p-1) +1 mod p = mk(p-1) * m mod p = 1*m mod p = m mod p

  11. This works because of Fermat’s Little Theorem. • We know that since p is a prime we have ap-1=1 mod p for all a and so ck(p-1) = 1 mod p leaving us with the answer m in step 2. • BUT if the modulus is not a prime number then the method doesn’t work.

  12. Why doesn’t it work? • In general an-1  1 mod n if n is not prime. • We could make the method for finding m work if we knew the number r such that ar = 1 mod n If a and n are co-prime then there will be such a number r and there is a way to find it

  13. Finding r • In order to find r such that ar = 1 mod n, you have to be able to factorise n and find all of its prime factors. • If n = p*q where p and q are primes then r = (p-1)*(q-1)

  14. Important to note now: • It is easy to determine whether a large number is prime or composite. • It is easy to compute the product of two large primes n = p*q. • Setting r = (p-1)*(q-1) we have mr = 1 mod n for all m co-prime with n.

  15. Given e (co-prime with r), it is easy to determine d such that (e*d) =1 mod r • It is easy to compute me mod n • If c=me mod n then m=cd mod n and it is easy to compute cd mod n if you know d. • You can only find d if you can find r and you can only find r if you can factorise n. • Factorising n is hard.

  16. This is the basis of the RSA public key cryptosystem. The holder of the public key knows p and q and therefore he/she can find r and therefore d and can compute cd mod n to find m. • No-one else knows p and q, so they cannot find r or d and so they cannot recover m. • There is no known way to recover m which is not equivalent to factorising n.

  17. RSA – Key Generation • Bob generates two large primes p and q (each with approx. 100 decimal digits). • He computes n = p*q • He computes r = (p-1)*(q-1) • He chooses a random number e which isbetween 1 and r which has no factor in common with r.

  18. He computes the private keyd by solving the equation (e*d) =1 mod r. • He can now carefully dispose of the values of p, q and r. • Bob keeps d private but publishes the value of the pair (e,n). This is his public key.

  19. RSA - Encryption Alice wishes to send Bob a message m. She takes the following steps: • She looks up Bobs public key pair (e,n) . • She computes c=me mod n and sends the value of c to Bob

  20. RSA - Decryption Bob receives the value c from Alice. He decrypts it using his private key d by computing m=cd mod n

  21. Notes • The message m must be smaller than n. Alice breaks her message up into blocks each with a value less than n and encrypts each of these blocks individually. • The public key can be used by anyone wishing to send Bob a message. He does not need a separate key pair for each correspondent.

More Related