Hi,

I didn't go over the entire thing, but anyways, to the best of my
understanding, Source is something with a static length (i.e. - it
won't change during execution).
Sink is the destination of some byte manipulation and is therefore
subject to be with a size the same / larger / smaller that the Source.

I took me a while to figure the same issue you're dealing with, and
the solution is rather simple: you can use std::string as a byte
array, and as both an ArraySource and an ArraySink.
In fact, here's the declaration of ArraySource from filters.h:
    typedef StringSource ArraySource;

The perk of using std::string as an array sink is that it can grow
dynamically.

To summarize:

        std::string plainText = "bla-bla-bla";
        std::string encryptedText;

        ArraySource( (byte*)plainText.data(), plainText.size(),
                        true, new SomeEncryptionFilter(
                                        new StringSink( encryptedText )
                                )
                        );

Now you can get the encrypted bytes like this:
encryptedText.data() and length by encryptedText.size().

Once you grasp this idea, go on and check Dillon Beresford's thread on
a similar subject.
http://groups.google.com/group/cryptopp-users/browse_thread/thread/cf0217017a8e7069

I believe it even addresses your specific case.

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