<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 19, 2015, at 11:42 AM, Michael Iverson <<a href="mailto:dr.michael.iverson@gmail.com" class="">dr.michael.iverson@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Jan 19, 2015 at 11:27 AM, Donald Stufft <span dir="ltr" class=""><<a href="mailto:donald@stufft.io" target="_blank" class="">donald@stufft.io</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class=""><br class=""></span><span class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra">I'd also be concerned about the cryptographic implications of this. I'm not sure if this is entirely correct, but it seems if you set your chunk size = AES block size, you essentially are encrypting in ECB mode.  </div></div></div></blockquote><div class=""><br class=""></div></span><div class="">The actual details of what you’d need to do is more involved than just calling encrypt() with the same key on chunks. That’s just a high level “here’s the general idea thing”. In reality you’d encrypt the stream using the streaming encryption APIs (so you’d use something like CBC or CTR) and you’d take that output and break it into chunks as well, and you’d authenticate each of those chunks.</div><div class=""><br class=""></div></div></div>
<br class=""></blockquote></div><br class="">OK, I see what you're saying now. <br class=""><br class="">You would continue to operate the cipher in CBC mode, and process chunks in order. You would then HMAC each chunk, so that each could be validated prior to decryption and writing that chunk to the output. No unvalidated data would ever be passed downstream. At worst, you would have partial data. <br class=""><br class="">To handle missing or out of order chunks, you could maintain an hmac digest of all blocks processed prior to the current block, in addition to the added block. A missing block would cause the HMAC to fail. There would also need to be a method to ensure that we only a certain number of chunks.</div><div class="gmail_extra"><br class=""></div></div></div></blockquote></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Yea something like this. It protects as much as we can with a streaming API.</div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">---</div><div class="">Donald Stufft</div><div class="">PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA</div></div></div>
</div>
<br class=""></body></html>