php8.5
Home/ Manual/ driver / clientencryption/ MongoDB\Driver\ClientEncryption::rewrapManyDataKey

MongoDB\Driver\ClientEncryption::rewrapManyDataKey

PHP function Edit on GitHub ✎

(mongodb >=1.15.0)

Rewraps data keys

Description

MongoDB\Driver\ClientEncryption::rewrapManyDataKey(array|object $filter, array|null $options = null): object

Rewraps (i.e. decrypts and re-encrypts) zero or more data keys in the key vault collection that match the given filter.

If the "provider" option is not specified, matching data keys will be rewrapped with their current KMS provider. Otherwise, matching data keys will be re-encrypted according to the specified "provider" and "masterKey" options.

Parameters

options
OptionTypeDescription
providerstringThe KMS provider (e.g. "local", "aws") that will be used to re-encrypt the matched data keys.If a KMS provider is not specified, matched data keys will be re-encrypted with their current KMS provider.
masterKeyarrayThe masterKey identifies a KMS-specific key used to encrypt the new data key. This option should not be specified without the "provider" option. This option is required if "provider" is specified and not "local". MasterKey-options-by-provider

Return Values

Returns an object, which will have an optional bulkWriteResult property containing the result of the internal bulkWrite operation as an object. If no data keys matched the filter or the write was unacknowledged, the bulkWriteResult property will be null.

Errors/Exceptions

  • Throws MongoDB\Driver\Exception\EncryptionException if an error occurs while decrypting or re-encrypting a data key.
  • Throws MongoDB\Driver\Exception\RuntimeException on other errors.

Changelog

VersionDescription
PECL mongodb 1.20.0Added "delegated" to the KMIP provider masterKey options.

Source: reference/mongodb/mongodb/driver/clientencryption/rewrapmanydatakey.xml · from the official PHP manual (php/doc-en)