2
$\begingroup$

During an SSL handshake, the browser sends a list of cipher suites to the server, from which the server selects one option.

For data encryption, two of the several possibilities for the ciphers in this suite are AES (a block cipher) and RC4 (a stream cipher).

I understand that AES would be a better choice for applications where all the data is available at once, permitting the use of large blocks. RC4 on the other hand is more suited for applications where continuous data (that may not be available all at once) is to be encrypted (e.g., real-time data).

My question is: By the time the cipher suites are negotiated (the very first steps of the handshake), the server is not yet aware of what kind of data the browser is going to ask for. For example, by this time, the server does not know whether the browser will be downloading some large file (suited for AES than RC4).

As a result, the server may select a poor cipher for the process. Can anyone give me some idea on how SSL handles this challenge (of choosing the optimal cipher for the task at hand)?

$\endgroup$
1
  • $\begingroup$ Please also note: RC4 is now officially banned from TLS as per RFC 7465. $\endgroup$
    – SEJPM
    Jul 22, 2016 at 13:06

1 Answer 1

2
$\begingroup$

I understand that AES would be a better choice for applications where all the data is available at once, permitting the use of large blocks. RC4 on the other hand is more suited for applications where continuous data (that may not be available all at once) is to be encrypted (e.g., real-time data).

No, this is not accurate. The block size of AES is just 128 bits. It makes no difference with practical data sizes on the web, since at most you add 16 bytes to ciphertext size.

And anyway, many modes of operation, like GCM which is one of the more common choices with modern servers and browsers, turn AES into a stream cipher.

$\endgroup$
4
  • $\begingroup$ In which cases would a stream cipher be preferred over a block cipher and vice versa? Your solution here suggests that anything can do anywhere. $\endgroup$
    – Minaj
    Jul 22, 2016 at 5:47
  • $\begingroup$ @Minaj, yes, anything can do anywhere. The choice between e.g. AES and RC4 comes down to security and speed (RC4 is quite broken), not to whether you want a stream or block cipher. $\endgroup$
    – otus
    Jul 22, 2016 at 5:50
  • $\begingroup$ So you mean RC4 is faster yet less secure, while AES is slower yet more secure? Anyways, which of these is more commonly used? My guess would be AES, --- since security matters more than speed? $\endgroup$
    – Minaj
    Jul 22, 2016 at 6:00
  • $\begingroup$ @Minaj which is faster depends on whether you have AES hardware (new CPUs often do), but RC4 is definitely on its way out. $\endgroup$
    – otus
    Jul 22, 2016 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.