Hi Avi,

The flat Gzip requires a deflation level. Similar to:

    CryptoPP::Gzip zipper(
        new CryptoPP::FileSink (filename.c_str(), true ),
    CryptoPP::Gzip::MAX_DEFLATE_LEVEL );

    zipper.Put( p, s );
    zipper.MessageEnd( );

Unzipping:

        std::string decompressed;
        CryptoPP::FileSource( filename.c_str(), true,
            new CryptoPP::Gunzip(
                new CryptoPP::StringSink( decompressed )
            ) // Gunzip
        ); // FileSource

When using it in pipelining, you will want the compressor outermost so
that it process data first. Below, data travels from TOP/LEFT to
CENTER/RIGHT.

    CryptoPP::CBC_Mode<CryptoPP::AES>::Encryption
        Encryptor( key, sizeof(key), iv );

    std::string encrypted;

    CryptoPP::StringSource( ..., true,
        new CryptoPP::Gunzip(
            new CryptoPP::StreamTransformationFilter( Encryptor,
                new CryptoPP::StringSink( CipherText ) ),
            ), // STF
        CryptoPP::Gzip::MAX_DEFLATE_LEVEL ), // GZip
    ); // StringSource


Jeff

On 2/8/09, Avi <[email protected]> wrote:
>
> Hi,
>
> Still trying to decipher Crypto++ code..
>
> I want to apply a composition of the following for my plaintext:
> 1. [G]Zip
> 2. Encode
> 3. Authenticate.
>
> From what I understood so far, zipping adds entropy when encoding, so
> I guess I want to be able to perform a full zip of the plaintext
> before moving on to encoding, and I assume the same goes for full
> encoding before authenticating.
>
> Is my assumption correct?
>
> My best understanding is that if I compose like this:
> SomeSource( ... Authnticate( Encode ( GZip( SomeSink() ) ) ) )
>
> Then each byte passes all the filters one after the other before the
> next byte does the same.
> If this is true, then this collides with my above requirement (process
> all bytes before moving on to the next filter).
>
> Can someone please sort this out for me?
>
> Thanks,
>
>    Avi.
>
> (*) I have a couple of more issues, but I'd like to remain focused so
> I'll start them in different threads.

--~--~---------~--~----~------------~-------~--~----~
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