Specifically, can you decrypt any stream up to an arbitrary byte?


Data in TLS is sent in TLS records, which can carry between 0 to 16KB of payload.

If you stop processing the received data at a TLS record boundary, there is no security problem I can see. The processed data was securely transmitted.

If you wish to stop processing data in the middle of a TLS record, you have a problem. You must verify the MAC for the whole record (and in CBC cipher suites also the padding), so you have to process the entire record. But if you don't verify the MAC, yes, you can decrypt a partial TLS record. Of course, because encryption is malleable, this is extremely insecure. The data in that record could have been easily changed by an attacker.

| improve this answer | |

It depends on the cipher used, not the protocol. TLS might provide the context that tells you how to share keys, encrypt, decrypt or verify, but the encryption and decryption is done according to an algorithm defined by the cipher.

Block ciphers, like AES, encrypt and decrypt data in blocks, whereas stream ciphers generate a "keystream", a pseudorandom output stream which is combined with the plaintext. Only stream ciphers support bit-by-bit encryption and decryption. Block ciphers must encrypt and decrypt block-by-block, and small block sizes are rarely used, because they have a small codebook size.

There are 12 symmetric ciphers defined for use in TLS 1.2 (13 if you count NULL) but only 2 are stream ciphers: RC4 and ChaCha20, so the answer is yes, but only if the server and the client agree to use one of those two ciphers.

| improve this answer | |
  • All AEAD ciphers can be decrypted up to a bit, this means GCM too (it's CTR with GHASH for MAC). But nothing that uses a block cipher produces the keystream bit by bit, so whether it's cbc or ctr, you need to perform the block cipher operation to cover a whole block, potentially decrypting 127 bits you don't care about. 8 byte blocks should not be used, same as RC4. – Z.T. Oct 31 '16 at 18:26

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