How does encryption work? - (Taken from www.w3.org Security FAQ)
Encryption works by encoding the text of a message with a key. In traditional encryption systems, the same
key was used for both encoding and decoding. In the new public key or asymmetric encryption systems, keys
come in pairs: one key is used for encoding and another for decoding. In this system everyone owns a
unique pair of keys. One of the keys, called the public key, is widely distributed and used for encoding
messages. The other key, called the private key, is a closely held secret used to decrypt incoming message.
Under this system, a person who needs to send a message to a second person can encrypt the message with
that person's public key. The message can only be decrypted by the owner of the secret private key, making
it safe from interception. This system can also be used to create unforgettable
digital signatures.
Most practical implementations of secure Internet encryption actually combine the traditional symmetric and the new asymmetric
schemes. Public key encryption is used to negotiate a secret symmetric key that is then used to encrypt the actual data.
Because commercial ventures have a critical need for secure transmission on the Web, there is very active interest in developing schemes
for encrypting the data that passes between browser and server.
More information on public key cryptography can be found in the book
"Applied Cryptography", by Bruce Schneier.