0

This question already has an answer here:

I looked this up a few times already, but I still don't really understand how public/private key encryption works. The wikipedia page on public-key cryptography says this:

Public key cryptography, or asymmetrical cryptography, is any cryptographic system that uses pairs of keys: public keys which may be disseminated widely, and private keys which are known only to the owner. This accomplishes two functions: authentication, which is when the public key is used to verify that a holder of the paired private key sent the message, and encryption, whereby only the holder of the paired private key can decrypt the message encrypted with the public key.

The part I don't understand is why only the holder of the private key can decrypt the message encrypted with the public key. When you encrypt a message with a key, it should be possible to decrypt it with the same key right?

marked as duplicate by Steffen Ullrich, Tobi Nary, schroeder Nov 29 '17 at 20:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

A private key and public key work in as a pair. The public key (which is specific to person A but everyone knows it [let everyone be B]) can be used to encrypt a message. B then sends the message to A. The private key for person A can then be used to decrypt the message. If A wants to send a message back to B, they will first encrypt it with B's public key, send it, then B would decrypt it using their private key.

A good analogy is here:

For example, if Bob wants to send sensitive data to Alice, and wants to be sure that only Alice may be able to read it, he will encrypt the data with Alice's Public Key. Only Alice has access to her corresponding Private Key and as a result is the only person with the capability of decrypting the encrypted data back into its original form.

As only Alice has access to her Private Key, it is possible that only Alice can decrypt the encrypted data. Even if someone else gains access to the encrypted data, it will remain confidential as they should not have access to Alice's Private Key.

EDIT: So a "public" key is known by everyone but is specific to one person.

EDIT 2: The reason a public key can't decrypt something that was previously decrypted with the same key is explained here. Basically, the whole point of encryption is to use a simple calculation to encrypt that is almost impossible to decrypt - which is what happens here.

Not the answer you're looking for? Browse other questions tagged or ask your own question.