column_encrypt
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
column_encrypt | 4.0 | SEC | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 7030 | column_encrypt | No | Yes | Yes | Yes | No | No | encrypt |
fixed encrypt schema; create schema encrypt before CREATE EXTENSION; preload column_encrypt;
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 4.0 | 1817161514 | column_encrypt | pgcrypto |
| RPM | PIGSTY | 4.0 | 1817161514 | column_encrypt_$v | - |
| DEB | PIGSTY | 4.0 | 1817161514 | postgresql-$v-column-encrypt | - |
Build
You can build the RPM / DEB packages for column_encrypt using pig build:
Install
You can install column_encrypt directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
Sources: README, v4.0 release, SQL objects
column_encrypt provides transparent column-level encryption for PostgreSQL. It defines encrypted_text and encrypted_bytea types, encrypts values through type input functions, decrypts through output functions, and manages data-encryption keys through the encrypt schema.
Enable
Load the shared library at server start, restart PostgreSQL, then create the schema and extension:
Add encrypt to search_path or schema-qualify the encrypted types and functions.
Register And Load Keys
The extension uses a two-tier key model with key-encryption keys and data-encryption keys. Ciphertext carries a key-version header so older values can still be decrypted after rotation.
Encrypt Columns
Without a loaded key, decrypting encrypted values raises an error.
Key Operations
Common functions include encrypt.activate_key, encrypt.revoke_key, encrypt.rotate, encrypt.verify, encrypt.unload_key, encrypt.loaded_cipher_key_versions, and encrypt.blind_index.
Use blind indexes for lookup patterns that cannot expose plaintext values directly:
Notes
The extension intentionally rejects binary send/receive for encrypted values. Equality and hash semantics are based on decrypted plaintext; range ordering is not supported. After upgrading from older ciphertext-hash behavior, rebuild hash indexes on encrypted columns.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)