Is this public key encryption?

  • Thread starter Thread starter DaveC426913
  • Start date Start date
DaveC426913
Gold Member
Messages
23,864
Reaction score
7,903
TL;DR Summary
I mean, sure, it only uses a key that has 365 combinations...
I've tried to intuit public key encryption but never quite managed.
But this seems to wrap it up in a bow.

1758918719818.webp


This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher.

Is this how PKE works?

No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
 
Technology news on Phys.org
No, that's something like a one-time pad. There's a single secret that can be used for encryption and decryption.

The thing about public key encryption is that I can share the encryption key with you and you still can't decrypt a message. Or (more precisely) you need a very large computer and a lot of time to deduce the decryption key from the encryption key. Here, anybody who knows the birthdate (which is the secret key) can both encrypt and decrypt.

It's clever, though.
 
  • Like
Likes Nugatory and FactChecker
My (non-expert) two cents:
Suppose I broadcast a "public key": aieo19gkeu, and say that anyone can use it to encrypt and send me a message that nobody, except myself, can decrypt. ADDED: aieo19gkeu can not be used to decrypt a message that it encrypted. I am the only one who knows the private key that can decrypt a aieo19gkeu - encrypted message. Even the sender can not decrypt it, (but he already knows what the message is).

This doesn't seem the same as your example.

ADDED: Of course, I wouldn't really "broadcast" the public key. I would just not worry so much if someone intercepted it. All the interceptor could do is send me messages. He could not decrypt and read the legitimate messages.
 
Last edited:
DaveC426913 said:
I've tried to intuit public key encryption but never quite managed.
Try this:

I send you a box and a padlock that's currently open. I have the key to the padlock, but no one else does.

You put your message into the box, put the padlock around the hasp, and lock it. Then you send it back to me.

Putting your message into the box and locking it with the padlock corresponds to encrypting your message with my public key. The difference, of course, is that decrypting the message without knowing my private key is many, many, many, many, many orders of magnitude more difficult than picking a padlock without having its key (or cutting the padlock, for that matter).
 
FactChecker said:
ADDED: Of course, I wouldn't really "broadcast" the public key.
You might want to, as it makes it possible to prove that a message came from you. Say you want to make a public proclamation that is unquestionably from you instead of an imposter…. You would encrypt it using your private key, then release that to the world. As long as your public key is widely known, everyone will be able to read your statement and will know that it could only have come from you.
(In practice digital signing algorithms are more sophisticated than that, but the principle is the same: that which can be read using the public key must have come from the owner of the private key).
 
  • Like
Likes FactChecker and PeterDonis
https://medium.com/techanic/the-math-in-public-key-cryptography-in-simple-words-with-examples-e3a18cb4fa85 said:

Creating public and private keys​

Public and private keys are created using mathematical functions based on modular arithmetic and the properties of co-prime numbers. Here is a step-by-step example of how public and private keys are created:
  1. Select two prime numbers: To create a public and private key pair, two different prime numbers must be selected. For example, let’s choose p = 17 and q = 23.
  2. Compute n: Compute the product of the two prime numbers. n = p * q = 17 * 23 = 391.
  3. Compute φ(n): Compute the Euler’s totient/phi function of n, which is the number of positive integers less than n that are co-prime to n. φ(n) = (p-1) * (q-1) = 16 * 22 = 352.
  4. Choose a co-prime number: Choose a number e that is co-prime to φ(n). In other words, e should have no common factors with φ(n) other than 1. For example, let e = 5.
  5. Compute the private key: Compute the private key d, which is the multiplicative/modular inverse of e modulo φ(n). In other words, d is the number such that (d * e) mod φ(n) = 1. In this example, d = 141.
  6. Public and Private Key Pair: The public key is (n, e) and the private key is (n, d).
To encrypt a message m using the public key (n, e), we first convert the message into a number m using a chosen encoding method. Then, we apply the encryption function C(m) = m^e mod n, which generates the encrypted message.

To decrypt the encrypted message C using the private key (n, d), we apply the decryption function D(C) = C^d mod n, which recovers the original message.

For example, let’s say we want to encrypt the message M = “HELLO” using the public key (391, 5). First, we convert the message into a number m = 72736576 using ASCII encoding. Then, we apply the encryption function C(m) = m^e mod n = 72736576⁵ mod 391 = 113.

To decrypt the encrypted message C = 113 using the private key (391, 141), we apply the decryption function D(C) = C^d mod n = 113¹⁴¹ mod 391 = 72736576, which recovers the original message “HELLO”.
 
Nugatory said:
You might want to, as it makes it possible to prove that a message came from you.
Say you want to make a public proclamation that is unquestionably from you instead of an imposter…. You would encrypt it using your private key, then release that to the world. As long as your public key is widely known, everyone will be able to read your statement and will know that it could only have come from you.

(In practice digital signing algorithms are more sophisticated than that, but the principle is the same: that which can be read using the public key must have come from the owner of the private key).
Ohhhhhhh.

That answers one question I never quite understood.

They do publish them. Like, in a catalogue. The intent is for them to be widely known, right?

And now I see why.
 
jack action said:
Creating public and private keys...
See, that's the thing. I see very detailed descriptions of exactly how it works, but that doesn't help me intuit it. With all the math, I can't see the forest for the trees.
 
DaveC426913 said:
See, that's the thing. I see very detailed descriptions of exactly how it works, but that doesn't help me intuit it. With all the math, I can't see the forest for the trees.
What the math says:

There are 2 keys, one than encrypts the message (the public one that anyone can get), and a second one that decrypts the message (the private one that only you can use).

So the message can only be addressed to you and can only be read by you. If you want to respond, the other person will have their own public key (for you to encrypt your message to them) and private key (for them to decrypt it).
 
  • #10
DaveC426913 said:
They do publish them. Like, in a catalogue. The intent is for them to be widely known, right?
That certainly is one application. It uses the public/private keys to allow a person in the public who receives a message that you send to know the authorship because he can decrypt it. It does not protect your message from being read by others.
Another application is what I tried to describe in post #3. It allows people in the public to send you messages that nobody other than you can read, even if they intercept it. It does not confirm authorship of the messages that you receive (since many in the public might have the public key).
It would be possible, using multiple paired public/private keys, to get both benefits.

You mentioned the short length of the key in your example. There is a trade-off regarding the security of a long public key versus the computational efficiency of decrypting a message with a shorter public key. In order to reduce the possibility of a snooper intercepting or figuring out the public key, it can be made huge. That also makes it hard for him to figure out a matching private key. Using a huge public key is computationally expensive, so it is usually only used to decrypt a single-use efficient (symmetric) key at the beginning of a message which can then be used to efficiently decrypt the rest of the massage.
 

Similar threads

Back
Top