You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/WHY.md
+16-23Lines changed: 16 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,13 @@
1
1
# Postgres data security with CipherStash
2
2
3
-
This article gives a high-level overview of CipherStash's encryption in use solution, including the CipherStash Proxy and the Encrypt Query Language (EQL).
3
+
This page gives a high-level overview of CipherStash's encryption in use solution, including CipherStash Proxy and the Encrypt Query Language (EQL). It's designed for developers and engineers who need to implement robust data security in PostgreSQL without sacrificing performance or usability.
4
4
5
-
It is designed for developers and engineers who need to implement robust data security in PostgreSQL without sacrificing performance or usability.
6
-
7
-
## Table of Contents
5
+
## On this page
8
6
9
7
1.[Encryption in use](#encryption-in-use)
10
8
-[What is encryption in use?](#what-is-encryption-in-use)
11
9
-[Why use encryption in use?](#why-use-encryption-in-use)
12
10
2.[CipherStash Proxy](#cipherstash-proxy)
13
-
-[Proxy overview](#proxy-overview)
14
11
-[How it works](#how-it-works)
15
12
3.[Encrypt Query Language (EQL)](#encrypt-query-language-eql)
16
13
4.[Best practices](#best-practices)
@@ -20,7 +17,8 @@ It is designed for developers and engineers who need to implement robust data se
20
17
21
18
## Encryption in use
22
19
23
-
EQL enables encryption in use, without significant changes to your application code.
20
+
CipherStash's encryption in use solution, comprising CipherStash Proxy and EQL, provides a practical way to enhance data security in Postgres databases.
21
+
EQL enables encryption in use without significant changes to your application code.
24
22
A variety of searchable encryption techniques are available, including:
25
23
26
24
-**Matching** - Equality or partial matches
@@ -44,8 +42,6 @@ Encryption in use mitigates this risk by ensuring that:
44
42
45
43
## CipherStash Proxy
46
44
47
-
### Proxy overview
48
-
49
45
CipherStash Proxy is a transparent proxy that sits between your application and your PostgreSQL database.
50
46
It intercepts SQL queries and handles the encryption and decryption of data on-the-fly.
51
47
This enables encryption in use without significant changes to your application code.
@@ -63,19 +59,19 @@ This enables encryption in use without significant changes to your application c
63
59
Encrypt Query Language (EQL) is a set of PostgreSQL functions and data types provided by CipherStash to work with encrypted data and indexes.
64
60
EQL allows you to perform queries on encrypted data without decrypting it, supporting operations like equality checks, range queries, and unique constraints.
65
61
66
-
To get started, view the [Getting Started](https://github.com/cipherstash/encrypt-query-language/blob/main/GETTINGSTARTED.md) guide.
62
+
To get started, read the [Getting started](https://github.com/cipherstash/encrypt-query-language/blob/main/GETTINGSTARTED.md) guide.
67
63
68
-
## Best Practices
64
+
## Best practices
69
65
70
-
-**Leverage CipherStash Proxy**: Use CipherStash Proxy to handle encryption/decryption transparently.
71
-
-**Utilize EQL functions**: Always use EQL functions when interacting with encrypted data.
72
-
-**Define constraints**: Apply database constraintsto maintain data integrity.
73
-
-**Secure key management**: Ensure encryption keys are securely managed and stored.
74
-
-**Monitor performance**: Keep an eye on query performance and optimize as needed.
66
+
-**Use CipherStash Proxy** to handle encryption/decryption transparently.
67
+
-**Use EQL functions** when interacting with encrypted data.
68
+
-**Define database constraints**to maintain data integrity.
69
+
-**Secure key management** of encryption keys.
70
+
-**Monitor query performance** and optimize as needed.
75
71
76
-
## Advanced Topics
72
+
## Advanced topics
77
73
78
-
### Integrating without CipehrStash Proxy
74
+
### Integrating without CipherStash Proxy
79
75
80
76
> The SDK approach is currently in development, but if you're interested in contributing, please start a discussion [here](https://github.com/cipherstash/encrypt-query-language/discussions).
81
77
@@ -88,11 +84,8 @@ For advanced users who prefer to handle encryption within their application:
88
84
89
85
**Note**: This approach increases complexity and is recommended only if CipherStash Proxy does not meet specific requirements.
90
86
91
-
## Conclusion
92
-
93
-
CipherStash's encryption in use solution, comprising CipherStash Proxy and EQL, provides a practical way to enhance data security in Postgres databases.
94
-
By keeping data encrypted even during processing, you minimize the risk of data breaches and comply with stringent security standards without significant changes to your application logic.
87
+
## Getting started
95
88
96
-
To get started, see the [Getting Started](https://github.com/cipherstash/encrypt-query-language/blob/main/GETTINGSTARTED.md) guide.
89
+
To get started using CipherStash's encryption is use solution, see the [Getting Started](https://github.com/cipherstash/encrypt-query-language/blob/main/GETTINGSTARTED.md) guide.
97
90
98
-
**Contact Support:**For further assistance, raise an issue [here](https://github.com/cipherstash/encrypt-query-language/issues).
91
+
For further help, raise an issue [here](https://github.com/cipherstash/encrypt-query-language/issues).
|`column_name`| Name of target column | Required |
27
-
|`index_name`| The index kind | Required.|
27
+
|`index_name`| The index kind | Required|
28
28
|`cast_as`| The PostgreSQL type decrypted data will be cast to | Optional. Defaults to `text`|
29
29
|`opts`| Index options | Optional for `match` indexes, required for `ste_vec` indexes (see below) |
30
30
@@ -44,7 +44,7 @@ Supported types:
44
44
45
45
A match index enables full text search across one or more text fields in queries.
46
46
47
-
The default Match index options are:
47
+
The default match index options are:
48
48
49
49
```json
50
50
{
@@ -93,21 +93,21 @@ Specifically, searching for strings _shorter_ than the `tokenLength` parameter w
93
93
94
94
If you're using n-gram as a token filter, then a token that is already shorter than the `tokenLength` parameter will be kept as-is when indexed, and so a search for that short token will match that record.
95
95
However, if that same short string only appears as a part of a larger token, then it will not match that record.
96
-
In general, therefore, you should try to ensure that the string you search for is at least as long as the `tokenLength` of the index, except in the specific case where you know that there are shorter tokens to match, _and_ you are explicitly OK with not returning records that have that short string as part of a larger token.
96
+
Try to ensure that the string you search for is at least as long as the `tokenLength` of the index, except in the specific case where you know that there are shorter tokens to match, _and_ you are explicitly OK with not returning records that have that short string as part of a larger token.
97
97
98
98
#### Options for ste_vec indexes (`opts`)
99
99
100
100
An ste_vec index on a encrypted JSONB column enables the use of PostgreSQL's `@>` and `<@`[containment operators](https://www.postgresql.org/docs/16/functions-json.html#FUNCTIONS-JSONB-OP-TABLE).
101
101
102
102
An ste_vec index requires one piece of configuration: the `context` (a string) which is passed as an info string to a MAC (Message Authenticated Code).
103
103
This ensures that all of the encrypted values are unique to that context.
104
-
It is generally recommended to use the table and column name as a the context (e.g. `users/name`).
104
+
We recommend that you use the table and column name as a the context (e.g. `users/name`).
105
105
106
-
Within a dataset, encrypted columns indexed using an `ste_vec` that use different contexts cannot be compared.
106
+
Within a dataset, encrypted columns indexed using an `ste_vec` that use different contexts can't be compared.
107
107
Containment queries that manage to mix index terms from multiple columns will never return a positive result.
108
108
This is by design.
109
109
110
-
The index is generated from a JSONB document by first flattening the structure of the document such that a hash can be generated for each unique path prefix to a node.
110
+
The index is generated from a JSONB document by first flattening the structure of the document so that a hash can be generated for each unique path prefix to a node.
111
111
112
112
The complete set of JSON types is supported by the indexer.
113
113
Null values are ignored by the indexer.
@@ -182,7 +182,7 @@ The hashes would be generated for all prefixes of the full path to the leaf node
182
182
183
183
Query terms are processed in the same manner as the input document.
184
184
185
-
A query prior to encrypting & indexing looks like a structurally similar subset of the encrypted document, for example:
185
+
A query prior to encrypting and indexing looks like a structurally similar subset of the encrypted document. For example:
EQL provides specialized functions to interact with encrypted JSONB data, supporting operations like containment queries, field extraction, and comparisons.
122
121
123
-
### Containment Queries (`cs_ste_vec_v1`)
122
+
### Containment queries (`cs_ste_vec_v1`)
124
123
125
124
Retrieve the Structured Encryption Vector for JSONB containment queries.
126
125
127
-
**Example: Containment Query**
126
+
**Example: Containment query**
128
127
129
128
Suppose we have the following encrypted JSONB data:
130
129
@@ -138,7 +137,7 @@ Suppose we have the following encrypted JSONB data:
138
137
139
138
We can query records that contain a specific structure.
140
139
141
-
**SQL Query:**
140
+
**SQL query:**
142
141
143
142
```sql
144
143
SELECT*FROM examples
@@ -162,11 +161,11 @@ WHERE jsonb_column @> '{"top":{"nested":["a"]}}';
162
161
163
162
**Note:** The `@>` operator checks if the left JSONB value contains the right JSONB value.
164
163
165
-
**Negative Example:**
164
+
**Negative example:**
166
165
167
166
If we query for a value that does not exist in the data:
168
167
169
-
**SQL Query:**
168
+
**SQL query:**
170
169
171
170
```sql
172
171
SELECT*FROM examples
@@ -183,7 +182,7 @@ WHERE cs_ste_vec_v1(encrypted_json) @> cs_ste_vec_v1(
183
182
184
183
This query would return no results, as the value `"d"` is not present in the `"nested"` array.
185
184
186
-
### Field Extraction (`cs_ste_vec_value_v1`)
185
+
### Field extraction (`cs_ste_vec_value_v1`)
187
186
188
187
Extract a field from an encrypted JSONB object.
189
188
@@ -201,7 +200,7 @@ Suppose we have the following encrypted JSONB data:
201
200
202
201
We can extract the value of the `"top"` key.
203
202
204
-
**SQL Query:**
203
+
**SQL query:**
205
204
206
205
```sql
207
206
SELECT cs_ste_vec_value_v1(encrypted_json,
@@ -231,7 +230,7 @@ FROM examples;
231
230
}
232
231
```
233
232
234
-
### Field Comparison (`cs_ste_vec_term_v1`)
233
+
### Field comparison (`cs_ste_vec_term_v1`)
235
234
236
235
Select rows based on a field value in an encrypted JSONB object.
237
236
@@ -247,7 +246,7 @@ Suppose we have encrypted JSONB data with a numeric field:
247
246
248
247
We can query records where the `"num"` field is greater than `2`.
249
248
250
-
**SQL Query:**
249
+
**SQL query:**
251
250
252
251
```sql
253
252
SELECT*FROM examples
@@ -277,7 +276,7 @@ SELECT * FROM examples
277
276
WHERE (jsonb_column->>'num')::int>2;
278
277
```
279
278
280
-
### Grouping Data
279
+
### Grouping data
281
280
282
281
Use `cs_ste_vec_term_v1` along with `cs_grouped_value_v1` to group by a field in an encrypted JSONB column.
283
282
@@ -296,7 +295,7 @@ Suppose we have records with a `"color"` field:
296
295
297
296
We can group the data by the `"color"` field and count occurrences.
@@ -336,24 +335,22 @@ GROUP BY jsonb_column->>'color';
336
335
| green | 2 |
337
336
| red | 1 |
338
337
339
-
## Reference
338
+
## EQL Functions for JSONB and `ste_vec`
340
339
341
-
### EQL Functions for JSONB and `ste_vec`
342
-
343
-
-**Index Management**
340
+
-**Index management**
344
341
345
342
-`cs_add_index_v1(table_name text, column_name text, 'ste_vec', 'jsonb', opts jsonb)`: Adds an `ste_vec` index configuration.
346
343
-`opts` must include the `"context"` key.
347
344
348
-
-**Query Functions**
345
+
-**Query functions**
349
346
350
347
-`cs_ste_vec_v1(val jsonb)`: Retrieves the STE vector for JSONB containment queries.
351
348
-`cs_ste_vec_term_v1(val jsonb, epath jsonb)`: Retrieves the encrypted term associated with an encrypted JSON path.
352
349
-`cs_ste_vec_value_v1(val jsonb, epath jsonb)`: Retrieves the decrypted value associated with an encrypted JSON path.
353
350
-`cs_ste_vec_terms_v1(val jsonb, epath jsonb)`: Retrieves an array of encrypted terms for elements in an array at the given JSON path (used for comparisons).
354
351
-`cs_grouped_value_v1(val jsonb)`: Used with `ste_vec` indexes for grouping.
355
352
356
-
###EJSON Paths
353
+
## EJSON paths
357
354
358
355
EQL uses an extended JSONPath syntax called EJSONPath for specifying paths in JSONB data.
359
356
@@ -363,7 +360,7 @@ EQL uses an extended JSONPath syntax called EJSONPath for specifying paths in JS
363
360
- Wildcards are supported: `$.some_array_field[*]`
364
361
- Array indexing is **not** supported: `$.some_array_field[0]`
365
362
366
-
**Example Paths:**
363
+
**Example paths:**
367
364
368
365
-`$.top.nested` selects the `"nested"` key within the `"top"` object.
369
366
-`$.array[*]` selects all elements in the `"array"` array.
Copy file name to clipboardExpand all lines: docs/reference/MIGRATOR.md
+2-4Lines changed: 2 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,15 @@
1
1
# CipherStash Migrator
2
2
3
-
The CipherStash Migrator is a tool that can be used to migrate plaintext data in a database to its encrypted equivalent.
3
+
CipherStash Migrator is a tool that can be used to migrate plaintext data in a database to its encrypted equivalent.
4
4
It works inside the CipherStash Proxy Docker container and can handle different data types such as text, JSONB, integers, booleans, floats, and dates.
5
-
By specifying the relevant columns in your table, the migrator will seamlessly encrypt the existing data and store it in designated encrypted columns.
5
+
By specifying the relevant columns in your table, CipherStash Migrator will seamlessly encrypt the existing data and store it in designated encrypted columns.
6
6
7
7
## Prerequisites
8
8
9
9
-[CipherStash Proxy](PROXY.md)
10
10
-[Have set up EQL in your database](GETTINGSTARTED.md)
11
11
- Ensure that the columns where data will be migrated already exist.
12
12
13
-
Here’s a draft for the technical usage documentation for the CipherStash Migrator tool:
14
-
15
13
## Usage
16
14
17
15
The CipherStash Migrator allows you to specify key-value pairs where the key is the plaintext column, and the value is the corresponding encrypted column.
0 commit comments