Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Due to some platform restrictions our decryption algorithm can only handle up to 1 million bytes. The string we receive is larger, having been generated by AES in cipher block chaining (CBC) mode, with PKCS5 padding.

Is it possible to somehow split the encrypted data and decrypt the parts?

share|improve this question
What mode of operation is being used? AES only encrypts blocks of 128bits. – figlesquidge Dec 6 '13 at 14:03
We use cipher block chaining (CBC) and PKCS5 padding. – h9nry Dec 6 '13 at 14:06
With no authentication? This tends to be a risky scenario to be in, since unauthenticated encryption may be malleable. – figlesquidge Dec 6 '13 at 14:16
No, authenticated encryption is about ensuring two things: privacy (no-one can read our encrypted messages) and non-malleability (no-one can create a fake message). Hopefully this blogpost will explain better than I can here – figlesquidge Dec 6 '13 at 14:24
In the hopes of deriving a clearer explanation that "because you should!", I've started this question - hopefully it'll be of use. – figlesquidge Dec 10 '13 at 16:04
up vote 5 down vote accepted

Absolutely. The key point is that, whilst in CBC mode, the encryption can be thought of as using the previous ciphertext as the IV - have a look at this diagram from wikipedia: CBC decryption

I assume from what you've said that you have a function that will "do" AES-CBC decryption on large amounts of data, and you wish to use this. So, you simply run: $$ D_k^{IV}(c_1\ ||c_2\ ||\dots||c_n\ ) = m_1\ ||m_2\ ||\dots||m_n\ \\ D_k^{c_n}(c_{n+1}||c_{n+2}||\dots||c_{2n}) = m_{n+1}||m_{n+2}||\dots||m_{2n} $$

That is, wherever you 'break' the flow from the CBC output, you simply use the previous ciphertext as the IV to start the next section.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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