tce
tce · Transparent column encryption for PostgreSQL using per-role envelope keys and external key-management services.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101188 | tce | tce | 0.10.0 | SEC | PostgreSQL | Rust |
PostgreSQL · 15, 16, 17, 18
Usage
Sources:
tce, The Cryptic Elephant, is an early transparent column-encryption extension. It encrypts values in PostgreSQL memory and storage with per-role envelope keys backed by external key management, but upstream explicitly says not to use this 0.10.0-dev line in production.
Load and Create the Extension
The library must be loaded before the extension is created so that its hooks, GUCs, and security-label provider exist.
For an isolated test only, allow file-based private-key retrieval, initialize a test superuser’s envelope key, and convert a column to tcetext.
The file method is intentionally disabled by default and is documented for testing only. Use a supported KMS design for key-encryption keys, and protect the database server and superuser boundary.
Main Objects and Settings
tcetextandtceintstore encrypted text and integer values;rawexposes ciphertext for inspection.tce.transparent_column_encryptionenables DDL rewriting so newly created regular columns are converted automatically.tce.data_encryption_methodselects the data cipher; the reviewed source implements ChaCha20-Poly1305.tce.encrypted_data_display_modechooseserror,raw, oremptywhen a role cannot decrypt.tce.safe_lockprotects the data-encryption-key envelope from accidental removal.tce.kms.typeand provider-specific settings configure AWS or OpenBao key retrieval.tce.autocastassists binary-protocol drivers, but its GUC definition warns that it is for testing only.
Security and Administration Boundary
The design assumes trusted system administrators and PostgreSQL superusers. Security labels, GUCs, and the tce.envelope table can appear in dumps. Logical dumps and logical replication decrypt values before they leave the publisher; physical backups retain encrypted storage. Restore targets need the extension loaded, the TCE types available, and usable role keys.
Roles without a key receive the configured display behavior. Key changes apply to new sessions, so terminate old sessions when revocation must be immediate. Test drivers explicitly: binary-protocol clients do not work transparently without tce.autocast, while enabling it is itself marked non-production by the current source.