I am trying to encrypt big files using NaCL (actually PyNaCL) - see http://nacl.cr.yp.to/box.html
After reading some docs, I came up with this prototype :
Bob wants to send a big file to Sarah. They both have a public/private key pair.
- set "position" to 0
- for each 256ko file chunk
- generate a random nonce
- append to the chunk 10 bytes containing position zfilled with zeroes
- encrypt the chunk using crypto_box (using Bob private key and Sarah public key)
- increment position
When Sarah gets the encrypted chunks:
- set "position" to 0
- for each encrypted chunk
- decrypt the chunk using crypto_box (using Bob pub key and Sarah priv key)
- extract the position and assert it's equal to "position"
- increment position
prototype code here : https://github.com/tarekziade/fxakeys/blob/master/fxakeys/crypto.py#L119
What do you think ?