I guess at this point I should chime in.

On 10/22/14, 12:41 PM, Paweł Górny wrote:
> In this case, how to encrypt the binary file to be "compatible with the
> rest of world's software"?


I have been working on adding streaming support for openpgp.js encrypted
messages containing files. [1] [2]

I mimics the node.js stream API [3] so it's largely compatible with "the
rest of the world's software".

To get an idea of how it works you should look at the unittests [4] [5].
Basically you write to a MessageStream instance chunks of your file and
it will emit "data" events with chunks of encrypted data including all
the headers for the various data structures inside a OpenPGP Message [6].

If you prefer to just encrypt using AES in cfb mode you can also use the
streamed CipherFeedback [7], that works similarly [5].

I need to fix up some things that ~tanx pointed out in the pull request
comments [2], though the API will not change so you can start trying it
out and you will not have to change the code once I make these changes.

In the end this is something that I am doing to integrate
jquery-file-uploader and openpgp.js. You can see the relevant
jquery-file-uploader patches I wrote in this branch [8].

Let me know what you think.

~ Art.

[1] https://github.com/hellais/openpgpjs/tree/feature/streamedEncryption

[2] https://github.com/openpgpjs/openpgpjs/pull/260

[3] http://nodejs.org/api/stream.html

[4]
https://github.com/hellais/openpgpjs/blob/feature/streamedEncryption/test/stream/message.js#L97

[5]
https://github.com/hellais/openpgpjs/blob/feature/streamedEncryption/test/stream/crypto.js#L26

[6] http://tools.ietf.org/html/rfc4880

[7]
https://github.com/hellais/openpgpjs/blob/feature/streamedEncryption/src/stream/crypto.js

[8]
https://github.com/hellais/jquery-file-upload/tree/feature/upload-handler

_______________________________________________

http://openpgpjs.org
Subscribe/unsubscribe: http://list.openpgpjs.org

Reply via email to