Hi Patrick, In practice, I find that including the trailing '\0' works well. This means a string will always be at least one charcter [not bytes] long.
When I resurrect the string after decryption, it already has the trailing NULL, which is very tidy. Jeff On 9/4/08, Patrick <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm playing around with ECC using v 5.4.0.0 of the library. > > One of my test cases involves encrypting and decrypting a zero length > string; encryption produces a non-zero length cipher text. When > decrypting I call > CryptoPP::ECIES<CryptoPP::ECP>::Decryptor::MaxPlaintextLength() which > unsurprisingly returns 0. Unfortunately, I believe, 0 is also returned > when the cipher text is invalid and as such I'm returning an error > saying the cipher text has become corrupted and can't be decrypted. > > The only solution I can think of is to forbid encryption of 0 length > cipher texts but I'd rather not (purely because I don't want to add > limitations to the application, a zero length string is a valid > string...). Are there any other ways to detect the difference between > an invalid cipher text and one that decrypts to a 0 length plain text? > > Thanks, > Patrick --~--~---------~--~----~------------~-------~--~----~ 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. -~----------~----~----~----~------~----~------~--~---
