@@ -199,7 +199,7 @@ in order to perform automatic encryption.
199
199
# => <BSON::Binary... type=ciphertext...>
200
200
201
201
The example above demonstrates using automatic encryption with a local master key.
202
- For more information about using the AWS Key Management Service to create a
202
+ For more information about using other key management services to create a
203
203
master key and create data keys, see the following sections of this tutorial:
204
204
205
205
- `Creating A Master Key`_
@@ -293,7 +293,7 @@ in order to perform explicit encryption.
293
293
# => "sensitive data"
294
294
295
295
The example above demonstrates using explicit encryption with a local master key.
296
- For more information about using the AWS Key Management Service to create a
296
+ For more information about using other key management services to create a
297
297
master key and create data keys, see the following sections of this tutorial:
298
298
299
299
- `Creating A Master Key`_,
@@ -304,8 +304,8 @@ Creating a Master Key
304
304
Both automatic encryption and explicit encryption require an encryption master key.
305
305
This master key is used to encrypt data keys, which are in turn used to encrypt
306
306
user data. The master key can be generated in one of two ways: by creating a
307
- local key, or by creating a key in the Amazon Web Services Key Management
308
- Service ( AWS KMS).
307
+ local key, or by creating a key in a key management service. Currently
308
+ Ruby driver supports AWS Key Management Service ( KMS) and Azure Key Vault .
309
309
310
310
Local Master Key
311
311
~~~~~~~~~~~~~~~~
@@ -324,15 +324,15 @@ Run the following code to generate a local master key using Ruby:
324
324
local_master_key = SecureRandom.random_bytes(96)
325
325
# => "\xB2\xBE\x8EN\xD4\x14\xC2\x13\xC3..." (a binary blob)
326
326
327
- AWS Master Key
328
- ~~~~~~~~~~~~~~
329
- It is recommended that you use Amazon's Key Management Service to create and
330
- store your master key. To do so, follow steps 1 and 2 of the
331
- :drivers:`"Convert to a Remote Master Key" section</security/client-side-field-level-encryption-local-key-to-kms/#convert-to -a-remote-master-key>`
327
+ Remote Master Key
328
+ ~~~~~~~~~~~~~~~~~
329
+ It is recommended that you use a remote Key Management Service to create and
330
+ store your master key. To do so, follow steps of the
331
+ :drivers:`"Set up a Remote Master Key" section</security/client-side-field-level-encryption-local-key-to-kms/#set-up -a-remote-master-key>`
332
332
in the MongoDB Client-Side Encryption documentation.
333
333
334
334
For more information about creating a master key, see the
335
- :drivers:`Create a Master Key </security/client-side-field-level-encryption-guide/#a-create-a-master-key>`
335
+ :drivers:`Create a Master Key </security/client-side-field-level-encryption-guide/#a. -create-a-master-key>`
336
336
section of the MongoDB manual.
337
337
338
338
Creating a Data Key
@@ -379,14 +379,19 @@ key with the following code snippet:
379
379
See the `Local Master Key`_ section for more information about generating a new
380
380
local master key.
381
381
382
- Create a Data Key Using an AWS Master Key
382
+ Create a Data Key Using a Remote Master Key
383
383
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384
384
385
- If you have created an AWS master key, note the access key ID and the secret access
385
+ If you have created an AWS KMS master key, note the access key ID and the secret access
386
386
key of the IAM user that has permissions to use the key. Additionally, note
387
387
the AWS region and the Amazon Resource Number (ARN) of your master key. You will
388
388
use that information to generate a data key.
389
389
390
+ If you have created an Azure master key, note the tenant id, the client id, and
391
+ the client secret of the application that has permissions to use the key.
392
+ Additionally, note the key name, key version (id any), and key vault endpoint
393
+ for your master key. You will use that information to generate a data key.
394
+
390
395
.. code-block:: ruby
391
396
392
397
# A Mongo::Client instance that will be used to connect to the key vault
@@ -402,11 +407,16 @@ use that information to generate a data key.
402
407
aws: {
403
408
access_key_id: 'IAM-ACCESS-KEY-ID',
404
409
secret_access_key: 'IAM-SECRET-ACCESS-KEY'
410
+ },
411
+ azure: {
412
+ tenant_id: 'AZURE-TENANT-ID',
413
+ client_id: 'AZURE-CLIENT-ID',
414
+ client_secret: 'AZURE-CLIENT-SECRET'
405
415
}
406
416
}
407
417
)
408
418
409
- data_key_id = client_encryption.create_data_key(
419
+ aws_data_key_id = client_encryption.create_data_key(
410
420
'aws',
411
421
{
412
422
master_key: {
@@ -418,12 +428,24 @@ use that information to generate a data key.
418
428
)
419
429
# => <BSON::Binary... type=ciphertext...>
420
430
421
- See the `AWS Master Key`_ section of this tutorial for more information about
422
- generating a new master key on AWS and finding the information you need to
431
+ azure_data_key_id = client_encryption.create_data_key(
432
+ 'azure',
433
+ {
434
+ master_key: {
435
+ key_vault_endpoint: 'AZURE-KEY-VAULT-ENDPOINT',
436
+ key_name: 'AZURE-KEY-NAME'
437
+ }
438
+
439
+ }
440
+ )
441
+ # => <BSON::Binary... type=ciphertext...>
442
+
443
+ See the `Remote Master Key`_ section of this tutorial for more information about
444
+ generating a new remote master key and finding the information you need to
423
445
create data keys.
424
446
425
447
For more information about creating a data key, see the
426
- :drivers:`Create a Data Encryption Key </security/client-side-field-level-encryption-guide/#b-create-a-data-encryption-key>`
448
+ :drivers:`Create a Data Encryption Key </security/client-side-field-level-encryption-guide/#b. -create-a-data-encryption-key>`
427
449
section of the MongoDB manual.
428
450
429
451
Auto-Encryption Options
0 commit comments