CipherStash Proxy includes an encrypt
tool – a CLI application to encrypt existing data, or to apply index changes after changes to the encryption configuration of a protected database.
- Using the
encrypt
tool - How the
encrypt
tool works - Configuring the
encrypt
tool - Example
encrypt
tool usage
Encrypt the source
column data in table
into the specified encrypted target
column.
The encrypt
tool connects to CipherStash Proxy using the cipherstash.toml
configuration or ENV
variables.
cipherstash-proxy encrypt [OPTIONS] --table <TABLE> --columns <SOURCE_COLUMN=TARGET_COLUMN>...
At a high-level, the process for encrypting a column in the database is:
- Add a new encrypted destination column with the appropriate encryption configuration.
- Using CipherStash Proxy to process:
- Select from the original plaintext column.
- Update the encrpted column to set the plaintext value.
- Drop the original plaintext column.
- Rename the encrypted column to the original plaintext column name.
The CipherStash Proxy encrypt
tool automates the data process to encrypt one or more columns in a table.
Updates are executed in batches of 100 records (and the batch_size
is configurable).
The process is idempotent and can be run repeatedly.
The CipherStash Proxy encrypt
tool reuses the CipherStash Proxy configuration for the Proxy connection details.
This configuration includes database server host, port, username, password, and database name.
The following table lists the available options.
Option | Description | Default |
---|---|---|
-t , --table |
Specifies the table to migrate | None (Required) |
-c , --columns |
List of columns to migrate (space-delimited key=value pairs) | None (Required) |
-k , --primary-key |
List of primary key columns (space-delimited) | id |
-b , --batch-size |
Number of records to process at once | 100 |
-d , --dry-run |
Runs without updating. Loads data but does not perform updates | None (Optional) |
-v , --verbose |
Turn on additional logging output | None (Optional) |
-h , --help |
Displays this help message | - |
Given a running instance of CipherStash Proxy and a users
table with:
id
– a primary key columnemail
– a source plaintext columnencrypted_email
– a destination column configured to be encrypted text.
Encrypt email
into encrypted_email
:
cipherstash-proxy encrypt --table users --columns email=encrypted_email
Specify the primary key column:
cipherstash-proxy encrypt --table users --columns email=encrypted_email --primary-key user_id
Specify multiple primary key columns (compound primary key):
cipherstash-proxy encrypt --table users --columns email=encrypted_email --primary-key user_id tenant_id