mongoc_client_encryption_encrypt()¶
Synopsis¶
bool
mongoc_client_encryption_encrypt (
mongoc_client_encryption_t *client_encryption,
const bson_value_t *value,
mongoc_client_encryption_encrypt_opts_t *opts,
bson_value_t *ciphertext,
bson_error_t *error);
Performs explicit encryption.
ciphertext
is always initialized (even on failure). Caller must call bson_value_destroy()
to free.
To insert or query with an “Indexed” or “RangePreview” encrypted payload, use a
mongoc_client_t configured with
mongoc_auto_encryption_opts_t. The
mongoc_auto_encryption_opts_t may be configured to bypass query
analysis with mongoc_auto_encryption_opts_set_bypass_query_analysis().
The mongoc_auto_encryption_opts_t must not be configured to bypass
automatic encryption with
mongoc_auto_encryption_opts_set_bypass_auto_encryption(). Note that
the "RangePreview"
payload type is part of the experimental
Queryable Encryption API and may be subject
to breaking changes in future releases.. The Range algorithm is experimental only and not intended for public use. It is subject to breaking changes.
To insert with a RangePreview
payload
mongoc_client_encryption_encrypt_range_opts_t must be set in opts
.
To query with a RangePreview
payload, use mongoc_client_encryption_encrypt_expression()
NOTE that the Range algorithm is experimental only and not intended for public use. It is subject to breaking changes.
Parameters¶
client_encryption
: A mongoc_client_encryption_tvalue
: The value to encrypt.opts
: A mongoc_client_encryption_encrypt_opts_t.ciphertext
: Abson_value_t
for the resulting ciphertext (a BSON binary with subtype 6).error
: Abson_error_t
set on failure.
Returns¶
Returns true
if successful. Returns false
and sets error
otherwise.