One problem with many cryptographic algorithms is that they require
the distribution of shared keys. A password is a good
example of a shared key. The problem with shared keys is that they
must be shared between communicating entities before secure
communication can start. The sharing process, however, can be
vulnerable to eavesdropping, which leads to a chicken-and-egg
problem: before we can exchange data securely, we must first
exchange secret keys securely.
This problem was solved in 1976 by Whitfield Diffie and Martin
Hellman, with the creation of public key cryptography.
In the Diffie-Hellman public-key system each communicating party holds
a pair of keys -- one public and one private. The
private key is known only to the communicating party, while the public
key can be given to anyone. Data encrypted using one of the keys
can only be decrypted with the other.
Thus, if you want to create a message to be read only by a
particular party, you use their public key to make the encryption,
and they then use their private key to decrypt the message.
Likewise, if you encrypt a message with your private key, then
anyone who has a copy of your public key can use it to decrypt
the message. This assures the person on the receiving end that the message
came from you and not someone else, since only you have your private key.
A message that you have encrypted in this way bears your
digital signature.