Skip to content

Commit 6f7048b

Browse files
authored
DOCSP-24993 corrects encryptionAlgorithm docs on ClientEncryption.encrypt (#1786)
* DOCSP-24993 corrects encryptionAlgorithm docs on ClientEncryption.encrypt * tech review feedback
1 parent 5007665 commit 6f7048b

File tree

5 files changed

+260
-125
lines changed

5 files changed

+260
-125
lines changed

source/includes/5.1/removed-parameters.rst

Lines changed: 0 additions & 19 deletions
This file was deleted.

source/includes/extracts-client-side-field-level-encryption.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ref: csfle-requires-enabling-encryption
22
content: |
33
4-
The ``mongo`` client-side field level encryption methods
4+
The :binary:`~bin.mongosh` client-side field level encryption methods
55
require a database connection with client-side field level encryption
66
enabled. If the current database connection was not initiated with
77
client-side field level encryption enabled, either:
88
9-
- Use the :method:`Mongo()` constructor from the ``mongo``
10-
shell to establish a connection with the required client-side field
9+
- Use the :method:`Mongo()` constructor from the :binary:`~bin.mongosh`
10+
to establish a connection with the required client-side field
1111
level encryption options. The :method:`Mongo()` method supports the
1212
following Key Management Service (KMS) providers for Customer
1313
Master Key (CMK) management:
@@ -19,7 +19,8 @@ content: |
1919
2020
*or*
2121
22-
- Use the ``mongo`` shell command line options to establish a
22+
- Use the :binary:`~bin.mongosh` :ref:`command line options
23+
<mongosh-client-side-field-level-encryption-options>` to establish a
2324
connection with the required options. The command line options only
2425
support the :ref:`Amazon Web Services KMS
2526
<field-level-encryption-aws-kms>` provider for CMK management.
@@ -49,10 +50,10 @@ content: |
4950
5051
To mitigate the risk of the AWS Access Key or AWS Secret Key leaking
5152
into logs, consider specifying an environment variable containing the
52-
required values as part of the ``mongo`` startup. For
53+
required values as part of the :binary:`~bin.mongosh` startup. For
5354
example, the following operation loads the ``AWS_ACCESS_KEY_ID`` and
5455
``AWS_SECRET_ACCESS_KEY`` environment variables into local variables
55-
in the ``mongo`` shell:
56+
in :binary:`~bin.mongosh`:
5657
5758
.. code-block:: bash
5859
@@ -74,7 +75,7 @@ content: |
7475
managed key requires specifying a base64-encoded 96-byte
7576
string with no line breaks. The following operation generates
7677
a key that meets the stated requirements and loads it into
77-
the ``mongo`` shell:
78+
:binary:`~bin.mongosh`:
7879
7980
.. code-block:: bash
8081
:emphasize-lines: 1
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Configuring queryable encryption for a locally managed key requires
2+
specifying a base64-encoded 96-byte string with no line breaks. The
3+
following operation generates a key that meets the stated requirements
4+
and loads it into :binary:`~bin.mongosh`:
5+
6+
.. code-block:: bash
7+
:emphasize-lines: 1
8+
9+
TEST_LOCAL_KEY=$(echo "$(head -c 96 /dev/urandom | base64 | tr -d '\n')")
10+
11+
mongosh --nodb
12+
13+
Create the client-side field level encryption object using the
14+
generated local key string:
15+
16+
.. code-block:: javascript
17+
:emphasize-lines: 5
18+
19+
var autoEncryptionOpts = {
20+
"keyVaultNamespace" : "encryption.__keyVault",
21+
"kmsProviders" : {
22+
"local" : {
23+
"key" : BinData(0, process.env["TEST_LOCAL_KEY"])
24+
}
25+
}
26+
}
27+
28+
Use the :method:`Mongo()` constructor to create a database connection
29+
with the queryable encryption options. Replace the
30+
``mongodb://myMongo.example.net`` URI with the :ref:`connection string
31+
URI <mongodb-uri>` of the target cluster.
32+
33+
.. code-block:: javascript
34+
:emphasize-lines: 2
35+
36+
encryptedClient = Mongo(
37+
"mongodb://myMongo.example.net:27017/?replSetName=myMongo",
38+
autoEncryptionOpts
39+
)

0 commit comments

Comments
 (0)