Skip to content

Commit 166ddc7

Browse files
committed
(FLE): Cleanup 2
1 parent 0a80a70 commit 166ddc7

File tree

5 files changed

+224
-233
lines changed

5 files changed

+224
-233
lines changed

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
'guides': ('https://docs.mongodb.com/guides%s', ''),
7171
'java-docs-latest': ('http://mongodb.github.io/mongo-java-driver/3.11/%s', ''),
7272
'aws-docs': ('https://docs.aws.amazon.com/%s', ''),
73+
'wikipedia': ('https://en.wikipedia.org/wiki/%s', ''),
7374
}
7475

7576
intersphinx_mapping = {}

source/includes/steps-create-data-encryption-key.yaml

Lines changed: 59 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -5,106 +5,90 @@ content: |
55
First, retrieve the contents of the local master key file that you generated
66
in the :ref:`Create a Master Key <fle-create-a-master-key>` section:
77
8-
.. tabs::
9-
10-
tabs:
11-
12-
- id: use-cases-fle-guide-java
13-
name: "Java"
14-
content: |
15-
16-
.. code-block:: java
17-
:emphasize-lines: 11
18-
19-
String path = "master-key.txt";
20-
21-
byte[] fileBytes = new byte[96];
22-
23-
try (FileInputStream fis = new FileInputStream(path)) {
24-
fileBytes = fis.readAllBytes();
25-
} catch (IOException e) {
26-
e.printStackTrace();
27-
}
28-
29-
final byte[] localMasterKey = Arrays.copyOf(fileBytes, 96);
30-
31-
8+
.. tabs-drivers::
9+
10+
.. tab::
11+
:tabid: java-sync
12+
13+
.. code-block:: java
14+
:emphasize-lines: 11
15+
16+
String path = "master-key.txt";
17+
18+
byte[] fileBytes = new byte[96];
19+
20+
try (FileInputStream fis = new FileInputStream(path)) {
21+
fileBytes = fis.readAllBytes();
22+
} catch (IOException e) {
23+
e.printStackTrace();
24+
}
25+
26+
final byte[] localMasterKey = Arrays.copyOf(fileBytes, 96);
3227
---
3328
title: Specify KMS Provider Settings
3429
ref: specify-kms-provider-settings
3530
level: 4
3631
content: |
37-
Next, specify the KMS provider settings. The client uses these settings to
38-
discover the master key. Set the provider name to ``local`` when using a local
32+
Next, specify the KMS provider settings. The client uses these settings to
33+
discover the master key. Set the provider name to ``local`` when using a local
3934
master key:
4035
41-
.. tabs::
42-
43-
tabs:
44-
45-
- id: use-cases-fle-guide-java
46-
name: "Java"
47-
content: |
48-
49-
.. code-block:: java
50-
:emphasize-lines: 4,5
51-
52-
String kmsProvider = "local";
53-
54-
Map<String, Map<String, Object>> kmsProviders = new HashMap<String, Map<String, Object>>() {{
55-
put(kmsProvider, new HashMap<String, Object>() {{
56-
put("key", localMasterKey);
57-
}});
58-
}};
59-
60-
36+
.. tabs-drivers::
37+
38+
.. tab::
39+
:tabid: java-sync
40+
41+
.. code-block:: java
42+
:emphasize-lines: 4,5
43+
44+
String kmsProvider = "local";
45+
46+
Map<String, Map<String, Object>> kmsProviders = new HashMap<String, Map<String, Object>>() {{
47+
put(kmsProvider, new HashMap<String, Object>() {{
48+
put("key", localMasterKey);
49+
}});
50+
}};
6151
---
6252
title: Create a Data Encryption Key
6353
ref: create-a-data-encryption-key
6454
level: 4
6555
content: |
66-
Construct a client with the MongoDB connection string and key vault
67-
namespace configuration, and create a data encryption key. The key vault in
56+
Construct a client with the MongoDB connection string and key vault
57+
namespace configuration, and create a data encryption key. The key vault in
6858
this example uses the ``encryption`` database and ``__keyVault`` collection.
6959
70-
.. tabs::
71-
72-
tabs:
73-
74-
- id: use-cases-fle-guide-java
75-
name: "Java"
76-
content: |
77-
78-
.. code-block:: java
79-
:emphasize-lines: 8,9,12
80-
81-
String connectionString = "mongodb://localhost:27017";
82-
String keyVaultNamespace = "encryption.__keyVault";
83-
84-
ClientEncryptionSettings clientEncryptionSettings = ClientEncryptionSettings.builder()
85-
.keyVaultMongoClientSettings(MongoClientSettings.builder()
86-
.applyConnectionString(new ConnectionString(connectionString))
87-
.build())
88-
.keyVaultNamespace(keyVaultNamespace)
89-
.kmsProviders(kmsProviders)
90-
.build();
91-
92-
ClientEncryption clientEncryption = ClientEncryptions.create(clientEncryptionSettings);
93-
60+
.. tabs-drivers::
61+
62+
.. tab::
63+
:tabid: java-sync
64+
65+
.. code-block:: java
66+
:emphasize-lines: 8,9,12
67+
68+
String connectionString = "mongodb://localhost:27017";
69+
String keyVaultNamespace = "encryption.__keyVault";
70+
71+
ClientEncryptionSettings clientEncryptionSettings = ClientEncryptionSettings.builder()
72+
.keyVaultMongoClientSettings(MongoClientSettings.builder()
73+
.applyConnectionString(new ConnectionString(connectionString))
74+
.build())
75+
.keyVaultNamespace(keyVaultNamespace)
76+
.kmsProviders(kmsProviders)
77+
.build();
78+
79+
ClientEncryption clientEncryption = ClientEncryptions.create(clientEncryptionSettings);
9480
9581
.. note::
9682
9783
Ensure that the client has `ReadWrite
9884
<https://docs.mongodb.com/manual/reference/built-in-roles/#readWrite>`_
9985
permissions on the specified key vault namespace.
100-
101-
10286
---
10387
title: Verify the data encryption key was created
10488
ref: verify-data-key-created
10589
level: 4
10690
content: |
107-
Verify that the key document was created in your MongoDB replica set in the
91+
Verify that the key document was created in your MongoDB replica set in the
10892
key vault collection. This document contains the following data:
10993
11094
* Data encryption key, in encrypted form.

