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?

783 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

~~Public keys cannot decrypt data encrypted by the private key, they can only encrypt. Private keys can encrypt and decrypt.~~

You could think of a private key as two pure colors and the public key as the mixture of those two colors into one color.

You can hand out the public key because there are a LOT of ways you could mix colors to get the mixed color of the public key, but only one of them is represented by the private key.

The data you are encrypting is also a “color”, and encryption will give you a “color” that is composed of three colors (private key colors and data color). Good luck figuring out the components (and therefore the data contained within) without knowing the private key colors.

If you have the private key, you know how to separate the components of the encrypted color into its component colors, giving you the private key colors and the data color. Congrats! You have recovered the data.

The difference is that in reality, we use numbers instead of colors. The private key is two really big co-prime numbers (two numbers that do not divide each other evenly) and the public key is the product of those two numbers. There will be a lot of ways to factorize this number, good luck finding the pair of factors that is the private key. The encryption part is a bit more nuanced than mixing colors/multiplying numbers, but I hope you get the idea at this point

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