Confusion with public and private key


I taught all of U4L7 for the AP CSP curriculum and my students are still very confused. They are hung up on the math behind why the widget works and they cannot see the relationship between the modulus and the concept. Any advice on how to help simplify or clarify?



This support in the lesson plan was helpful to me when I taught this lesson. As I prepare to teach it in a week or so, I am also pondering ways to present it that doesn’t lose students. The takeaways I want are:

  1. how to calculate mod Since it is not a button on most calculators, most students are new to the operation.
  2. mod is a one way function i.e. easy to calculate but very difficult to do the ‘inverse’. Students know how to ‘undo’ basic operations like addition or multiplication but the mod function can have infinite answers. For instance, if I said some number plus 7 is 20, there is only one answer. But, if I said some number mod 7 is 2, the number could be 16, 23, 37, 44…
  3. RSA encryption, in real life, exploits this by using really large prime numbers
  4. The widget models the algorithm but keeps the numbers reasonably small so we can see ‘under the hood’

    Even though Eve has the public information (some calculated using mod), she has to randomly guess the secret number which represents a message. Basically, trying to solve the equation where the message is x. Since there are technically infinite answers, this process is a challenge even with the widget’s reduced number size.
  5. They will not have to do this calculation. It’s more about understanding asymmetric encryption.

When I taught this 2 years ago, my students really struggled with the cups and beans activity. After spending a lot of time on modulus, I sold this activity as a magic trick. We did several rounds of just one Alice and one Bob for the whole class and I shared their screens. I made sure the numbers stayed really small at first so we could do the calculations by hand. After I felt they got a handle on those two roles and they trusted the widget, I was Eve for Alice/Bob pair. Then, I challenged the all the other students to be Eve - to break the code. Then, I shared how it works in real life.

This support in the lesson plan was helpful to me when I planned for this year.

Happy computing,


Hey Guys,

This lesson seemed daunting at first, but I just needed time to process and understand the concepts and how the widget fit into the overall concept of asymmetrical encryption. Here is a good video that I think further illustrates the point of - asymmetric encryption -

Hope this helps


You are right! Thanks for sharing!


Wow. Great video! Thank you!


I found this article helpful also:


I love this article! Thanks for sharing it! I can see students too liking the metaphor!