module

VirtualFs::Crypto

AEAD encryption via OpenSSL. Default cipher is aes-256-gcm. Nonces use SHA-256 derivation to prevent reuse.

Constants

AEAD_TAG_LEN = 16
EVP_CTRL_AEAD_GET_TAG = 16
EVP_CTRL_AEAD_SET_TAG = 17
NONCE_LEN = 12

Class methods

derive_nonce(package_id : String, entry_hash : UInt64, chunk_index : UInt32) : Bytes
Source
derive_nonce(package_id : String, entry_path : String, chunk_index : UInt32) : Bytes

Nonce from a path string: hashes the path with SHA-256 (truncated to 64 bits) instead of CRC32 to avoid collision vulnerabilities that would break AEAD security on nonce reuse.

Source
random_nonce

Returns a random nonce for AEAD encryption. Each encrypted chunk stores its own nonce, so the same plaintext never produces identical ciphertext.

Source

Nested types