On Fri, Apr 12, 2019 at 10:28 AM <zhupf...@gmail.com> wrote:
>
> Hi there! I'm looking into using Crypto++ for an open source project I 
> contribute to. We need to implement a function which encrypts/decrypts some 
> data using the AES-CTR or AES-CBC method (the CTR/IV is provided), and then 
> return the encrypted data and **the new CTR/IV to be used if the crypto 
> operation is to continue, as if done as a whole block**. For example if the 
> input CTR is 0 and I encrypted a 32-byte data, I would need to return the new 
> CTR 2.
>
> Actually, calculating the CTR myself is easy, but I don't think there would 
> be an easy way to calculate the IV for AES-CBC. So I wonder if Crypto++ 
> provides a way to fetch the new CTR/IV after crypto operations? I can see 
> some "GetNextIV()" function in the document but I don't think that would 
> satisfy my need as it seems to use a RNG.
>

For CBC mode the next IV is the previous ciphertext block. I think the
tricky part may be operating a stream. That is, you don't use blocks
of 16 for AES. In this case, you have a partial block that gets
padded, and that mucks up the continuous blocks of text, and
complicates continuing a cipher.

If you post some code we may be able to offer more suggestions.

Jeff

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to