Manipulating blocks
Every block carries authentication and chain state — inserting, deleting, swapping or truncating fails. The attacker can destroy files but not alter them unnoticed.
Large files can be encrypted, played and exported in chunks.
Large files are not pushed through memory in one piece: XChaCha20-Poly1305 secretstream encrypts in individually authenticated 1-MiB blocks — up to 64 GiB per file, without a RAM limit.
You do not encrypt a 30-GB video file by loading it completely into memory — an iPhone has only a few gigabytes. Apps that “just apply AES” fail exactly here: either they load everything at once and crash, or they cut the file and lose the integrity of the whole.
CryptArx uses libsodium secretstream: the algorithm splits the file into 1-MiB blocks and authenticates each one — cryptographically chained so that blocks can neither be swapped, removed nor appended without decryption failing.
The result: memory usage stays constantly small, no matter how large the file is. Export, backup and playback run block-wise — a video jumps to the target without decrypting the complete file.
“The file is AES encrypted” says nothing about how it is treated in memory. Secretstream is an algorithm for exactly this problem: unlimited length, constant memory, every block individually authenticated.
On import, CryptArx creates a secretstream context from the file key: header and initial state define the beginning of the chain.
The file runs through XChaCha20-Poly1305 in 1-MiB steps — every block gets its own authentication tag and a chained state.
The last block carries an end marker: the chain is complete or invalid — a truncated end is not a valid end.
Playback, .vaultbackup export and restore run block-wise: data is read, processed and passed on — never all held at once.
Every block authenticates against the chain state: whoever deletes, swaps or replaces block 7 with a foreign one breaks the chain — decryption reports manipulation instead of silently delivering other data. Integrity is in the format, not in a separate checksum.
Memory holds only the current block plus stream state — megabytes instead of gigabytes. That is exactly what makes 64 GiB possible on a phone: the limit is free storage, not RAM.
The implementation is libsodium 0.9.1, firmly pinned — no fluctuating dependency tree. XChaCha20 extends the nonce to 192 bits: random nonces are therefore safe even with billions of blocks.
Every block carries authentication and chain state — inserting, deleting, swapping or truncating fails. The attacker can destroy files but not alter them unnoticed.
There is no size at which protection gives up: memory stays constant, authentication applies per block. Whether 50 MB or 50 GB — the math is the same.
Streaming playback decrypts block-wise in the process — no complete plaintext file is created on disk that a second process could read along.
64 GiB is the format limit — what works in everyday life is determined by free storage and the device. And as everywhere: during playback, decrypted blocks exist in the app process.