Hi kazuhiko,
Unfortunately I cannot duplicate your issue - but I did not use your
code (I already have a test Crypto++ project ready for testing). I
also did not try streams. I 've had too many problems in the past. I
don't want to dig up work arounds for test code.
> Can 16 bytes or more of file be decrypted by XEX3_CTR in your PC?
The following works fine on large byte sizes which I plugged in.
Jeff
#include "des.h"
using CryptoPP::DES_XEX3;
#include "modes.h"
using CryptoPP::CTR_Mode;
#include "osrng.h"
using CryptoPP::AutoSeededRandomPool;
#include "filters.h"
using CryptoPP::StreamTransformationFilter;
using CryptoPP::RandomNumberSource;
using CryptoPP::StringSource;
using CryptoPP::StringSink;
#include <string>
using std::string;
int main(int argc, char* argv[])
{
byte key [ DES_XEX3::KEYLENGTH ];
byte iv [ DES_XEX3::BLOCKSIZE ];
memset( key, 0xFF, sizeof(key) );
memset( iv, 0x00, sizeof(iv) );
string plain, cipher, recovered;
AutoSeededRandomPool prng;
RandomNumberSource( prng, 4096 * 4, true,
new StringSink( plain )
);
CTR_Mode<DES_XEX3>::Encryption e;
e.SetKeyWithIV( key, sizeof(key), iv);
StringSource( plain, true,
new StreamTransformationFilter(
e, new StringSink( cipher )
) // StreamTransformationFilter
); // StringSource
/* ======================================== *\
\* ======================================== */
CTR_Mode<DES_XEX3>::Decryption d;
d.SetKeyWithIV( key, sizeof(key), iv);
StringSource( cipher, true,
new StreamTransformationFilter(
d, new StringSink( recovered )
) // StreamTransformationFilter
); // StringSource
if( plain != recovered )
{
// Oops
throw -1;
}
return 0;
}
On Jun 9, 12:26 pm, kazuhiko <[EMAIL PROTECTED]> wrote:
> Hi, Jeff.
>
> Thank you for the detailed explanation.
>
> I also think that the affinity of Stream and XEX3_CTR is bad.
> Other code modes of all the work well (rijndael, twofish, ECB..) and
> only XEX3_CTR does not work.
> (ProcessData method is never called. )
> The method using FileSource is easy, and since it can respond also to
> a huge file, I want to do so.
> Can 16 bytes or more of file be decrypted by XEX3_CTR in your PC?
>
> kazuhiko
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---