Public-Key Cryptosystems – Teacher Notes and Solutions In this investigation, students learn how to use the RSA cryptosystem to encrypt and decrypt messages. LAUNCH Carry out a whole-class teacher-led launch using pages 1-2 of the student investigation. Highlight the following points from pp. 1-2: Discuss diagram at the right on page 1 Public-key cryptography can be used in two broad settings – for secret messages and for digital signatures. Secret messages o Many people encrypt their secret messages, send to one person o Many send to one o The one creates the keys o The many encrypt using the one’s public key o The one decrypts with his private key o e.g., many send their credit card numbers to Amazon o e.g., many messages sent from embassies abroad to home country Digital signatures o One person digitally sends authentic emails to many people o One sends to many o The one creates the keys o The one encrypts (authenticates) his message using his private key o The many decrypt (authenticate) the message using the one’s public key o e.g., one person sends digitally-signed email messages to many so the recipients know the message is authentic Both situations – the one individual uses the private key, the many use the public key Either key, public or private, can be used for encrypting, the other is used for decrypting EXPLORE 1. You might do this first problem in a whole-class setting as part of the launch. In any case, students should read through the RSA procedure and discuss and ask questions as needed. They will see why the procedure works in later problems. Here, they are just making sure they understand what to do at each step of the procedure. 2. NOTE: The encrypting and decrypting exponents, e and d, are multiplicative inverses of each other in Zr . It will help students to remember a key fact that they investigated in an earlier lesson on modular arithmetic: In order to have multiplicative inverses, e and d must be relatively prime to r. If p = 3 and q = 11, then n = pq = 33 and r = (p – 1)(q – 1) = 20. There are several choices for e and d: e = 3 and d = 7 (or vice versa), e = 13 and d = 17 (or vice versa), e = d = 9, e = d = 11, e = d = 19. Two of these possibilities are shown below. If e = 3 and d = 7: Encrypting F: F 6; 6e = 63 = 216 18 mod 33 Decrypting: 18d = 187 = 612,220,032 6 mod 33, and 6 F. Encrypting L: L 12; 12e = 123 = 1,728 12 mod 33 Decrypting: 12d = 127 = 35,831,808 12 mod 33, and 12 L. Encrypting E: E 5; 5e = 53 = 125 26 mod 33 Decrypting: 26d = 267 = 8,031,810,176 5 mod 33, and 5 E. If e = 13 and d = 17: Encrypting F: F 6; 6e = 613 18 mod 33 Decrypting: 18d = 1817 = (185)2 184 183 = (1,889,568)2 104,976 5,832 (12 3 24) mod 33 = 864 mod 33 6 mod 33, and 6 F. Encrypting L: L 12; 12e = 1213 = (125)2 123 = (248,832)2 1,728 (12 12) mod 33 = 144 mod 33 12 mod 33 Decrypting: 12d = 1217 = (125)2 124 123 = (248,832)2 20,736 1,728 (12 12 12) mod 33 = 1,728 mod 33 12 mod 33, and 12 L. Encrypting E: E 5; 5e = 513 = 1,220,703,125 = 26 mod 33 Decrypting: 26d = 2617 = (265)2 267 = (11,881,376)2 8,031,810,176 (232 3 5) mod 33 = 2,645 mod 33 5 mod 33, and 5 E. 3. The private keys you will need for this problem (and some extras in case you need them) are in the following table. Be sure that each student team writes down their Name in the Public Key Directory and gets the corresponding private key from you. You might post the Public Key Directory on large chart paper on the wall. Public Key Directory Name n 85 253 161 133 145 185 35 55 65 77 91 35 95 (private key) e 13 17 19 25 25 29 17 23 29 37 29 13 31 d 5 13 7 13 9 5 17 7 5 13 5 13 7 p 5 23 23 19 29 37 7 11 13 11 13 7 19 q 17 11 7 7 5 5 5 5 5 7 7 5 5 a. Students should verify that for their private key is valid. That is, they must check that p and q are prime numbers, n = pq, and e and d are multiplicative inverses mod r. b. and c. Students encrypt and decrypt messages. NOTE: Make sure students use the public key for the team to whom they are sending a message. Students may mistakenly use their private key to encrypt messages. Be sure they use the target team’s public key to encrypt the message they send to the target team, and then they should use their private key to decrypt messages that they receive. NOTE: The precision needed in calculations to encrypt and decrypt may be beyond the calculators and computer software that students are using. (They need high precision in order to find exact remainders.) If this is the case, then you can direct them to more powerful calculation resources, such as WolframAlpha (www.wolframalpha.com). NOTE: For the Public Key in which n = 35 and e = 13, it often happens that the plaintext number and the encrypted number come out to be the same. This also happens at times with the Public Key in which n = 85 and e = 13. As an extension problem you might ask students to see if they can find a reason for this. d. i. Yes, any team can send any other team a secret message. To do so they need the other team’s public key. ii. A secret message to the target team is encrypted with the target team’s public key. Decryption requires the target team’s private key, which only the target team has. So no other team can decrypt the message. (This assumes of course that nobody can break the code somehow, which actually is feasible with the small numbers used in this problem, but would not be practically possible using the large numbers in real-world applications.) 4. a. i. 3 and 11 are indeed prime numbers; r = (p – 1)(q – 1) = 2 10 = 20; 7 and 3 are multiplicative inverses mod 20 since 7 3 = 21 1 mod 20. ii. Students should verify that the theorem holds for several different values of M and the given values of p, q, e, and d. For example, suppose M = 6. Then, (Me)d = (67)3 303 mod 33 6 mod 33 and 6 = M. This verifies the theorem in the case of M = 6. b. Students should check that the theorem works with their own chosen numbers. Having to choose their own numbers forces them to look closely at the theorem. 5. a. d is the unique multiplicative inverse of e in Zr , where r = ( p – 1)(q – 1). To find d, multiply e by elements of Zr until you find an element d such that de 1 mod r. b. i. Suppose pq = 35. Then, p = 7 and q = 5. ii. Suppose pq = 77. Then, p = 11 and q = 7. iii. Suppose pq = 221. Then, p = 13 and q = 17. iv. Suppose pq = 3,431. Then, p = 47 and q = 73.