Download presentation
Presentation is loading. Please wait.
1
Public Key Cryptography
Lesson 4-7 AP Computer Science Principles
2
Objectives Students will be able to:
Explain what the modulo operation does and how it operates as a "one-way" function Follow an asymmetric encryption algorithm to encrypt a numerical message using the Public Key Crypto widget. Explain the difference between symmetric and asymmetric encryption. Describe characteristics of the mathematical properties that make public key encryption possible Explain the benefits of public key cryptography
3
From the Video Can someone in their own words explain what the video refers to as ‘asymmetric encryption’?
4
Asymmetric Encryption
Can someone summarize what we learned from previous lessons about desirable properties of encryption? When designing an encryption algorithm what are the main goals?
5
Asymmetric Encryption
Take a moment and think about this problem: assuming two people can only communicate over insecure channels, how can they send encrypted messages to each other, if they haven’t met ahead of time to agree on anything? One answer is to use different keys: a key to “lock” the message that is public, and a key to “unlock” it that is private. This idea of different keys is easy to say, but how does it actually work?
6
Asymmetric Encryption
The video says “the way this works is with some mathematics that we won’t explain”. But the way that asymmetric encryption works though is super interesting and the properties and reasons why the math works are possible to understand. In this lesson we’re going to take a walk through how public key encryption works because it’s fascinating, and also crucial to every modern method of keep data safe and secure on the web.
7
Public Key Cryptography
The problem of how to send encrypted messages without establishing keys in private ahead of time baffled cryptographers and computer scientists for years, but there is a way to do it! In this demonstration we will act out a way to send secret messages that does NOT rely on a shared secret key. This method is called public key cryptography because the “key” needed to encrypt something is actually public, and can be used by anyone! But that key cannot be used to decrypt.
8
Public Key Cryptography
The goal for this demonstration is to understand the basic mechanics of how public key cryptography works which requires the exchange of a few messages across insecure channels. For the demonstration we’ll use physical objects to stand in for data and information in order to understand the basics. Afterward we’ll take another step toward understanding how this works with math.
9
Cups and Beans - A metaphor for an encryption function
In cryptography scenarios computer scientists use stock characters: Alice and Bob (“A” and “B”) who are trying to send messages to each other Eve the ‘eavesdropper’ is listening in. You should always assume that Eve can see everything that Alice sends to Bob and vice versa.
10
Cups and Beans - A metaphor for an encryption function
Have you ever been to a carnival or fair where there’s a big glass jar of candy (usually jelly beans) and you’re supposed to guess how much candy is in the jar? We’re going to use that idea as a metaphor for an encryption function - it’s easy to count out some candies and put them into a jar, but really hard, if not impossible, to guess how many there are once the jar is closed and locked.
11
Cups and Beans - A metaphor for an encryption function
For our demonstration today: Imagine that putting some beans into a clear plastic cup and then putting a lid on the cup is an encryption function. Only the person who put the lid on is able to remove it. Everyone else can try to count the beans but they can’t take the lid off; they just have to stare into the cup (like trying to count the jelly beans in a jar at the carnival). This represents a computationally hard problem. There is one wrinkle: a person can add beans to the cup after the lid has been put on by pushing them through the slot in the top of the lid. The result is that there will be more beans in the cup, but it’s still hard to count them by looking in from the outside.
12
Cups and Beans - A metaphor for an encryption function
Notice… At no point did Bob or Alice agree on any secret password, number, or key. They only exchanged information in public. Bob can encrypt a secret message for Alice by using something that Alice puts out in public Eve could not tell what was going back forth without simply guessing either Alice or Bob’s private number.
13
Cups and Beans - A metaphor for an encryption function
Asymmetric Keys The cups and beans represent asymmetric (pronounced “ A-symmetric”) encryption because the procedure for encrypting a message (which Bob does) is different from the procedure for decrypting the message (which Alice does). Up to this point, the encryption schemes we’ve studied have been symmetric. This means that the key used to encrypt the message is the same key needed to decrypt the message.
14
Cups and Beans - A metaphor for an encryption function
Private Key In the case of this activity, Alice’s secret number - the number of beans that she put into the cup originally is known as her private key . Only she knows it, and she never shares it with anyone. Public Key The sealed container sitting on the table represents Alice’s public key . In the real world a public key is something related to the private key, that can be safely shared in public, that another person can use to encrypt a message. In this case, the cup with the lid on top.
15
Cups and Beans - A metaphor for an encryption function
Encrypting (a message) When Bob adds beans to the sealed cup, he is using a public key to encrypt a message. Since they get mixed in with the other beans (which are related to Alice’s private key), no one, not even Bob, knows how many total beans there are. Decrypting (the message) When Alice receives the cup back from Bob, she can decrypt the message by opening the lid and counting the beans. Since she knows how many beans she put in in the first place, she can subtract that number of beans and arrive at the number that Bob intended to send.
16
Cups and Beans - A metaphor for an encryption function
Public Key Cryptography This entire form of exchange is called Public Key Cryptography . In this form of secure communication, every participant has both a public and a private key. When sending a message, the sender encrypts his message using the public key of the recipient.
17
Encryption The cups and beans demonstration showed us how the mechanics of public key cryptography works. It’s a big deal that asymmetric encryption allows for two parties to send secret messages to each other over public channels without having to agree on a secret encryption key ahead of time. Today we’ll see how encryption is really done using numbers and (gasp) math. To see how it works, we have to learn about a real one-way function first, one that uses numbers.
18
But First… Imagine that you are the kind of person who, when you close your eyes, you lose complete track of time. When you open your eyes, a minute could have passed or an hour…or a day…or a week…or a year…you don’t know.
19
How much time has passed?
So, now imagine a clock that reads 4:00.
20
How much time has passed?
Now close your eyes and I’m going to add some time to the clock - I’m going to simulate that some amount of time is passing. Remember, with your eyes closed, any amount of time could be going by.
21
How much time has passed?
Now open your eyes, look at the clock and, without saying anything to anyone, write down how much time has passed.
22
One Way Functions So a clock represents a one-way function! (For simplicity, let’s just say we’re only talking about the hour hand on the clock.) No matter what number you put into it, since only numbers 1-12 can show, the only answer you’re going to get is We say that any number “wraps around the clock.”
23
One Way Functions Even if the number is 2,023,789 hours, if you wind the clock around, it will still come out as a number This means that from the clock face alone, we cannot work backwards; we cannot know what the original number was that went into the clock.
24
Modulo Clock Real cryptography uses this technique, but with clocks that can have a wide range of possible values on their faces. The operation is called modulo. So first, we’re going to experiment a little bit with this kind of “clock arithmetic” using a widget.
25
Modulo Clock Work in pairs to explore the widget
Read the Modulo Clock Instructions (yes read them!) Stage 7 Step 3 Then click into the widget and follow the instructions there (Stage 7 Step 4) Make sure you read the description of terminology at the bottom of the first page of the activity guide.
26
Terminology The “clock” is a helpful visual and mental aid, but the real terms for what we’re doing are: modulus - the size, or number of ticks on the clock modulo or mod - the name of the mathematical operation for “wrapping” a number around a clock. For example, if we want to see the result of counting up to 247 on a clock of size 37, we would say that we are doing “247 MOD 37.” Note: The MOD operation is the same as finding the remainder when dividing the number by the clock size. So, 247 ÷ 37 = 6 with remainder 25. 247 MOD 37 = 25
27
Public Key Cryptography Widget
We can use modulo as an encryption function, too. A weakness of the cups and beans was that we were actually sending the real numbers we intended to use over public channels, and we had to pretend that Eve couldn’t count them. Now we’re going to re-enact the public key encryption procedure we did with cups and beans, but we’re going to use multiplication and modulo to create our keys and secret messages!
28
Public Key Cryptography Widget
Organize into groups of three, one each to play Alice, Bob and Eve. (Doubling up on a character is fine if necessary.) Using the Activity go into the widget (Stage 7 Step 6) The first time through, select your character in the widget and follow just their character’s instructions. Send an encrypted message a few times, using different values and possibly playing different roles.
29
Questions What did Bob need to know to send a secret message to Alice?
Do Bob and Alice need to share any secrets - like a secret key - in order to send a private message?
30
Questions Public Key Encryption was (and is) considered a major breakthrough in computer science. Why do you think it’s so important? What does public key encryption allow us to do that other encryption schemes don’t?
31
Asymmetric encryption and public key cryptography
Public key cryptography uses asymmetric encryption Bob is able to encrypt a secret message for Alice without needing to know her private key, but instead her “public key” The only “information” exchanged in public, where Eve could see it, was the result of one-way functions that produced data that would be “computationally hard” to crack. Anyone, not just Alice, could make a public key (a sealed cup of beans) and put it out in public with their name on it, allowing anyone else to encrypt a message just for them! Because the method is publicly known it actually makes the encryption MORE secure since both good and bad guys know how hard it is to crack.
32
Asymmetric encryption and public key cryptography
This is asymmetric encryption in a nutshell: One key can only be used to encrypt data, and a different (but related) key can only be used to decrypt. That “related key” relies on mathematical properties that make it easy to produce a public/private key pair, but hard to figure out the private one if you can only see the public one. The fact that modulo acts as a one way function is critical to this process.
33
Stage 7 Complete Stage 7
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.