In encryption, how is it you can decrypt with a private key what was encrypted with a public key, or decrypt with a public key what was encrypted with a private key, but not private-to-private or public-to-public?

781 views

I am having a complete mental block understanding decryption with public and private keys. In my head, I am (apparently) falsely equating decryption to using a *Little Orphan Annie* decoder ring like in the movie *A Christmas Story*.

If a block of data was encrypted with a key, I can’t understand how a another key that is completely different is able to decrypt that data. I know there’s a fair bit of complex math involved, but if you multiple X by Y to get Z, then the only way to get X back from Z is to divide by Y.

* data->public key->encrypted->private key->data
* data->private key->encrypted->public key->data
* data->public key->encrypted->public key->error
* data->private key->encrypted->private key->error

In: 2

11 Answers

Anonymous 0 Comments

Think of it like a math problem:

x * y * z = m

If x is a private key, y is a public key, and z is an encrypted message, then m is the decrypted message.

When I encrypt a message *to you*, I use **your** public key (‘y’), and you already have your own private key (‘x’), and I’m giving you an encrypted message ‘z’. From there, you have all the “numbers” you need to get the decrypted message ‘m’. **You** have x, y, and z, but everyone else only has y and z.

If someone intercepts the message, they’re missing ‘x’. They can try to guess it, but they have to do the math and check ‘m’ every single time and *hope* they get a message that makes sense.

When *you* encrypt a message *to me*, you use **my** public key (‘y’), and do the same thing described above. Because I know what my own private key (‘x’) is, it’s easy for me to decrypt.

So essentially the way it works is there is one part of the equation that each individual party knows and **nobody** else knows (in an ideal situation). Without knowing that part of the equation, nobody else can decrypt your message unless they guess and get lucky.

——————–

Let’s do a simple example in the format of x * y * z = m:

I tell you “Hey, x * 2 * 3 = m”. So I ask you, what is the value of ‘m’?

You can’t give me a definitive answer because you don’t know what ‘x’ is.

I know x is 5 (my private key), so I can tell you “the value of ‘m’ is 30”.

If instead you tried the public key (‘2’) in place of ‘x’, you would say “the value of ‘m’ is 12”, which is incorrect because my private key is not ‘2’.

You are viewing 1 out of 11 answers, click here to view all answers.