@@ -50,6 +50,44 @@ To learn more about the relationship between keys, see
50
50
51
51
.. include:: /includes/queryable-encryption/qe-warning-remote-kms.rst
52
52
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
+
53
91
Supported Key Management Services
54
92
---------------------------------
55
93
0 commit comments