@@ -50,6 +50,42 @@ 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 filter used to specify which keys to rotate. If no data key matches
66
+ the given filter, no keys will be rotated. Omit the filter to rotate
67
+ all keys in your key vault collection.
68
+
69
+ - An object that represents a new CMK. Omit this object to rotate
70
+ the data keys using their current CMKs.
71
+
72
+ The ``rewrapManyDataKey`` method has the following syntax:
73
+
74
+ .. code-block:: json
75
+
76
+ let keyVault = db.getMongo().getKeyVault()
77
+
78
+ keyVault.rewrapManyDataKey(
79
+ {
80
+ "<Your custom filter>"
81
+ },
82
+ {
83
+ provider: "<KMS provider>",
84
+ masterKey: {
85
+ "<dataKeyOpts Key>" : "<dataKeyOpts Value>"
86
+ }
87
+ }
88
+ )
53
89
Supported Key Management Services
54
90
---------------------------------
55
91
0 commit comments