MONGOC_CLIENT...CREATE_DATAKEY(3)
π MONGOC_CLIENT...CREATE_DATAKEY(3) π
okay so bestie, welcome to the libmongoc manual page for mongoc_client_encryption_create_datakey β yes that's a mouthful, no i will not be shortening it, it's iconic as is π
β¨ SYNOPSIS β¨
bool
mongoc_client_encryption_create_datakey (
mongoc_client_encryption_t *client_encryption,
const char *kms_provider,
const mongoc_client_encryption_datakey_opts_t *opts,
bson_value_t *keyid,
bson_error_t *error);
π¦ DESCRIPTION π¦
so this function literally creates a brand new key document in the key vault collection, and it sets keyid to the UUID of the newly created key β but only if keyid is not NULL, iykyk. π«Ά
the new key can be used to configure automatic encryption (peep mongoc_client_enable_auto_encryption() and mongoc_client_pool_enable_auto_encryption()) or for explicit encryption (see mongoc_client_encryption_encrypt()). both roads lead to slay. β¨
the created key document is inserted into the key vault collection β which you identify via mongoc_client_encryption_opts_set_keyvault_namespace() β and it goes in with majority write concern. no cap, majority. π
ok important thing bestie:keyidis always initialized (even on error). you, the caller, must callbson_value_destroy()onkeyidto free it. don't forget or it's giving memory leak energy π
πΈ PARAMETERS πΈ
client_encryptionβ amongoc_client_encryption_t. the main character of this whole operation πkms_providerβ a string identifying the Key Management Service (KMS) provider used to encrypt the datakey (e.g."aws"or"local"). pick your fighter. π§optsβ amongoc_client_encryption_datakey_opts_t. the options, obviously. β¨keyidβ optional. an uninitializedbson_value_tthat gets set to the UUID (BSON binary subtype0x04) of the newly created key. must be freed bybson_value_destroy(). yes. must. πerrorβ optional. abson_error_t. it'll catch the drama if something goes wrong π
β RETURNS β
returns true if successful. returns false and sets error otherwise. that's it, that's the vibe check. π
π SEE ALSO
mongoc_client_encryption_datakey_opts_t
π AUTHOR π
MongoDB, Inc β the legends themselves π
π COPYRIGHT π
2009-present, MongoDB, Inc.
ok that's the whole page bestie, go forth and create your datakeys fr fr π¦π
libmongoc version 2.5.6, dated Oct 09, 2026 β mwah, stan this manpage, periodt. π
β¨π
π¦ where this page comes from
- epel 10: mongo-c-driver-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms