Hi Jeffery, Thanks for your reply but i want to clarify one more thing. If i have binary data buffer / file length is of i.e. 50 bytes, then do i need to take care of chopping my data in 16 bytes for first three Put() calls with NO_PADDING and last Put() call with padding enabled OR i can simply give 50 byte buffer into Put() call with padding enabled as its(50) not multiple of 16.
Chirag On Feb 2, 9:46 am, Jeffrey Walton <[email protected]> wrote: > On Feb 1, 2:14 pm, Chirag Shah <[email protected]> wrote:> Hi, > > I want to use AES encryption with CBC (Cipher Block Chain) mode with > > Crypto++. My question is i want to use this encryption on binary data > > of unknown length. So, how can Crypto++ behaves in this case of > > variable length. > > You can stream data into a CBC_Mode<AES> object using multiple Put() > calls. After you are done streaming, call MessageEnd(). > > > I have following questions if i use AES CBC mode on binary data > > > 1) Can Crypto++ work on binary data stored in .dat file or any buffer. > > I do not know the input data size. It can be different every time. > > Yes - Use a FileSource (on disk) or ArraySource (in memoery) or > StringSource (std::string) > > > 2) What would be the size of Encrypted data if my binary data length > > is 63 bytes, 64 bytes and 1021 bytes (basically i want to ask if size > > if of multiple of 16 and what if not. > > Standard PKCS padding rules apply. At most, the ciphertext will grow > by 15 bytes. You can change from PKCS to no padding if you'd like. > > > 3) What is the max size Crypto++ can handle for encryption at a time. > > Its platform and cipher dependent. Is you data over 2^32-1? > > > 4) What is the option NO_PADDING is for in AES CBC mode while creating > > a encryption object? > > If you use no padding, your data length will need to be a multiple of > the block cipher's BLOCKSIZE (16 bytes). > > Be sure to authenticate your data to detect tampering. You might want > to abandon CBC in favor of an authenticated encryption mode: EAX, CCM, > or GCM. > > The following might also be helpful:http://www.cryptopp.com/wiki/Cbc_mode. > > Jeff -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com.
