|Web Server Management: Securing Access to Web Servers|
|Prev||Chapter 2. A crash course in cryptography||Next|
Because public key cryptography is so much slower than symmetric key cryptography, it is best to save it for situations where its facilities are really needed and to fall back to symmetric cryptography wherever possible, in particular for doing encryption of data in bulk. To do this, communicating parties need to securely establish a shared symmetric encryption key. One way to do this is to use public key cryptography: I can generate a temporary key, encrypt it with your public key and send it to you. As the holder of the corresponding private key, you (and only you) can decrypt the message and then we can both use the temporary key to communicate.
An alternative to this, and something additionally supported by TLS, is the "Diffie-Helman algorithm" which, unlikely though it seems, allows two communicating parties to establish a shared secret even if their communication is being monitored.