Skip to content

Commit 0ada713

Browse files
author
Chris Cho
authored
DOCSP-19396: CSFLE credential note improvements (#779)
* DOCSP-19396: CSFLE credential note improvements
1 parent a63fa9d commit 0ada713

10 files changed

+194
-41
lines changed

source/includes/steps-fle-convert-to-a-remote-master-key-aws.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ content: |
7474
7575
2. Next, add your authentication credentials to your CSFLE-enabled client
7676
code:
77-
78-
.. include:: /includes/substitute-placeholders.rst
77+
78+
.. include:: /includes/substitute-placeholders-aws.rst
7979
8080
.. tabs-drivers::
8181
@@ -93,7 +93,7 @@ content: |
9393
providerDetails.put("secretAccessKey", awsSecretAccessKey);
9494
9595
kmsProviders.put("aws", providerDetails);
96-
96+
9797
.. tab::
9898
:tabid: nodejs
9999
@@ -197,9 +197,9 @@ content: |
197197
198198
2. Once you have the required information, update and run the following code
199199
to generate the new data encryption key:
200-
201-
.. include:: /includes/substitute-placeholders.rst
202-
200+
201+
.. include:: /includes/substitute-placeholders-aws-key.rst
202+
203203
.. tabs-drivers::
204204
205205
.. tab::
@@ -269,7 +269,7 @@ content: |
269269
kms_providers, # pass in the kms_providers from the previous step
270270
key_vault_namespace
271271
)
272-
272+
273273
client = MongoClient(connection_string)
274274
client_encryption = pymongo.encryption.ClientEncryption(
275275
{

source/includes/steps-fle-convert-to-a-remote-master-key-azure.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ content: |
8181
2. Next, update the KMS Provider configuration in your CSFLE-enabled client
8282
creation code:
8383
84-
.. include:: /includes/substitute-placeholders.rst
84+
.. include:: /includes/substitute-placeholders-azure.rst
8585
8686
.. tabs-drivers::
8787
@@ -249,8 +249,8 @@ content: |
249249
2. Once you have the required information, update and run the following code
250250
to generate a new data encryption key:
251251
252-
.. include:: /includes/substitute-placeholders.rst
253-
252+
.. include:: /includes/substitute-placeholders-azure-key.rst
253+
254254
.. tabs-drivers::
255255
256256
.. tab::

source/includes/steps-fle-convert-to-a-remote-master-key-gcp.yaml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ content: |
6767
.. list-table::
6868
:header-rows: 1
6969
:stub-columns: 1
70-
:widths: 30 15 45
70+
:widths: 20 12 68
7171
7272
* - Field
7373
- Required
@@ -79,10 +79,32 @@ content: |
7979
8080
* - privateKey
8181
- Yes
82-
- Identifies your service account private key in either
83-
`base64 string <https://en.wikipedia.org/wiki/Base64>`__ or
84-
:manual:`Binary subtype 0 <reference/mongodb-extended-json/#bson.Binary>`
85-
format.
82+
- | Identifies your service account private key in either
83+
`base64 string <https://en.wikipedia.org/wiki/Base64>`__ or
84+
:manual:`Binary subtype 0 </reference/mongodb-extended-json/#bson.Binary>`
85+
format without the prefix and suffix markers.
86+
|
87+
| Suppose your service account private key value is as follows:
88+
89+
.. code-block:: none
90+
:copyable: false
91+
92+
-----BEGIN PRIVATE KEY-----\nyour-private-key\n-----END PRIVATE KEY-----\n
93+
94+
| The value you would specify for this field is:
95+
96+
.. code-block:: none
97+
:copyable: false
98+
99+
your-private-key
100+
101+
| If you have a ``user-key.json`` credential file, you can extract
102+
the string by executing the following command in a bash or
103+
similar shell:
104+
105+
.. code-block:: shell
106+
107+
cat user-key.json | jq -r .private_key | openssl pkcs8 -topk8 -nocrypt -inform PEM -outform DER | base64 -w 0
86108
87109
* - endpoint
88110
- No
@@ -91,8 +113,8 @@ content: |
91113
92114
2. Next, add your authentication credentials to your CSFLE-enabled client
93115
code:
94-
95-
.. include:: /includes/substitute-placeholders.rst
116+
117+
.. include:: /includes/substitute-placeholders-gcp.rst
96118
97119
.. tabs-drivers::
98120
@@ -202,7 +224,7 @@ content: |
202224
.. note::
203225
204226
To use the GCP KMS, you must use
205-
`libmongocrypt <https://github.com/mongodb/libmongocrypt>`__
227+
`libmongocrypt <https://github.com/mongodb/libmongocrypt>`__
206228
version 1.1 or later in your application's environment.
207229
208230
---
@@ -258,8 +280,8 @@ content: |
258280
2. Once you have the required information, update and run the following code
259281
to generate a new data encryption key:
260282
261-
.. include:: /includes/substitute-placeholders.rst
262-
283+
.. include:: /includes/substitute-placeholders-gcp-key.rst
284+
263285
.. tabs-drivers::
264286
265287
.. tab::
@@ -280,7 +302,7 @@ content: |
280302
.append("endpoint", "<GCP KMS API endpoint>"));
281303
282304
BsonBinary dataKeyId = clientEncryption.createDataKey("gcp", dataKeyOptions);
283-
305+
284306
.. tab::
285307
:tabid: nodejs
286308
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. note:: Placeholder Text
2+
3+
You must substitute all text in quotes and angle brackets with
4+
your KMS configuration values.
5+
6+
For example, the Node.js code prompts you to include a master key value
7+
as follows:
8+
9+
.. code-block:: javascript
10+
:copyable: false
11+
12+
masterKey: {
13+
key: "<Master Key ARN>"
14+
...
15+
}
16+
17+
18+
If your master key is "arn:aws:kms:us-east-2:111122223333:alias/test-key",
19+
substitute the text as follows:
20+
21+
.. code-block:: javascript
22+
:copyable: false
23+
24+
masterKey: {
25+
key: "arn:aws:kms:us-east-2:111122223333:alias/test-key"
26+
...
27+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. note:: Placeholder Text
2+
3+
You must substitute all text in quotes and angle brackets with
4+
your KMS configuration values.
5+
6+
For example, the Node.js code prompts you to include a private access key
7+
id value as follows:
8+
9+
.. code-block:: javascript
10+
:copyable: false
11+
12+
privateKey: "<IAM User Access Key ID>"
13+
14+
If your AWS user access key is "23478207027842073230762374023", substitute
15+
the text as follows:
16+
17+
.. code-block:: javascript
18+
:copyable: false
19+
20+
privateKey: "23478207027842073230762374023"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. note:: Placeholder Text
2+
3+
You must substitute all text in quotes and angle brackets with
4+
your KMS configuration values.
5+
6+
For example, the Node.js code prompts you to include a key name value
7+
as follows:
8+
9+
.. code-block:: javascript
10+
:copyable: false
11+
12+
azure: {
13+
keyName: "<Azure key name>"
14+
...
15+
}
16+
17+
If your Azure master key name is "my-key-name", you should substitute the
18+
text as follows:
19+
20+
.. code-block:: javascript
21+
:copyable: false
22+
23+
azure: {
24+
keyName: "my-key-name"
25+
...
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. note:: Placeholder Text
2+
3+
You must substitute all text in quotes and angle brackets with
4+
your KMS configuration values.
5+
6+
For example, the Node.js code prompts you to include a client ID value as
7+
follows:
8+
9+
.. code-block:: javascript
10+
:copyable: false
11+
12+
azure: {
13+
clientId: "<Azure client ID>"
14+
...
15+
}
16+
17+
If your Azure client ID is "12345678", you should substitute the text as
18+
follows:
19+
20+
.. code-block:: javascript
21+
:copyable: false
22+
23+
azure: {
24+
clientId: "12345678"
25+
...
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. note:: Placeholder Text
2+
3+
You must substitute all text in quotes and angle brackets with
4+
your KMS configuration values.
5+
6+
For example, the Node.js code prompts you to include a key ring value as
7+
follows:
8+
9+
.. code-block:: javascript
10+
:copyable: false
11+
12+
masterKey: {
13+
keyRing: "<GCP key ring name>"
14+
...
15+
}
16+
17+
If your GCP key ring is "my-key-ring", you should substitute the text as
18+
follows:
19+
20+
.. code-block:: javascript
21+
:copyable: false
22+
23+
masterKey: {
24+
keyRing: "my-key-ring"
25+
...
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. note:: Placeholder Text
2+
3+
You must substitute all text in quotes and angle brackets with your KMS
4+
configuration values.
5+
6+
For example, the Node.js code prompts you to include a private key value
7+
as follows:
8+
9+
.. code-block:: javascript
10+
:copyable: false
11+
12+
privateKey: "<GCP service account private key>"
13+
14+
Suppose your GCP service account private key is the following:
15+
16+
.. code-block:: none
17+
:copyable: false
18+
19+
-----BEGIN PRIVATE KEY-----\nyour-private-key\n-----END PRIVATE KEY-----\n
20+
21+
Substitute the placeholder text as follows:
22+
23+
.. code-block:: javascript
24+
:copyable: false
25+
26+
privateKey: "your-private-key"

source/includes/substitute-placeholders.rst

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

0 commit comments

Comments
 (0)