I always think encryption is a really complex topic. So I try to understand “just” enough…
Here are some notes from How stuff works.
Public-key encryption uses a combination of a private key and a public key. The private key is known only to your computer, while the public key is given by your computer to any computer that wants to communicate securely with it. To decode an encrypted message, a computer must use the public key, provided by the originating computer, and its own private key.
Symmetric key install the key on each one. Symmetric-key encryption is essentially the same as a secret code that each of the two computers must know in order to decode the information.
A digital certificate is basically a bit of information that says that the Web server is trusted by an independent source known as a certificate authority.
Public-key encryption takes a lot of computing, so most systems use a combination of public-key and symmetry. When two computers initiate a secure session, one computer creates a symmetric key and sends it to the other computer using public-key encryption. The two computers can then communicate using symmetric-key encryption. Once the session is finished, each computer discards the symmetric key used for that session. Any additional sessions require that a new symmetric key be created, and the process is repeated.
The key in public-key encryption is based on a hash value. This is a value that is computed from a base input number using a hashing algorithm. Essentially, the hash value is a summary of the original value. The important thing about a hash value is that it is nearly impossible to derive the original input number without knowing the data used to create the hash value.
A 128-bit number has a possible 2128 or 3,402,823,669,209,384,634,633,746,074,300,000,000,000,000,000,000,000,0
http://computer.howstuffworks.com/encryption.htm
http://www.entrust.com/resourcecenter/pdf/cryptointro.pdf