Module chunk_encryption

Module chunk_encryption 

Source
Expand description

Chunk-level encryption with per-chunk nonces for CHIE Protocol.

This module provides:

  • Per-chunk encryption with unique nonces
  • Chunk key derivation from master key
  • Streaming chunk encryption/decryption

Structs§

ChunkDecryptor
Chunk decryptor for streaming decryption.
ChunkEncryptor
Chunk encryptor for streaming encryption.
EncryptedChunk
Encrypted chunk with metadata.

Enums§

ChunkEncryptionError
Chunk encryption error.

Constants§

ENCRYPTED_CHUNK_SIZE
Default chunk size for encryption (256 KB).
NONCE_SIZE
Nonce size (12 bytes for ChaCha20-Poly1305).

Functions§

decrypt_chunk
Decrypt a single chunk.
decrypt_content
Decrypt chunks to a writer.
derive_chunk_key
Derive a chunk-specific key from the master key.
derive_chunk_nonce
Derive a deterministic nonce for a chunk.
encrypt_chunk_with_index
Encrypt a single chunk with a specific index.
encrypt_content
Encrypt content from a reader to encrypted chunks.