Skip to content

Commit 58eaaaf

Browse files
authored
DOCSP-26098 QE key rotation (#2304)
1 parent be47eb1 commit 58eaaaf

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

source/core/queryable-encryption/fundamentals/manage-keys.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,44 @@ To learn more about the relationship between keys, see
5050

5151
.. include:: /includes/queryable-encryption/qe-warning-remote-kms.rst
5252

53+
.. _qe-fundamentals-rotate-keys:
54+
55+
Rotate Encryption Keys Using ``mongosh``
56+
----------------------------------------
57+
58+
You can rotate encryption keys using the
59+
:method:`KeyVault.rewrapManyDataKey()` method. The ``rewrapManyDataKey``
60+
method automatically decrypts multiple data keys and re-encrypts them
61+
using a specified {+cmk-long+} (CMK). It then updates the rotated keys
62+
in the key vault collection. This method allows you to rotate encryption
63+
keys based on two optional arguments:
64+
65+
- A :ref:`query filter document <document-query-filter>` used to specify
66+
which keys to rotate. If no data key matches the given filter, no keys
67+
will be rotated. Omit the filter to rotate all keys in your key vault
68+
collection.
69+
70+
- An object that represents a new CMK. Omit this object to rotate
71+
the data keys using their current CMKs.
72+
73+
The ``rewrapManyDataKey`` method has the following syntax:
74+
75+
.. code-block:: json
76+
77+
let keyVault = db.getMongo().getKeyVault()
78+
79+
keyVault.rewrapManyDataKey(
80+
{
81+
"<Your custom filter>"
82+
},
83+
{
84+
provider: "<KMS provider>",
85+
masterKey: {
86+
"<dataKeyOpts Key>" : "<dataKeyOpts Value>"
87+
}
88+
}
89+
)
90+
5391
Supported Key Management Services
5492
---------------------------------
5593

0 commit comments

Comments
 (0)