Top Banner
RSA ALGORITHM BY : Darshana Chaturvedi
31

RSA ALGORITHM

Feb 26, 2016

Download

Documents

leone

RSA ALGORITHM. BY : Darshana Chaturvedi. INTRODUCTION RSA ALGORITHM EXAMPLES RSA IS EFFECTIVE FERMAT’S LITTLE THEOREM EUCLID’S ALGORITHM REFERENCES. Outline. Cryptography Ancient art. Science of writing in secret code . - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: RSA ALGORITHM

RSA ALGORITHM

BY : Darshana Chaturvedi

Page 2: RSA ALGORITHM

OUTLINE INTRODUCTION RSA ALGORITHM EXAMPLES RSA IS EFFECTIVE FERMAT’S LITTLE THEOREM EUCLID’S ALGORITHM REFERENCES

Page 3: RSA ALGORITHM

INTRODUCTION Cryptography Ancient art. Science of writing in secret code. Art of protecting information by encrypting it into

an unreadable format, called cipher text which can be decrypted into the plain text using a secret key.

Uses Email – messages Credit card information Corporate data

Page 4: RSA ALGORITHM

CONT.. Types Symmetric-key systems(uses a single key) Public-key systems introduced in 1970’s(uses

a public key known to everyone and a private key that only the receiver of the messages uses)

Previously both senders and receivers implemented the algorithms by hand but with the advent of computers, things changed.

Page 5: RSA ALGORITHM

CONT.. Simplest cryptographic systems Algorithms for both encryption and

decryption are fixed and known to everyone. There are two inputs, the text to be encoded

or decoded and a key.

Page 6: RSA ALGORITHM

CONT.. Symmetric key encryption No message can be sent unless there has

been some prior agreement on a key. Even if there is an agreement, if the same

key is used over an extended period of time, an eavesdropper may be able to infer the key and break the code.

Page 7: RSA ALGORITHM

RSA ALGORITHM New keys must be transmitted between the

senders and receivers to avoid code breaking. The most widely used public key system is

the RSA algorithm. RSA algorithm [Rivest , Shamir and Adleman]

in 1978 We assume that Bob and Alice wish to

exchange secure messages and that Eve is attempting to eavesdrop.

Page 8: RSA ALGORITHM

CONT.. Assume that Alice wants to send a message

to Bob. Then Bob chooses a private key known only to

him. Bob exploits a function f to compute his public key, public = f(private).

Bob publishes public key. Alice exploits Bob’s public key to compute

ciphertext= encrypt(plaintext, public) and she sends ciphertext to Bob.

Page 9: RSA ALGORITHM

CONT.. Bob exploits his private key to compute

plaintext= decrypt(ciphertext, private). In order for this last step to work, encrypt and decrypt must be designed so that one is the inverse of the other.

Page 10: RSA ALGORITHM

CONT..

Page 11: RSA ALGORITHM

CONT.. If there exist efficient algorithm for

performing all four of the steps, then Bob and Alice will be able to exchange messages.

We assume that Eve knows the algorithm encrypt and decrypt . So she could easily eavesdrop if she could infer Bob’s private key from his public one or if she could compute decrypt without knowing Bob’s private key.

Page 12: RSA ALGORITHM

CONT.. RSA algorithm uses the mathematical

properties of modular arithmetic and the computational properties of prime numbers to ensure that Bob and Alice can perform their tasks efficiently but Eve cannot.

Page 13: RSA ALGORITHM

STEPSAlice uses the RSA algorithm to send a message to

Bob as follows. Bob constructs his public and private keys

Bob chooses two large prime numbers p and q. From them, he computes n=p*q.

Bob, finds a value e such that 1 < e < p.q and gcd(e,(p-1)(q-1))=1. (in other words, he finds an e such that e and (p-1).(q-1) are relatively prime).

Bob computes a value d such that d.e(mod(p-1).(q-1))= 1. In RSA terminology, this value d, rather than the original numbers p and q, is referred to as Bob’s private key.

Page 14: RSA ALGORITHM

CONT.. Bob publishes (n,e) as his public key. Alice breaks her message plaintext into

segments such that no segment corresponds to a binary number that is larger than n. Then, for each plaintext segment, Alice computes ciphertext = plaintexte(mod n). Then she sends ciphertext to Bob.

Bob recreates Alice’s original message by computing plaintext = ciphertextd(mod n).

Page 15: RSA ALGORITHM

EXAMPLE 1We can illustrate the RSA algorithm with a

simplemessage from Alice to Bob. Bob is expecting to receive messages. So he

constructs his keys as follows: He chooses two prime numbers, p=3 and

q=11. He computes n=p*q=33. He finds an e such that 1<e<33 and gcd

(e,20) = 1. Then e he selects is 7.

Page 16: RSA ALGORITHM

CONT.. Then he finds the value of d such that

d*e(mod(p-1)(q-1)) = 1. Hence d is 3 as 3*7(mod 20) = 1.So,3 is the Bob’s private key.

Bob publishes (33,7) as his public key. Alice wishes to send the simple message 2. So

Alice computes 27 (MOD 33) = 29. Alice sends Bob the message 29. Bob uses his private key to recreate Alice’s original

message by computing 293 (MOD 33) = 2. Hence, Bob decrypts the message and read it.

Page 17: RSA ALGORITHM

