@@ -83,6 +83,10 @@ content: |
83
83
.. tab::
84
84
:tabid: java-sync
85
85
86
+ In ``CSFLEHelpers.java``, update the ``kmsProviders`` map that you
87
+ pass to ``ClientEncryptionSettings.builder().kmsProviders()`` method
88
+ with your Azure authentication details:
89
+
86
90
87
91
.. code-block:: java
88
92
@@ -96,6 +100,11 @@ content: |
96
100
Map<String, Map<String, Object>> kmsProviders = new HashMap<String, Map<String, Object>>();
97
101
kmsProviders.put("azure", providerDetails);
98
102
103
+ ClientEncryptionSettings clientEncryptionSettings = ClientEncryptionSettings.builder()
104
+ // ...
105
+ .kmsProviders(kmsProviders)
106
+ .build();
107
+
99
108
.. tab::
100
109
:tabid: nodejs
101
110
@@ -192,28 +201,24 @@ content: |
192
201
.. tab::
193
202
:tabid: java-sync
194
203
195
- .. code-block:: Java
204
+ In ``CSFLEHelpers.java``, add your KMS provider and master key
205
+ details to your call to createDataKey() on your ``ClientEncryption``
206
+ instance as follows:
196
207
197
- // TODO: update for Azure
198
- ClientEncryption clientEncryption = ClientEncryptions.create(ClientEncryptionSettings.builder()
199
- .keyVaultMongoClientSettings(MongoClientSettings.builder()
200
- .applyConnectionString(new ConnectionString("mongodb://localhost:27017"))
201
- .build())
202
- .keyVaultNamespace(keyVaultNamespace)
203
- .kmsProviders(kmsProviders)
204
- .build());
208
+ .. code-block:: Java
205
209
206
- BsonString masterKeyRegion = new BsonString("<Master Key AWS Region>"); // e.g. "us-east-2"
207
- BsonString masterKeyArn = new BsonString("<Master Key ARN>"); // e.g. "arn:aws:kms:us-east-2:111122223333:alias/test-key"
208
210
DataKeyOptions dataKeyOptions = new DataKeyOptions().masterKey(
209
211
new BsonDocument()
210
- .append("region", masterKeyRegion)
211
- .append("key", masterKeyArn));
212
+ .append("keyName", new BsonString("<Azure key name>"))
213
+ .append("keyVersion", new BsonString("<Azure key version>"))
214
+ .append("keyVersion", new BsonString("<Azure key vault endpoint>")));
215
+
216
+ BsonBinary dataKeyId = clientEncryption.createDataKey("azure", dataKeyOptions);
212
217
213
- BsonBinary dataKeyId = clientEncryption.createDataKey("aws", dataKeyOptions);
214
- String base64DataKeyId = Base64.getEncoder().encodeToString(dataKeyId.getData());
218
+ .. note::
215
219
216
- System.out.println("DataKeyId [base64]: " + base64DataKeyId);
220
+ To use the Azure Key Vault, you must use `mongodb-crypt <https://mvnrepository.com/artifact/org.mongodb/mongodb-crypt>`__
221
+ version 1.1 or later in your application's environment.
217
222
218
223
.. tab::
219
224
:tabid: nodejs
0 commit comments