MONGOC_AUTO_EN...S_SET_TLS_OPTS(3)
π MONGOC_AUTO_EN...S_SET_TLS_OPTS(3) β like, the TLS options one
okay bestie, so this is a page straight out of libmongoc (that's the MongoDB C driver, iykyk) and it's all about one little function that hands your auto-encryption setup a whole BSON doc full of TLS config. slay. let's get into it β¨
β¨ SYNOPSIS β¨
void
mongoc_auto_encryption_opts_set_tls_opts (
mongoc_auto_encryption_opts_t *opts, const bson_t *tls_opts);
it returns void, so no exit-status drama here β it just does the thing and dips. π«Ά
π PARAMETERS π
optsβ themongoc_auto_encryption_opts_t. yeah. the auto encryption opts. the main character. πtls_optsβ abson_tthat maps a Key Management Service (KMS) provider to a BSON document stuffed with TLS options. that's the whole vibe check.
so tls_opts is a BSON document shaped exactly like this:
<KMS provider>: {
tlsCaFile: Optional<String>
tlsCertificateKeyFile: Optional<String>
tlsCertificateKeyFilePassword: Optional<String>
}
and the KMS providers that are supported as keys in the tls_opts document are aws, azure, gcp, and kmip. no cap. π¦
they can also carry an optional name suffix, separated with a colon. example: aws:name2. cute little nickname energy, honestly π
so yeah β tls_opts maps the KMS provider name to a BSON document for TLS options. that's the whole relationship, they're literally matched up.
the BSON document for TLS options may contain the following keys:
MONGOC_URI_TLSCERTIFICATEKEYFILEMONGOC_URI_TLSCERTIFICATEKEYFILEPASSWORDMONGOC_URI_TLSCAFILE
those are the three, exactly those three, don't go inventing a fourth one on me π
πΈ Example use πΈ
here's the iconic example, verbatim, no notes:
mongoc_auto_encryption_opts_t *ae_opts = mongoc_auto_encryption_opts_new();
bson_t *tls_opts = bson_new();
BCON_APPEND(tls_opts, "kmip", "{", MONGOC_URI_TLSCAFILE, "ca1.pem", "}");
BCON_APPEND(tls_opts, "aws", "{", MONGOC_URI_TLSCAFILE, "ca2.pem", "}");
mongoc_auto_encryption_opts_set_tls_opts(ae_opts, tls_opts);
see how it's done? kmip gets ca1.pem, aws gets ca2.pem, and then the whole thing gets yeeted into mongoc_auto_encryption_opts_set_tls_opts(). ate. π₯
for a description of the behavior of these options, go see Configuring TLS. that's where the actual behavioural tea is spilled β this page is just handing you the plumbing, fr fr.
β SEE ALSO: β
mongoc_client_enable_auto_encryption()- In-Use Encryption
those are your next stops, bestie, go read them, i'm literally begging π«Ά
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
and that's the whole page, mwah π. quick sign-off: this lil masterpiece is from libmongoc version 2.5.6, dated Oct 09, 202 β and yes the year is literally cut off mid-number in the footer, the manpage gremlins got hungry, don't @ me π. anyway slay, go encrypt something. π
π¦ 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