Expand description
Attachment AES-256-GCM over a file, a chunk at a time: the cipher of
super::decrypt_data (16-byte nonce, 16-byte tag appended) without the file
ever sitting whole in memory.
GCM is CTR encryption plus a GHASH over the ciphertext, and both run incrementally. The catch is that the tag only speaks at the end, so plaintext is written to a file the caller keeps out of sight until this returns Ok.
Structs§
- Streamed
File - What one pass over a downloaded file learned.
Constants§
- CANCELLED
- What a pass stopped by its caller returns.
Functions§
- decrypt_
file - Decrypt
src(ciphertext || tag) intodst, hashing both sides on the way.dstholds unauthenticated plaintext until this returns: on any error it is removed, and a tag mismatch is reported as a decryption failure. - decrypt_
file_ with_ progress decrypt_file, tellingprogresseach new whole percentage of the file opened.progressanswering false stops the pass, as forencrypt_file_with_progress.- encrypt_
file - Encrypt
srcintodst(ciphertext || tag), the counterpart ofdecrypt_file. Returns the SHA-256 and length of what was written: the blob a server will hold. - encrypt_
file_ with_ progress encrypt_file, tellingprogresseach new whole percentage of the file sealed.progressanswering false stops the pass: nothing is written and the error says it was cancelled.- hash_
file - SHA-256 of a file, read a chunk at a time.
- place_
download - Put a verified download into the download directory under
name: an identical file already there (same name, size and hash) is reused andsrcdropped; otherwisesrcmoves to a free spelling of the name. Returns where it landed.