On Dec 8, 5:06 pm, Travis Jensen <[email protected]> wrote: > Hopefully someone can help me with some understanding. I'm going > through the samples in RFC-3602 (http://www.faqs.org/rfcs/ > rfc3602.html) (the AES/CBC RFC). I hit the first example, which looks > like this: > > Case #1: Encrypting 16 bytes (1 block) using AES-CBC with 128-bit key > Key : 0x06a9214036b8a15b512e03d534120006 > IV : 0x3dafba429d9eb430b422da802c9fac41 > Plaintext : "Single block msg" > Ciphertext: 0xe353779c1079aeb82708942dbe77181a > > CryptoPP's ciphertext looks like this: > > 0xe353779c1079aeb82708942dbe77181a b97c825e1c785146542d396941bce55d > > The cipher is correct, but it is giving me two blocks instead of a > single block. PKCS #5 padding is used by default: 16-(||M|| mod 16). If a message is a multiple of 16 bytes, you get an extra block of all padding bytes.
> For my project, I want to make sure I'm not screwing things up by > setting CryptoPP up incorrectly, so I want to make sure I get back > what I expect to. Use CCM, GCM, or EAX mode. you get encryption and the authenticity (of the cipher text) is free. See http://www.cryptopp.com/wiki/Ccm, http://www.cryptopp.com/wiki/Gcm, and http://www.cryptopp.com/wiki/Eax. > Is there some other way I should be setting up > things like padding to get the expected results? The results are expected if the message size is a multiple of the block cipher's size. You always get another block if 0 == ||M|| % BLOCK_SIZE. Count the number of bytes (not including the NULL) in Plaintext. 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.
