Encryption
Encryption
Section titled “Encryption”GatewAI supports transparent AES-256-GCM encryption of job files in S3. When enabled, the gateway encrypts the input file before upload and the relay decrypts it after download — the inference backend always receives plaintext.
How it works
Section titled “How it works”Client │ POST /jobs/{service_type} (plaintext file) ▼Gateway ├── Encrypt file (AES-256-GCM streaming) └── Upload ciphertext → S3
Relay ├── Download ciphertext from S3 ├── Decrypt (AES-256-GCM streaming) └── POST plaintext → inference backendThe result file written back to S3 by the relay is not encrypted — only the input is.
Algorithm
Section titled “Algorithm”AES-256-GCM, streaming over 64 KB plaintext chunks. Each chunk is independently authenticated and sealed so the relay can decrypt without buffering the entire file in memory.
Wire format:
[8-byte random nonce prefix][chunk 0: ciphertext (64 KB + 16-byte GCM tag)][chunk 1: ciphertext]...[chunk N: ciphertext (≤ 64 KB + 16-byte GCM tag)]The 12-byte GCM nonce for chunk i is:
nonce_prefix (8 bytes) || big_endian_uint32(i) (4 bytes)An empty plaintext produces one empty chunk (16-byte GCM tag only).
Configuration
Section titled “Configuration”Generate a key
Section titled “Generate a key”openssl rand -hex 32This produces a 64-character hex string representing 32 random bytes.
Gateway config
Section titled “Gateway config”encryption: key: "${ENCRYPTION_KEY}"The key is read from the ENCRYPTION_KEY environment variable. Leave empty to disable encryption.
Relay config
Section titled “Relay config”encryption: key: "${ENCRYPTION_KEY}"The same key must be set in every relay sidecar. A mismatch causes decryption failures and failed jobs.
Two options for providing the key:
# Option A — let the chart create a Secret from a literal valueencryption: key: "your-64-char-hex-key"
# Option B — reference an existing Secret (e.g. from External Secrets Operator)encryption: existingSecret: "my-encryption-secret" # must contain key ENCRYPTION_KEYLeave both empty to disable encryption.
Disabling encryption
Section titled “Disabling encryption”Set encryption.key to an empty string (or omit the field) in both gateway and relay configs. Existing encrypted objects in S3 cannot be read once the key is removed — drain or purge the queue before disabling.