source/includes/steps-fle-configure-the-mongodb-client.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ content: |
55
encrypt and decrypt fields. MedcoMD uses the collection
66
``encryption.__keyVault`` as the key vault.
77
8-
.. tabs::
9-
10-
.. tab:: Java
11-
:tabid: use-cases-fle-guide-java
8+
.. tabs-drivers::
9+
10+
.. tab::
11+
:tabid: java-sync
1212
1313
.. code-block:: java
1414
@@ -22,10 +22,10 @@ content: |
2222
master key, so they use the ``local`` KMS provider and specify the key
2323
inline.
2424
25-
.. tabs::
26-
27-
.. tab:: Java
28-
:tabid: use-cases-fle-guide-java
25+
.. tabs-drivers::
26+
27+
.. tab::
28+
:tabid: java-sync
2929
3030
.. code-block:: java
3131
:emphasize-lines: 2,3
@@ -43,10 +43,10 @@ content: |
4343
collection to which it applies. To assign the schema, they map it to
4444
the ``medicalRecords.patients`` collection namespace:
4545
46-
.. tabs::
47-
48-
.. tab:: Java
49-
:tabid: use-cases-fle-guide-java
46+
.. tabs-drivers::
47+
48+
.. tab::
49+
:tabid: java-sync
5050
5151
.. code-block:: java
5252
:emphasize-lines: 2
@@ -63,10 +63,10 @@ content: |
6363
``mongocryptd`` process. To configure the client to find the binary,
6464
MedcoMD specifies the binary's path as an extra option:
6565
66-
.. tabs::
67-
68-
.. tab:: Java
69-
:tabid: use-cases-fle-guide-java
66+
.. tabs-drivers::
67+
68+
.. tab::
69+
:tabid: java-sync
7070
7171
.. code-block:: java
7272
:emphasize-lines: 2
@@ -96,10 +96,10 @@ content: |
9696
MongoDB client object with the additional automatic encryption
9797
settings:
9898
99-
.. tabs::
100-
101-
.. tab:: Java
102-
:tabid: use-cases-fle-guide-java
99+
.. tabs-drivers::
100+
101+
.. tab::
102+
:tabid: java-sync
103103
104104
.. code-block:: java
105105
:emphasize-lines: 3-8

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ content: |
4040
4141
Update the KMS Provider configuration in CSFLE-enabled client creation code:
4242
43-
.. tabs::
44-
45-
.. tab:: Java
46-
:tabid: use-cases-fle-guide-java
43+
.. tabs-drivers::
44+
45+
.. tab::
46+
:tabid: java-sync
4747
4848
.. code-block:: java
4949
:emphasize-lines: 5-8
@@ -72,10 +72,10 @@ content: |
7272
Once you have the required information, run the following code to
7373
generate the new data key:
7474
75-
.. tabs::
76-
77-
.. tab:: Java
78-
:tabid: use-cases-fle-guide-java
75+
.. tabs-drivers::
76+
77+
.. tab::
78+
:tabid: java-sync
7979
8080
.. code-block:: Java
8181
:emphasize-lines: 9-14, 17

0 commit comments

Comments
 (0)