RSA+Second+Day

Well, well,well. The first week of class went just great. The professor made an example of RSA procedure which did not work. But it was close enough to the correct procedure that it worked once in a while, mainly due to the small modulus.

That's not confusing at all.

For this week, let's go back to the RSA procedure:

Step 1. You select, but do not divulge, two distinct prime numbers. Call them P1, P2. Step 2. Multiply them. This product becomes public knowledge. Call this C1. Step 3. Subtract 1 from each prime and multiply, (P1 - 1)(P2-1) = **K**. Then select a number which is mutually prime with this number. Call this N1. Step 4. Write down the equation N1*m - **K** *y = 1 and find a solution.

Step 5. Now create a small string of numbers to stand for your message. Your message must be smaller than C1. Step 6.Compute message^N1 mod C1. This is an RSA encrypted version of your original message.Call it M. Step 7. Compute M^m mod C1. This should be your original message.

Let's spend the second week playing with baby RSA a little bit more. The homework will now involve the crucial question: If we could factor C1, how could we use this knowledge to decrypt somebody's encrypted message?

So, in the real world, there are people who are handy enough with electronics to eavesdrop on wifi, phone lines or fiber optic cables or whatever leaving computers. (Insert McDaniel tirade about dopes who worry about NSA listening in on internet traffic. Any time you talk on a cell phone or hit Enter on a website, you are BROADCASTING. With hackers around, you may as well be standing a street corner, screaming this same info to the general public. So watch your mouth.)

The brilliance with RSA, and public key cryptography in general, is the electronic signal leaving your computer has already been encrypted. Here's a summary of what happens. Let's say you're going to buy something on the internet. The seller reassures you that they use RSA encryption. You type your credit card info into the little boxes and hit ENTER. A little gadget has been downloaded to your computer. This gadget performs RSA encryption on your information, in a blink. The gadget then broadcasts your encrypted information to the seller, who decrypts it in an even quicker blink, verifies your credit card account has the dough and completes the purchase. Pretty nifty, huh? While your encrypted information is in the clear, nobody can read it, right?

But, hey, the little gadget is just an RSA program which a decent hacker could download and read. The hacker could find C1 and N1 because these numbers are imbedded in the program. So, somebody has access to your encrypted message and the gadget used to encrypt it. And the hacker still can't decrypt it? Really? really, as long as the C1 has been chosen wisely.

This wisdom will be studied next week. For this week, let's be baby hackers who are trying to break a baby RSA gadget. We have several examples from week 1.

Homework for week 2, due September 8, 2009.

1. Take somebody else's encrypted message from week one and use their C1, N1 to break the encrypted message. Anna's Message C1:14, N1:5 Two Primes that multiply to 14 are P1:2 and P2:7 K=6 Now, 5m-6y=1 Look at 5(5)=1+6(y) where y=4 and m=5 satisfies the equation Anna's encrypted message was M=10 so M^m modC1= original message 10^5 mod14=12 Anna's original message is 12 user:D_Sweeney

Using Laura's Message: C1 = 21; N1 = 5; Encrypted message = 10

P1 * P2 = 21; P1 = 3, P2 = 7 K = (P1 - 1)*(P2 - 1) = (2)*(6) = 12 5m - 12y = 1 m = 5, y = 2 M^m mod C1 = original message 10^5 mod 21 = 19 Laura's original message is 19. user:MattJohnson1013 Encrypted message was 10, right? Say so. user:mcdaniel30

2. Make your own encrypted message using double digit primes. Put your C1 and N1 in public and write your message in public. Message: 14 C1: 143 N1: 7 user:D_Sweeney Nice choices, Dave. Somebody should bust this one in about sixteen seconds. user:mcdaniel30

Message: 18 C1:35 N1:5 This really worked a lot better than last time and feel reassured that I'm not totally dumb user:TrevorBarton

Encrypted Message = 106; C1 = 221; N1 = 5 user:MattJohnson1013

3. Take somebody's submission to number 2 and break it! This might take a while by hand. But not too long, if you're clever with programming a calculator or computer. Encrypted Message = 14 C1 = 143 N1 = 7 Dave used twin primes – it’s easy to see that P1 = 11 and P2 = 13 K = 120 N1*m – K*y = 1 7*m – 120*y = 1 m=103 y=6 M^m mod C1 = original message 14^103 mod 143 = 27 27 is Dave’s original message user:LauraShuman

Trevor's Original: message=18, C1=35, N1=5 P1=5, P2=7 K=6*4=24 5*m-24*y=1 m=5, y=1 18^5mod35=23 user:wrighann 18 is the encrypted message. 23 is the decrypted message. Let's use vocabulary because that's part of the class. user:mcdaniel30

4. Why does the decryption work so nicely? I believe that is it because the process of decryption used the same numbers as the encryption process. When you decipher the code all that is reayy needed is to find the factors of C1 then go through the same process as the encryption. Hopefully I'm not totally off. user:TrevorBarton There is much more to be said. user:mcdaniel30

5. Name a way to create large prime numbers. Use the Sieve of Eratosthenes, although its not very efficient.user:TrevorBarton Yes, the Sieve is inefficient. Where the sieve leaves off, some heavy duty methods exist to create enormous primes. We're going to be looking at the work of Tau/Green and the famous Mersenne primes soon. user:mcdaniel30