You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Coming soon:** An example using the community version and demonstrating explicit encryption/decryption.
170
+
#### Explicit Encryption and Decryption
171
+
Explicit encryption and decryption is a **MongoDB community** feature and does not use the `mongocryptd` process. Explicit encryption is
172
+
provided by the `ClientEncryption` class.
173
+
The full code snippet can be found in [`ClientSideEncryptionExplicitEncryptionAndDecryptionTour.java`]({{< srcref "driver-reactive-streams/src/examples/reactivestreams/tour/ClientSideEncryptionAutoEncryptionSettingsTour.java">}}):
174
+
175
+
```
176
+
// This would have to be the same master key as was used to create the encryption key
177
+
final byte[] localMasterKey = new byte[96];
178
+
new SecureRandom().nextBytes(localMasterKey);
179
+
180
+
Map<String, Map<String, Object>> kmsProviders = new HashMap<String, Map<String, Object>>() {{
181
+
put("local", new HashMap<String, Object>() {{
182
+
put("key", localMasterKey);
183
+
}});
184
+
}};
185
+
186
+
MongoNamespace keyVaultNamespace = new MongoNamespace("encryption.testKeyVault");
Although automatic encryption requires MongoDB 4.2 enterprise or a MongoDB 4.2 Atlas cluster, automatic decryption is supported for all
249
+
users. To configure automatic decryption without automatic encryption set `bypassAutoEncryption(true)`. The full code snippet can be found in [`ClientSideEncryptionExplicitEncryptionOnlyTour.java`]({{< srcref "driver-reactive-streams/src/examples/reactivestreams/tour/ClientSideEncryptionExplicitEncryptionOnlyTour.java">}}):
Copy file name to clipboardExpand all lines: docs/reference/content/driver-scala/tutorials/client-side-encryption.md
+88-1Lines changed: 88 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -162,4 +162,91 @@ import tour.Helpers._
162
162
.build()
163
163
```
164
164
165
-
**Coming soon:** An example using the community version and demonstrating explicit encryption/decryption.
165
+
#### Explicit Encryption and Decryption
166
+
Explicit encryption and decryption is a **MongoDB community** feature and does not use the `mongocryptd` process. Explicit encryption is
167
+
provided by the `ClientEncryption` class.
168
+
The full code snippet can be found in [`ClientSideEncryptionExplicitEncryptionAndDecryptionTour.scala`]({{< srcref "driver-scala/src/it/scala/tour/ClientSideEncryptionAutoEncryptionSettingsTour.scala">}}):
169
+
170
+
```
171
+
// This would have to be the same master key as was used to create the encryption key
172
+
val localMasterKey = new Array[Byte](96)
173
+
new SecureRandom().nextBytes(localMasterKey)
174
+
175
+
val kmsProviders = Map("local" -> Map[String, AnyRef]("key" -> localMasterKey).asJava).asJava
176
+
177
+
val keyVaultNamespace = new MongoNamespace("encryption.testKeyVault")
178
+
179
+
val clientSettings = MongoClientSettings.builder().build()
180
+
val mongoClient = MongoClient(clientSettings)
181
+
182
+
// Set up the key vault for this example
183
+
val keyVaultCollection = mongoClient.getDatabase(keyVaultNamespace.getDatabaseName)
Although automatic encryption requires MongoDB 4.2 enterprise or a MongoDB 4.2 Atlas cluster, automatic decryption is supported for all
228
+
users. To configure automatic decryption without automatic encryption set `bypassAutoEncryption(true)`. The full code snippet can be found in [`ClientSideEncryptionExplicitEncryptionOnlyTour.scala`]({{< srcref "driver-scala/src/it/scala/tour/ClientSideEncryptionExplicitEncryptionOnlyTour.scala">}}):
229
+
230
+
```
231
+
...
232
+
val clientSettings = MongoClientSettings.builder()
**Coming soon:** An example using the community version and demonstrating explicit encryption/decryption.
160
+
#### Explicit Encryption and Decryption
161
+
Explicit encryption and decryption is a **MongoDB community** feature and does not use the `mongocryptd` process. Explicit encryption is
162
+
provided by the `ClientEncryption` class.
163
+
The full code snippet can be found in [`ClientSideEncryptionExplicitEncryptionAndDecryptionTour.java`]({{< srcref "driver-sync/src/examples/tour/ClientSideEncryptionExplicitEncryptionAndDecryptionTour.java">}}):
164
+
165
+
```
166
+
// This would have to be the same master key as was used to create the encryption key
167
+
final byte[] localMasterKey = new byte[96];
168
+
new SecureRandom().nextBytes(localMasterKey);
169
+
170
+
Map<String, Map<String, Object>> kmsProviders = new HashMap<String, Map<String, Object>>() {{
Although automatic encryption requires MongoDB 4.2 enterprise or a MongoDB 4.2 Atlas cluster, automatic decryption is supported for all
225
+
users. To configure automatic decryption without automatic encryption set `bypassAutoEncryption(true)`. The full code snippet can be found in [`ClientSideEncryptionExplicitEncryptionOnlyTour.java`]({{< srcref "driver-sync/src/examples/tour/ClientSideEncryptionExplicitEncryptionOnlyTour.java">}}):
0 commit comments