1
1
//! Support for explicit encryption.
2
2
3
3
use crate :: {
4
- bson:: { Binary , Document } ,
4
+ bson:: Binary ,
5
5
coll:: options:: CollectionOptions ,
6
6
error:: { Error , Result } ,
7
7
options:: { ReadConcern , WriteConcern } ,
@@ -260,16 +260,46 @@ pub struct DataKeyOptions {
260
260
pub key_material : Option < Vec < u8 > > ,
261
261
}
262
262
263
+ /// A KMS-specific key used to encrypt data keys.
263
264
#[ derive( Serialize ) ]
264
265
#[ serde( rename_all = "camelCase" , untagged) ]
265
266
#[ non_exhaustive]
267
+ #[ allow( missing_docs) ]
266
268
pub enum MasterKey {
267
269
Aws {
268
270
region : String ,
271
+ /// The Amazon Resource Name (ARN) to the AWS customer master key (CMK).
269
272
key : String ,
273
+ /// An alternate host identifier to send KMS requests to. May include port number. Defaults
274
+ /// to "kms.<region>.amazonaws.com"
270
275
endpoint : Option < String > ,
271
276
} ,
277
+ Azure {
278
+ /// Host with optional port. Example: "example.vault.azure.net".
279
+ key_vault_endpoint : String ,
280
+ key_name : String ,
281
+ /// A specific version of the named key, defaults to using the key's primary version.
282
+ key_version : Option < String > ,
283
+ } ,
284
+ Gcp {
285
+ project_id : String ,
286
+ location : String ,
287
+ key_ring : String ,
288
+ key_name : String ,
289
+ /// A specific version of the named key, defaults to using the key's primary version.
290
+ key_version : Option < String > ,
291
+ /// Host with optional port. Defaults to "cloudkms.googleapis.com".
292
+ endpoint : Option < String > ,
293
+ } ,
294
+ /// Master keys are not applicable to `KmsProvider::Local`.
272
295
Local ,
296
+ Kmip {
297
+ /// keyId is the KMIP Unique Identifier to a 96 byte KMIP Secret Data managed object. If
298
+ /// keyId is omitted, the driver creates a random 96 byte KMIP Secret Data managed object.
299
+ key_id : Option < String > ,
300
+ /// Host with optional port.
301
+ endpoint : Option < String > ,
302
+ } ,
273
303
}
274
304
275
305
// #[non_exhaustive]
@@ -291,6 +321,10 @@ pub struct EncryptOptions {
291
321
/// The key to use.
292
322
pub key : EncryptKey ,
293
323
/// The encryption algorithm.
324
+ ///
325
+ /// To insert or query with an "Indexed" encrypted payload, use a `Client` configured with
326
+ /// `AutoEncryptionOptions`. `AutoEncryptionOptions.bypass_query_analysis may be true.
327
+ /// `AutoEncryptionOptions.bypass_auto_encryption` must be false.
294
328
pub algorithm : Algorithm ,
295
329
/// The contention factor.
296
330
#[ builder( default ) ]
0 commit comments