> input + some bytes like 0x00 0xcd 0xcd 0xcd or
> 0x00 0xfd 0xfd 0xfd...
This appears to be is uninitialized memory in a Debug build. I suspect
it is coming form Visual Studio, and not Crypto++.

> string input = { some hex bytes };
Most likely the culprit

Jeff

On 7/3/09, rajkosto <[email protected]> wrote:
>
> Hello, i use crypto++ for encrypting/decrypting with Twofish.
> The problem i have is, that after encrypting data, then decrypting
> that exact data, the padding remains.
> This is how i encrypt and decrypt
>
> string input = { some hex bytes };
>
> CryptoPP::CBC_Mode<CryptoPP::Twofish>::Encryption TFEncryptGTC;
>
> //Set IV
> TFEncryptGTC.Resynchronize(vector);
>
> //encrypt
> string encrypted;
> CryptoPP::StringSource(input, true, new
> CryptoPP::StreamTransformationFilter(TFEncryptGTC, new
> CryptoPP::StringSink(encrypted)));
>
> //After that, i do the reverse with the data i got after encrypting
>
> CryptoPP::CBC_Mode<CryptoPP::Twofish>::Decryption TFDecryptGTC;
>
> //Set IV (same as the one used for encryption ofcourse)
> TFDecryptGTC.Resynchronize(vector);
>
> //decrypt
> string output;
>
> CryptoPP::StringSource(encrypted, true, new
> CryptoPP::StreamTransformationFilter(TFDecryptGTC, new
> CryptoPP::StringSink(output)));
>
> the output i get isnt the same as the input i put in ! instead, it's
> input + some bytes like 0x00 0xcd 0xcd 0xcd or 0x00 0xfd 0xfd 0xfd...
>
> if i run this output through encryption and decryption again, i will
> get another trailing padding ! so it would have 2 times 0x00 0xcd 0xcd
> 0xcd at the end...
>
> why isnt decryption removing the padding that streamtransformation
> added to perform encryption 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.
-~----------~----~----~----~------~----~------~--~---

Reply via email to