Repository navigation
Middleware encryption
Andrew Gaul edited this page Nov 22, 2026
·
1 revision
S3Proxy can encrypt object data before it reaches the storage backend, so that the backend holds only ciphertext and the key never leaves S3Proxy. Clients read and write plaintext and need no changes. Enable it with a password and a salt:
s3proxy.encrypted-blobstore=true
s3proxy.encrypted-blobstore-password=correct horse battery
s3proxy.encrypted-blobstore-salt=staple
The Docker image reads the same settings from S3PROXY_ENCRYPTED_BLOBSTORE, S3PROXY_ENCRYPTED_BLOBSTORE_PASSWORD and S3PROXY_ENCRYPTED_BLOBSTORE_SALT; the last two can also come from a mounted file named by the same variable with _FILE appended.
- Each object is encrypted with AES-128 in CFB mode under a random IV. The key is derived from the password and salt with PBKDF2-HMAC-SHA256 at 65,536 iterations.
- On the backend an encrypted object is stored under its key with
.s3encappended, and each object or multipart part carries 64 bytes of trailing padding that records its IV and plaintext size. Clients see the original key and the plaintext size in GET, HEAD and listings. - Ranged GETs, CopyObject and multipart uploads work, including ranges that cross a part boundary.
- An object stored without the
.s3encsuffix, such as one written before the middleware was enabled, is served as it is. New writes are always encrypted.
- No integrity protection. CFB mode is not authenticated: tampered ciphertext, or a wrong password or salt, is not detected. A read then answers 200 with garbage of the right length.
- The ETag is not the MD5 of the plaintext. It describes the stored ciphertext, so a client that verifies an upload against the ETag may report a mismatch. See #517.
- Only object data is encrypted. Keys, user metadata and the content headers reach the backend in the clear.
- One key for everything. Every object uses the key derived from the configured password and salt, and there is no rotation: changing either makes the existing objects unreadable.
- No versioning. The middleware reports object versioning as unsupported.
- Objects written through this middleware cannot be read by other tools without reimplementing the format.
This is distinct from S3 server-side encryption (SSE-S3, SSE-KMS and SSE-C), in which the storage service does the encrypting. The README's limitations section says which backends support that.