MONGOC_CLIENT..._SET_MASTERKEY(3)
π MONGOC_CLIENT..._SET_MASTERKEY(3) π
okay bestie, buckle up β this one's from the libmongoc manual, and it's all about telling your encryption setup which master key to use. it's giving "key management but make it cute" π
β¨ SYNOPSIS β¨
void
mongoc_client_encryption_datakey_opts_set_masterkey (
mongoc_client_encryption_datakey_opts_t *opts, const bson_t *masterkey);
so like, what does it even do? it identifies the masterkey for the Key Management Service (KMS) provider that's gonna encrypt a brand new data key. that's the whole vibe. π«Ά
π PARAMETERS π
optsβ amongoc_client_encryption_datakey_opts_t. yes, that whole mouthful. it's the options struct you're poking at πmasterkeyβ abson_tdocument describing the masterkey, and it's specific to whatever KMS provider you're rolling with.
π¦ DESCRIPTION π¦
okay so here's the tea β β setting the masterkey is required when you're creating a data key with these KMS provider types: aws, azure, gcp, and kmip. no masterkey, no data key, no cap.
but!! setting the masterkey is prohibited with the KMS provider type local. so don't even try it, bestie π
π the aws format π
the format of masterkey for the KMS provider type aws is literally this:
{
region: String,
key: String, /* The Amazon Resource Name (ARN) to the AWS customer master key (CMK). */
endpoint: Optional<String> /* An alternate host identifier to send KMS requests to. May include port number. Defaults to "kms.<region>.amazonaws.com" */
}
πΈ the azure format πΈ
the format of masterkey for the KMS provider type azure is as follows:
{
keyVaultEndpoint: String, /* Host with optional port. Example: "example.vault.azure.net". */
keyName: String,
keyVersion: Optional<String> /* A specific version of the named key, defaults to using the key's primary version. */
}
β the gcp format β
the format of masterkey for the KMS provider type gcp is as follows:
{
projectId: String,
location: String,
keyRing: String,
keyName: String,
keyVersion: Optional<String>, /* A specific version of the named key, defaults to using the key's primary version. */
endpoint: Optional<String> /* Host with optional port. Defaults to "cloudkms.googleapis.com". */
}
π§ the kmip format π§
the format of masterkey for the KMS provider type kmip is as follows:
{
keyId: Optional<String>,
delegated: Optional<Boolean>, /* If true (recommended), the KMIP server must decrypt this key. Defaults to false. */
endpoint: Optional<String> /* Host with optional port. */
}
π‘ quick vibe check: those Optional<...> fields are optional, and the defaults are written right there in the comments β don't come for me, it's all in the original, iykyk.
π AUTHOR π
MongoDB, Inc β icons only π
π₯ COPYRIGHT π₯
2009-present, MongoDB, Inc.
and that's the whole page, bestie π she's iconic, she's thorough, and she ate. this was libmongoc 2.5.6, dated Oct 09, 2026 β mwah π slay, go set some masterkeys β¨
π¦ 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