pub unsafe extern "C" fn mongocrypt_ctx_explicit_encrypt_init(
ctx: *mut mongocrypt_ctx_t,
msg: *mut mongocrypt_binary_t,
) -> bool
Expand description
Explicit helper method to encrypt a single BSON object. Contexts created for explicit encryption will not go through mongocryptd.
To specify a key_id, algorithm, or iv to use, please use the corresponding mongocrypt_setopt methods before calling this.
This method expects the passed-in BSON to be of the form: { “v” : BSON value to encrypt }
The value of “v” is expected to be the BSON value passed to a driver ClientEncryption.encrypt helper.
Associated options for FLE 1:
- @ref mongocrypt_ctx_setopt_key_id
- @ref mongocrypt_ctx_setopt_key_alt_name
- @ref mongocrypt_ctx_setopt_algorithm
Associated options for Queryable Encryption:
- @ref mongocrypt_ctx_setopt_key_id
- @ref mongocrypt_ctx_setopt_index_key_id
- @ref mongocrypt_ctx_setopt_contention_factor
- @ref mongocrypt_ctx_setopt_query_type
- @ref mongocrypt_ctx_setopt_algorithm_range
An error is returned if FLE 1 and Queryable Encryption incompatible options are set.
@param[in] ctx A @ref mongocrypt_ctx_t. @param[in] msg A @ref mongocrypt_binary_t the plaintext BSON value. The viewed data is copied. It is valid to destroy @p msg with @ref mongocrypt_binary_destroy immediately after. @returns A boolean indicating success. If false, an error status is set. Retrieve it with @ref mongocrypt_ctx_status