Crash course on cryptography: Introduction
Cryptography literally means "the art of secret writing". It allows two people, commonly known as Alice and Bob, to communicate with each other securely. This means that an eavesdropper, referred to as Eve, will not be able to listen in on their communication. Cryptography also enables Bob to check that the message sent by Alice was not modified by Eve and that the message he receives was really sent by Alice.
Cryptography can be as simple as using code words such as "1 if the attack is by land, 2 if the attack is by sea". You can have a whole book full of code words which you can use to construct messages that only other people who have the code book can read. Such code books tend to be rather impractical and limited in vocabulary. Furthermore, if Eve manages to get a copy of the code book, she can now listen in on all conversations and it might be very difficult to give everybody else the new code book at that time.
For these reasons, and because of the tremendous advance in computing technology, in the last few decades the use of cryptography based on mathematics has become more popular. Specially designed mathematical algorithms can transform messages into something unreadable (encryption) and back (decryption). To do this securely, these algorithms use a key that influences the transformation. Different keys result in different outcomes, and only with the same key can a particular transformation be reversed.
Public key and secret key cryptography
There are two major classes of cryptographic systems. The first is called secret key encryption. These systems use a single key, which Alice and Bob both must know. They must keep it a secret (hence the name) from Eve, otherwise Eve will be able to decrypt any messages encrypted using that key.
The second class is called public key encryption. In these systems Alice and Bob both have a key pair, not just a single key. Every pair consists of a public key and a private key. Alice and Bob can freely tell each other what their public keys are, and Eve is allowed to obtain a copy of their public keys. Using Bob's public key Alice can encrypt messages to Bob. Bob can then only decrypt those messages using his private key.
Cryptography has many practical applications, in particular for electronic communication on the Internet. Alice and Bob can of course encrypt the e-mail messages they exchange. They can also encrypt live communication sessions such as remote logins or chat sessions. In such applications typically every character or sentence Alice enters is encrypted and transmitted as a separate message over an insecure channel. Cryptography is also often used to protect Web transactions and other e-commerce applications. For example, many e-commerce sites use SSL encryption to protect confidential transmissions (which can be seen from the 'https' URL or the little lock in the browser window).
Another popular application is securely logging into remote systems. Traditional methods, such as Telnet, are not secure. Using an application like Secure Shell (ssh) the connection to a remote host is encrypted, making it impossible for third parties to 'tap' the connection.