Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 1.18 KB

File metadata and controls

30 lines (22 loc) · 1.18 KB
id encryption
title Encryption and Key Rotation

Encryption and Key Rotation

Envelope encryption

  1. ENCRYPTION_MASTER_KEY comes exclusively from the environment and is never stored.
  2. Every user gets a Data Encryption Key (DEK), encrypted with the master key (server/encryption/user_keys.js).
  3. Every file gets its own File Encryption Key (FEK), encrypted with the owner's DEK (file_key_wrapped on documents).
  4. All encryption uses AES-256-GCM (server/encryption/encryption_service.js, server/encryption/stream_crypto.js for streaming with large files).

The server refuses to start if encryption is enabled but no valid master key is configured (assertMasterKeyAvailableAtStartup).

Rotation

neoarchive encryption rotate re-wraps every user's DEK under the current ENCRYPTION_KEY_VERSION - without re-encrypting files themselves. Older key versions remain available for decrypting existing files as long as ENCRYPTION_MASTER_KEY_V<n> is set.

Streaming

Uploads and downloads are encrypted/decrypted chunk by chunk (stream_crypto.js) - large files are never fully loaded into memory, and no permanent unencrypted intermediate files are created.