Skip to content

Private files with your own key

A customer-controlled storage key protects a specific set of stored objects. Agree on that scope with your service operator before enabling BYOK. This guide describes the available configuration and the checks to perform on your installation; it does not confirm that your service has been configured or accepted. See deployment options first.

The private-file configuration uses AWS S3 server-side encryption with a specified AWS KMS key. A key can belong to the installation or to an individual organization. The server can receive decrypted files when its permissions allow access. This is storage encryption, not end-to-end encryption of messages or files.

Data Scope of this configuration
Private attachments and derived thumbnails Organization-scoped private objects
Organization exports Separate private export storage
Public avatars, logos and emoji Outside this private-file configuration
Message database, search indexes and local files Need separate protection
Call recordings and complete server backups Need their own storage and recovery arrangements

A domain or application brand does not select a storage key. An organization’s trusted server identity determines its key scope. A custom S3-compatible endpoint is not accepted in this AWS KMS configuration; do not assume that an on-premises object store has equivalent support. See backups with your own key for the separate archive mechanism.

Record who owns the key, who may authorize server access, and who can restore that access if the primary administrator is unavailable. Confirm the organization, storage location, permitted operations and recovery contact.

The operator configures a specific key identifier and server permissions. Do not send private key material, cloud passwords or access tokens in chat, support tickets or a branding profile. An identifier alone does not prove that permissions, storage isolation or recovery work.

For SaaS, a reseller or a telecom service, agree on the scope separately for each customer. For a hybrid deployment, identify which component stores files and which server is allowed to decrypt them. In a private installation, also assign responsibility for updates, permissions and independent backups.

Ask the operator to demonstrate these checks on the intended installation:

  1. Upload and download a new private attachment, including its thumbnail.
  2. Create and retrieve an organization export from private storage.
  3. Confirm the actual key identifier used for each object.
  4. Confirm that a different organization cannot select or retrieve your objects.
  5. Test loss of key access and recovery using an agreed test object.
  6. Record the result, responsible people and limitations before accepting service.

Do not use production-wide key revocation as an unplanned test. Agree on the test scope and recovery procedure first. Successful upload alone does not establish isolation, restoration of the message database or recovery of the entire service.

The operator can explicitly run a small storage test on the intended installation:

Terminal window
./manage.py probe_storage_roundtrip --profile /path/to/deployment-profile.json --realm ORGANIZATION_UUID

The command first checks the profile and KMS metadata. It then creates one object containing 32 random bytes under the selected organization’s private-file prefix. It verifies the returned KMS key, reads the exact object version, compares the bytes, deletes that same version and checks that it is gone. No messages or existing attachments are used. This test requires an already versioned bucket and permission to read its versioning state and write, read and delete the probe version; it does not change bucket settings or key policy.

A successful result reports STORAGE_S3_ROUNDTRIP=VERIFIED and STORAGE_PROBE_CLEANUP=VERIFIED. These cover one new test object only. They do not confirm access to old keys, organization isolation, export recovery or whole-service restoration. If the write response is lost or cleanup fails, the command reports a generated object locator for operator review and does not delete an unpinned object. Keep the metadata-only check_storage_keys check for read-only diagnostics.

Deleting a specific S3 version requires its version ID; an ordinary delete in a versioned bucket creates a delete marker. See the AWS DeleteObject reference.

Changing the key selected for new uploads does not re-encrypt old objects. Keep access to the previous key while existing attachments and exports depend on it. Agree on the migration and test old and new objects after a change.

The operator runs the inventory on the data server with the reviewed deployment profile and the AWS account that owns each private bucket.

Terminal window
./manage.py audit_storage_key_usage --profile /path/to/deployment-profile.json \
--retained-key "$PREVIOUS_STORAGE_KEY_ARN" \
--uploads-owner "$UPLOADS_AWS_ACCOUNT_ID" \
--exports-owner "$EXPORTS_AWS_ACCOUNT_ID"

Both private buckets need enabled versioning. The inventory reads S3 metadata for each exact version, including noncurrent versions behind delete markers and objects created before versioning. It reports aggregate counts for attachments and exports. Repeat --retained-key to audit multiple keys. Entries in the retained arrays and configured_for_new_objects follow the order of the distinct keys on the command line.

COMPLETE_METADATA_SCAN means that the command read both configured buckets within the limits. The defaults are 10,000 entries including delete markers and 300 seconds. --max-entries and --max-seconds adjust those limits. A missing version, ambiguous encryption metadata or an incomplete scan produces an error.

Run the inventory during a maintenance window with storage writers and lifecycle changes paused. Before retiring a key, check any earlier buckets, replicas, pending multipart uploads and backups separately. Confirm that the key is out of the active write policy and perform the agreed recovery test.

S3 version listing and version metadata.

Agree on a maintenance window with the operator. Keep the previous key available, verify reads and new writes with the intended keys, and pause storage writes, versioning changes, replication, lifecycle actions, and other key changes. The operator prepares a private list of exact attachment and export versions that belong to one organization.

Terminal window
./manage.py rotate_storage_key_versions --profile /path/to/deployment-profile.json \
--manifest /path/to/reviewed-versions.json

The command reads the selected versions and produces an approval digest. After review, run it with the same manifest and --apply-sha256 "$APPROVAL_SHA256". The command checks the digest before writing, then reads every selected version to verify its contents under the new key. After an interruption, use the same manifest and digest to resume. Versions already on the new key go through verification again.

This procedure uses the AWS S3 operation for changing the key on existing versions. Confirm bucket, key, and account support before scheduling the work. Afterward, repeat the inventory and verify replicas and backup recovery before withdrawing the previous key. AWS S3 encryption updates.

An explicit organization-key revocation in the application blocks new writes, new signed links and server reads for that organization without falling back to the installation key. Removing the organization-specific entry is different: it may allow the installation key again. Ask the operator to record the intended policy rather than treating these actions as interchangeable.

Application-level revocation does not itself disable the KMS key or cancel all links already issued. Previously downloaded files are not erased. If immediate access restriction is required, coordinate storage permissions, link lifetime and service access with the operator, then verify the result.

Before ending service, obtain the agreed export and confirm that an authorized recipient can read it independently. Record which keys are needed for retained objects and backups, who stores them, and when permissions may be removed. Revoke access only after the agreed handover and recovery checks. See the partner service guide for responsibilities at service exit.