In SSL protocols, both symmetric and asymmetric algorithms are used. Why is it so? The symmetric algorithms are more secure and easier to implement. Why are asymmetric algorithms usually preferred in key exchange?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Say you encrypt a message with a key $k$.
The critical difference is this. Say you want to send me a message:
In summary, symmetric encryption requires the sender and receiver to share a secret key. Achieving that safely, can be a real problem. Asymmetric encryption only requires the sender and receiver to share a public key. Achieving that safely, is much more straightforward.
Finally, as mikeazo said, asymmetric encryption is enormously slow, compared to symmetric encryption.
So, say you want to send me a very long message, using asymmetric encryption. Here's what you'd actually do:
(1) Pick a random key for use with a symmetric (fast) cipher. Encrypt your message using that (fast) cipher and key. Send me that encrypted message.
(2) Then use asymmetric (slow) encryption to encrypt the following message and send it to me:
Now I (the recipient) use my private key to decrypt (2). This gives me the information necessary to decrypt (1) - voila! Only a small amount of information was encrypted using asymmetric (slow) encryption. The bulk of the data was encrypted using symmetric (fast) encryption. And none of this data needed a secure channel. You could publish all of this data on the front page of the New York Times, with no loss of security.
To use a symmetric algorithm for encryption or key-exchange in a way that is secure (i.e. no observer can read the data), both parties (i.e. Alice and Bob) need to have some pre-existing common secret which is not known to any other party (i.e. Eve).
There are such pre-shared key algorithms, and they can be used with SSL. But they are not useful for the general internet SSL usage (i.e. HTTPS), since usually client and server don't have any common secrets.
Asymmetric algorithms like Diffie-Hellman or RSA key exchange allow the creation of such common secrets (and to be secure, only one of the partners - usually the server - needs an authenticated key, which can be done by the usual public-key infrastructure).
Actually there is a symmetric key exchange protocol named "Kerberos". It requires a trusted 3rd party, just like a Public Key Infrastructure (PKI) requires trusted certificate authorities (CA). There are some key differences:
In addition to what Paulo said, symmetric encryption is much faster than asymmetric. Thus, it is typical to use asymmetric to exchange a symmetric key, then use the symmetric key to encrypt all the data. There is no way you could get over 15000 kbits/s (or over 8000 Mbits/s using a GPU) throughput using RSA.
Note that theoretically you could just use RSA to encrypt long messages, but it would be much less efficient for the reasons I stated above.
In summary, each type of encryption has its benefits. Asymmetric makes it quite easy to establish a shared key, but would be far to slow for encrypting large messages. Symmetric is very fast when encrypting large messages (comparatively), but cannot be used to share a secret key (unless you already have a shared secret key).
How would that work? I want to access Amazon securely using a symmetric algorithm. What do I use as the key?
Symmetric algorithms require a shared secret, something the two parties can know that no attacker can know. Without one, you need an asymmetric algorithm.