> Hi Mouse I tested your code in VS2005. I have got a couple
> of questions and appreciate that you can help me on any of
> them.
Sure.
> Take the encryption code for example. You allocate memory
> for 'encryptor' but I never see you delete them in your code.
In the example I gave I did not bother deleting the encryptor object,
letting the memory be reclaimed after the program completes.
> I ran the code in a debug mode and found out after the FileSource
> is called the memory of 'encryptor' object is freed magically.
That I cannot explain as I don't know.
> Is this a smart pointer design in CryptoPP?
Wei Dai would be the best one to answer this question. I don't know if
Crypto++ does or does not use Smart Pointers.
> Does CryptoPP AES implementation support 32-byte block size?
> Seems not.
Since 32-byte-block AES does not exist, the answer is obvious. Rijndael
design did support 32-byte blocks, but standardized AES does not.
> As you know, we need to consider the padding when using CBC
> mode so that we can process data in multiple of block size.
Which is why it usually makes sense to wrap the encryptor in the
StreamTransformationFilter().
std::string ciphertext;
StreamTransformationFilter cfbEncryptor(cfbEncryption, new
StringSink(ciphertext));
cfbEncryptor.Put(plaintext, 100);
// input more plaintext here if needed
cfbEncryptor.MessageEnd(); "
> Your decryption code throws an exception saying the data
> is not a multiple of block size. Is this because padding
> should be added in the encryption code and how?
Sorry, but *my* decryptor did not throw any exceptions - I've tested it
before posting. I don't know the code that *you* wrapped around the
decryptor, so cannot comment.
> I can't get help from the sample code because it uses MessageEnd()
> at the end of the encryption.
Oh so you removed the MessageEnd() at the end of the encryption, so there's
nothing to tell the encryptor "Now there's no more input - therefore pad
whatever data is sitting in the buffer, encrypt it and push it out". And now
you're surprised that your code does not work?
> I can't use encryptor->MessageEnd() in your code because the
> encryptor object is destroyed after the FileSource(...).
That object should NOT just get destroyed all by itself. Something in your
code must be doing something wrong with it. Again, take a look at the
example I posted earlier - it has been tested and works properly.
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---