Public Key Cryptography.
Simple cryptographic methods such as substitution ciphers use one key for encrypting a plaintext message to give a ciphertext file for transmission. The same key is used to recover the original plaintext data. This can be very secure if the method of encryption is more sophisticated than simple text substitution. The problem is that it is neccessary to exchange copies of the key between sender and recipient. This exchange may be subject to interception ("sniffing") by an unauthorized third party.
One solution to this problem is public-key or asymmetric cryptography. Consider a simple substitution cipher like ROT13: The "algorithm" or reciepe goes like this: "Take the plaintext letter and replace it with one 13 letters further on in the alphabet, and if you run out of alphabet just repeat it." So A becomes N, O becomes A etc. (13 after O is beyond the end of the alphabet so we start from A again.) Now this algorithm is mathematically easily reversed, so to decrypt the resulting ciphertext we simply subtract or count backwards 13 from each letter. We say that the algorithm is symmetrical. The trick with public key cryptography is to use an algorithm that is not reversible, i.e. the key used to encrypt, will not decrypt the message.
What kind of encryption would be one way? Here's a simple example. If I said to you, what two prime numbers will, when multiplied together give you 1763? Quite difficult isn't it? But if I say what is 43 x 41, it's easy to find that the answer is 1763. So we have a manipulation that is easy one way and difficult the other. Public key cryptography uses prime numbers that are 1024 digits long, so it would take longer that the lifetime of our sun to crack this on a fast modern PC.
So, in practice, this is how it works. There is a program available (for now, until the Americans bully the world into outlawing personal privacy) called PGP (which stands for Pretty Good Privacy). It is free and downloadable from many sites on the internet. It will generate a public / private key pair for you. Now PGP can encrypt a message using the public key (actually it wil encrypt using either key, and decryption can only be done with the other one). Note that even I who wrote the message cannot decrypt it with the public key. I must use the private key to recover the plaintext. Now what I do is distribute the public key freely by making it available on my website. This means anyone who wants to send me private mail can grab the key and encode their message using PGP and my public key. Only I have the private key and so only I can decrypt these messages. The private key never goes over the internet, so nobody can sniff the key to decrypt mail sent to me. Now If I want to reply with encryption, I need to have the recipient's public key. PGP can store other people's pubkeys on a "keyring" and automatically offer to encrypt mail to recognized recipients when you use a mail browser that is PGP compliant.
There is another benefit to all this. I can use my private key as a "Digital signature".
Here's how this works. I want to send you mail and you need to be absolutely sure that it is really from me. I encrypt the message using my PRIVATE key and send it to you. You decrypt using my pubkey which you already have. If the pubkey you hold sucessfully decrypts the message, it must have been encrypted with the prikey that belongs to me. In practice, we usually only encrypt a short standard text at the end of the mail rather than the whole thing. Now the document is signed, but readable by anyone. I can then encrypt the file using your pubkey, and send it. When you recieve it, you will decrypt using YOUR private key, and then check the signature using MY public key.
This may seem very cloak-and-dagger, but in fact there are many resons why this is important. It is clear that for most uses, the internet and e-mail are replacing paper or "snail" mail. With regular mail, if the Government or any other untrustworthy organization wishes to monitor your correspondence, the sheer volume and physical difficulties make it unlikely that they would even bother unless something very important was at stake. With electronic mail there is the possibility that computers can monitor everyone's mail and report "suspicious" behaviour to a human operator. This system is already in place for satellite communications, it's called "Echelon". People might say "If you have nothing to hide, why would you encrypy your email?" My response is, "If you have nothing to hide, why do you use envelopes?" The US Government has already tried once to introduce legislation that would force users to include "back-doors" so that their mail will be readable by government agents. The argument against that is that it assumes that all government agents and police are honest and play by the law. We all know how untrue that is. What I do is send encrypted nonsense to myself merely to establish the principle that I have the right to communicate without evesdropping.
The only problem with PGP is that it is slow. It is not a problem for sending mail, but it is too slow for voice or world-wide-web use. There is a method that gets round this, an example of which is ssh or Secure Shell. How this works is that when communications start, An asymmetric connection using pub/pri key cryptography is made, and this secure channel is then used to exchange a symmetric key which is then used for fast transmissions.