Re: Streaming - [Re: CryptoOperation and its life cycle]

On Fri, Dec 14, 2012 at 3:30 AM, Aymeric Vitte <vitteaymeric@gmail.com> wrote:
> OK, but I suppose you will agree that :
>
>
> var h1 = window.crypto.digest("SHA1");
> var h2 = window.crypto.digest("SHA1");
> h1.process(stream1);
> h2.process(stream1);
> h2.process(stream2);
> h1.finish();
> h2.finish();
>
> Can not be a streaming solution.
>
> See previous email for hash, but the same can apply for ciphering (see
> https://gitweb.torproject.org/tor.git/blob/HEAD:/src/common/aes.c lines
> 114-123 or
> https://github.com/Ayms/node-Tor/blob/master/lib/node-tor.js#l629-650 ), how
> can we get the intermediate results ?

I already explained to you how intermediate results are made available
from methods that do support intermediate results - such as
encryption.

Digesting does not support intermediate results. You MUST clone the
digest state, because there is a destructive finalization step.
Cloning is ISSUE-22.

>
> Maybe a solution could be to reuse the crypto operation after finish (and
> then add something like a destroy method to CryptoOperation)

This is not possible.

Received on Friday, 14 December 2012 18:54:41 UTC