EXAMPLE 2Sending message from Alice to Bob Bob is expecting to receive messages. So he

constructs his keys as follows: He chooses two prime numbers, p=19 and

q=31. He computes n=p*q=589. He finds an e that has no common divisors

with 18*30=540. The e he selects is 49.

Page 18: RSA ALGORITHM

CONT.. He finds a value d =1069. Notice that

1069*49 =52381. Bob needs to assure that the remainder, when 52381 is divided by 540, is 1. And it is :52381=540*97+1. Bob’s private key is now 1069.

Bob publishes (589,49) as his public key.

Page 19: RSA ALGORITHM

CONT.. Alice wishes to send the simple message “A”.

The ASCII code for A is 65. So Alice computes 6549(mod589). She does without actually computing 6549. Instead, she exploits the following two facts:

ni+j=ni*nj

(n*m)(mod k) =(n(mod k)*m(mod k))(mod k) Combining these, we have: ni+j(mod k) = (ni(mod k)*nj(mod k))(mod k)

Page 20: RSA ALGORITHM

CONT..So, to compute 6549,first observe that 49 can beexpressed in binary as 110001. So 49 =

1+16+32Thus, 6549 = 651+16+32.The following table lists

the required powers 65: 651(mod589)=65 652(mod589)=4225(mod589)=102

654(mod589)=1022(mod589)=10404(mod589)=391

Page 21: RSA ALGORITHM

CONT..658(mod589)=3912(mod589)=152881(mod589

)=3306516(mod589)=3302(mod589)=108900(mod58

9)=5246532(mod589)=5242(mod589)=274576(mod58

9)=102So we have:6549(mod589) = 651+16+32(mod589)

=(651*6516*6532)(mod589)=((651(mod589))*(6516(mod589))*(6532(mod58

9)))(mod589)

Page 22: RSA ALGORITHM

CONT..=(65*524*102)(mod589)=((34060(mod589))*102)(mod589)=(487*102)(mod589)

=198 Alice sends Bob the message 198. Bob uses his private key(1069) to recreate

Alice’s message by computing 1981069(mod589). Using the same process Alice used, he does this efficiently and retrieves the message 65.

Page 23: RSA ALGORITHM

RSA IS EFFECTIVE The function encrypt and decrypt are inverse of

each other and it is proved using euler’s generalization of Fermat’s Little theorem.

Bob can choose primes efficiently using the following algorithm. Randomly choose two large numbers as

candidates. Check the candidates to see if they are prime.

This can be done efficiently using a randomized algorithm, Fermat’s Little theorem.

Page 24: RSA ALGORITHM

FERMAT’S LITTLE THEOREM If p is prime , then, for any integer a, if

gcd(a,p) = 1, ap-1 ≡ 1 (mod p). Where , x ≡ y (mod p) means x and y have

the same remainder when divided by p. Example : p = 5 and a = 3, then , 3 (5-1) = 81 ≡ 1 (mod 5) which is true. So, 5 passes the Fermat test at a = 3. If p fails the Fermat’s test at ‘a’ then we will

say that ‘a’ is a Fermat witness that ‘p’ is composite.

Page 25: RSA ALGORITHM

CONT.. The theorem tells us that if ‘p’ is prime ,then

it must pass the Fermat test at every appropriately chosen value of a.

QUESTION : If p passes the Fermat test at some value of ‘a’, do we know that p is prime?

ANSWER : No Conclusion : If p is composite and yet it

passes the Fermat test at ‘a’, we will say that ‘a’ is a Fermat Liar that p is prime.

Page 26: RSA ALGORITHM

CONT.. Randomly choose values for ‘a’ looking for a witness

that p is composite. Note : Consider the values which are less then p only. So, if p is prime then gcd(a,p) is always 1. No need to evaluate gcd anymore in our algorithm. If we fail to find a witness that shows that p is

composite, we will report that p is prime. As liars exists, increase the likelihood of finding such

a witness , if one exists, by increasing the witnesses that we test.

Page 27: RSA ALGORITHM

CONT.. Algorithm : Input : A value to be tested and the possible

witnesses to be checked. Output : Composite or Probably Prime number. simpleFermat(p:integer,k:integer) = Do k times. - Select a in range 2 to p-1 - If ap-1 ≡ 1 is not true , return Composite If all tests passed then return Probably Prime.

Page 28: RSA ALGORITHM

CONT.. Some composite numbers pass the test

at all values of ‘a’ and are called ‘Carmichael numbers’.

Every value of ‘a’ is a Fermat liar for every Carmichael number, so no value of k will enable simpleFermat to realize that a Carmichael number is not prime.

Page 29: RSA ALGORITHM

EUCLID’S ALGORITHM Successive division of 2 numbers followed by the

resulting remainder divided into the divisor of each division until the remainder is equal to zero. Then the remainder of the previous division is the gcd.

Example : Divident = Quotient * Divisor + Remainder If a = 1071 and b = 462, gcd (1071,462) is : Then, 1071 = 2 * 462 + 147 462 = 3 * 147 + 21 147 = 7 * 21 + 0 Stop, as remainder is 0. gcd (1071,462) = 21

Page 30: RSA ALGORITHM

REFERENCES Automata, Computability, and Complexity|

Theory and Applications by Elaine Rich. En.wikipedia.org Presentation from the previous class

Page 31: RSA ALGORITHM

THANK YOU