Skip to content

Commit 00863f2

Browse files
authored
DOCSP-23206 QE Manual Encryption Page (Updated PR) (#1698)
* DOCSP-23206 adds Manual Encryption page for QE * re-point ref * additional ref * internal review feedback * updates section on specifying fields to encrypt and removes admonition re no docs on manual enc * removes examples and updates man enc page * internal review feedback * adds TODO * updates ref * admonition re incoming code examples * remove addl admonition * tech review updates * removes reference/mongo from snooty.toml * re-adds reference/mongo to snooty.toml * resets snooty.toml to master branch version
1 parent af4fea9 commit 00863f2

File tree

6 files changed

+160
-7
lines changed

6 files changed

+160
-7
lines changed

source/core/csfle/fundamentals/manual-encryption.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Overview
2020
Learn how to use the **{+manual-enc+}** mechanism of {+csfle+}
2121
({+csfle-abbrev+}).
2222

23+
.. include:: /includes/fact-manual-enc-definition.rst
24+
2325
{+manual-enc-first+} is a mechanism in which you specify how you would
2426
like to encrypt and decrypt fields in your document in each operation you
2527
perform on your database.
@@ -224,4 +226,4 @@ To learn more about {+key-vault-long+}s, {+dek-long+}s, and {+cmk-long+}s,
224226
see :ref:`csfle-reference-keys-key-vaults`.
225227

226228
To learn more about {+kms-abbr+} providers and ``kmsProviders`` objects,
227-
see :ref:`csfle-reference-kms-providers`.
229+
see :ref:`csfle-reference-kms-providers`.

source/core/queryable-encryption.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ mechanisms:
6767
- | No
6868
- | Yes
6969

70-
.. important:: No Documentation on {+manual-enc-title+}
71-
72-
At present, we do not have documentation detailing how to perform
73-
{+manual-enc+} with {+qe+}. We will publish documentation for
74-
this feature soon.
75-
7670
To learn which MongoDB drivers support {+qe+}, see
7771
:ref:`qe-compatibility-reference`.
7872

source/core/queryable-encryption/fundamentals.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ Read the following sections to learn how {+qe+} works and how to use it:
1818
- :ref:`qe-fundamentals-collection-management`
1919
- :ref:`qe-reference-keys-key-vaults`
2020
- :ref:`qe-fundamentals-manage-keys`
21+
- :ref:`qe-fundamentals-manual-encryption`
2122
- :ref:`qe-fundamentals-kms-providers`
2223

2324
.. toctree::
2425
:titlesonly:
2526

2627
/core/queryable-encryption/fundamentals/encrypt-and-query
2728
/core/queryable-encryption/fundamentals/manage-collections
29+
/core/queryable-encryption/fundamentals/manual-encryption
2830
/core/queryable-encryption/fundamentals/keys-key-vaults
2931
/core/queryable-encryption/fundamentals/manage-keys
3032
/core/queryable-encryption/fundamentals/kms-providers

source/core/queryable-encryption/fundamentals/encrypt-and-query.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ In this guide, you can learn about the following {+qe+} topics:
2222
- Query types and which ones you can use on encrypted fields.
2323
- What to consider when deciding whether to enable queries on an encrypted field.
2424

25+
.. _qe-specify-fields-for-encryption:
26+
2527
Specify Fields for Encryption
2628
-----------------------------
2729

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
.. _qe-fundamentals-manual-encryption:
2+
3+
=================
4+
{+manual-enc-title+}
5+
=================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
Overview
16+
--------
17+
18+
Learn how to use the **{+manual-enc+}** mechanism of {+qe+}.
19+
20+
.. include:: /includes/fact-manual-enc-definition.rst
21+
22+
{+manual-enc-first+} is available in the following MongoDB products
23+
using version 6.0 or later:
24+
25+
- MongoDB Community Server
26+
- MongoDB Enterprise Advanced
27+
- MongoDB Atlas
28+
29+
Use {+manual-enc-title+}
30+
---------------------
31+
32+
The following sections provide an overview of using {+manual-enc+} in
33+
your {+qe+}-enabled application:
34+
35+
- :ref:`qe-fundamentals-manual-encryption-client-enc`
36+
- :ref:`qe-fundamentals-manual-encryption-update-operations`
37+
- :ref:`qe-fundamentals-manual-encryption-automatic-decryption`
38+
39+
.. _qe-fundamentals-manual-encryption-client-enc:
40+
41+
Create a ``ClientEncryption`` Instance
42+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43+
44+
``ClientEncryption`` is an abstraction used across drivers and
45+
:binary:`~bin.mongosh` that encapsulates the {+key-vault-long+}
46+
and {+kms-abbr+} operations involved in {+manual-enc+}.
47+
48+
To create a ``ClientEncryption`` instance, specify:
49+
50+
- A ``kmsProviders`` object configured with access to the
51+
{+kms-abbr+} hosting your {+cmk-long+}
52+
- The namespace of your {+key-vault-long+}
53+
- If you use MongoDB Community Server, set the ``bypassQueryAnalysis``
54+
option to ``True``
55+
- A ``MongoClient`` instance with access to your {+key-vault-long+}
56+
57+
For more ``ClientEncryption`` options, see :ref:`qe-reference-mongo-client`.
58+
59+
.. note::
60+
61+
Code examples are not currently available but are coming soon.
62+
63+
.. _qe-fundamentals-manual-encryption-update-operations:
64+
65+
Encrypt Fields in Read and Write Operations
66+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67+
68+
You must update read and write operations throughout your application
69+
such that your application encrypts fields before performing
70+
read and write operations.
71+
72+
To encrypt fields, use the ``encrypt`` method of your ``ClientEncryption``
73+
instance. Specify the following:
74+
75+
- The value to be encrypted
76+
- The algorithm used, either ``Indexed`` or ``Unindexed``
77+
- The ID of the {+dek-long+}
78+
- The contention factor (if you are using the ``Indexed`` algorithm)
79+
- If performing a read operation, set the query type defined for your
80+
field (if you are using the ``Indexed`` algorithm)
81+
82+
.. note:: Query Types
83+
84+
The query type only applies to read operations.
85+
86+
To learn more about query types, see :ref:`qe-query-types`.
87+
88+
.. TODO: Need tech review on this section to ensure correctness and potentially add details
89+
90+
Algorithm Choice
91+
````````````````
92+
93+
Use the ``Indexed`` algorithm if you specify a ``queryType`` on the
94+
field.
95+
96+
``Indexed`` supports equality queries. ``Indexed`` fields require an
97+
index on the server. The index is created by specifying the
98+
``encryptedFields`` option in :method:`db.createCollection()`.
99+
100+
.. _qe-fundamentals-manual-encryption-automatic-decryption:
101+
102+
Automatic Decryption
103+
~~~~~~~~~~~~~~~~~~~~
104+
105+
To decrypt your fields automatically, you must configure your
106+
``MongoClient`` instance as follows:
107+
108+
- Specify a ``kmsProviders`` object
109+
- Specify your {+key-vault-long+}
110+
- If you use MongoDB Community Server, set the ``bypassQueryAnalysis``
111+
option to ``True``
112+
113+
.. note:: Automatic Decryption is Available in MongoDB Community Server
114+
115+
Although automatic encryption requires MongoDB Enterprise or MongoDB
116+
Atlas, automatic decryption is available in the following MongoDB
117+
products using version 6.0 or later:
118+
119+
- MongoDB Community Server
120+
- MongoDB Enterprise Advanced
121+
- MongoDB Atlas
122+
123+
.. _qe-fundamentals-manual-encryption-server-side-schema:
124+
125+
Server-Side Field Level Encryption Enforcement
126+
----------------------------------------------
127+
128+
:ref:`qe-specify-fields-for-encryption` to enforce
129+
encryption of specific fields in a collection.
130+
131+
``Indexed`` fields require an index on the server. The index is created
132+
by specifying the ``encryptedFields`` option in
133+
:method:`db.createCollection()`.
134+
135+
A client performing {+qe+} with the {+manual-enc+}
136+
mechanism on a MongoDB instance configured to enforce encryption
137+
of certain fields must encrypt those fields as specified on
138+
the MongoDB instance.
139+
140+
To learn how to set up server-side {+qe+}
141+
enforcement, see :ref:`qe-fundamentals-encrypt-query`.
142+
143+
Learn More
144+
----------
145+
146+
To learn more about {+key-vault-long+}s, {+dek-long+}s, and {+cmk-long+}s,
147+
see :ref:`csfle-reference-keys-key-vaults`.
148+
149+
To learn more about {+kms-abbr+} providers and ``kmsProviders`` objects,
150+
see :ref:`csfle-reference-kms-providers`.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{+manual-enc-first+} is a mechanism in which you specify how you would
2+
like to encrypt and decrypt fields in your document in each operation you
3+
perform on your database.

0 commit comments

Comments
 (0)