---
name: "mongoc_client_encryption_datakey_opts_set_keymaterial"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_client_encryption_datakey_opts_set_keymaterial"
---

# mongoc\_client\_encryption\_datakey\_opts\_set\_keymaterial(3)

## SYNOPSIS

```
void
mongoc_client_encryption_datakey_opts_set_keymaterial (
   mongoc_client_encryption_datakey_opts_t *opts,
   const uint8_t *data,
   uint32_t len);
```

Sets the custom key material to be used by the data key for encryption and decryption.

## PARAMETERS

- •

  **opts**: A *mongoc\_client\_encryption\_datakey\_opts\_t*

- •

  **data**: A pointer to the bytes constituting the custom key material.

- •

  **len**: The length of the bytes constituting the custom key material.

## DESCRIPTION

Key material is used to encrypt and decrypt data. If custom key material is not provided, the key material for the new data key is generated from a cryptographically secure random device.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
