[Botan-devel] Network I/O

Barath Raghavan barathraghavan at gmail.com
Sun May 27 23:17:54 EDT 2007


Hi Jack,

Thanks for the suggestion - I'll try it out tomorrow.  Does using a
<msg length, msg> tuple per message seem like a reasonable approach to
delimiting the messages?  (That is, sending the message length in
network byte order followed by that many bytes of data.)

Thanks for writing a cool crypto library.

-Barath

On 5/26/07, Jack Lloyd <lloyd at randombit.net> wrote:
> Hi Barath,
>
> You don't state how you are framing the messages. EAX itself does
> nothing with that, so you need to combine the messages coming out of
> the encrypting pipe in such a way that they can be broken up later.
>
> A few ideas come to mind. You could write an explicit loop, as in:
>
> pipe.start_msg();
> while(!msg_termination_condition)
>    {
>    a_buffer = socket.read();
>    pipe.write(a_buffer);
>    }
> pipe.end_msg();
>
> You could also put this into a new DataSource subclass. This will only
> work if message boundaries are visible in the ciphertext. It would
> detect where the end of data marker is and then set end_of_data to
> return true (so process_msg returns). Then you can write something
> like:
>
> DataSource_Mine in(stream);
> while(!in.eof_on_socket()) {
>    pipe.process_msg(in);
>    in.next_message();
>    SecureVector<byte> this_msg = pipe.read_all(Pipe::LAST_MESSAGE);
> }
>
> [with in.next_message() moving the read pointer forward to the next
> message in the stream]
>
> Hope this helps,
>   Jack
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://www.randombit.net/mailman/listinfo/botan-devel
>



More information about the botan-devel mailing list