MongoDB C++ Driver  mongocxx-3.10.2
Public Types | Public Member Functions | List of all members
mongocxx::v_noabi::options::encrypt Class Reference

Class representing options for explicit client-side encryption. More...

#include <encrypt.hpp>

Public Types

enum class  encryption_algorithm : std::uint8_t {
  k_deterministic , k_random , k_indexed , k_unindexed ,
  k_range_preview
}
 Determines which AEAD_AES_256_CBC algorithm to use with HMAC_SHA_512 when encrypting data. More...
 
enum class  encryption_query_type : std::uint8_t { k_equality , k_range_preview }
 queryType only applies when algorithm is "indexed" or "rangePreview". More...
 

Public Member Functions

encryptkey_id (bsoncxx::v_noabi::types::bson_value::view_or_value key_id)
 Sets the key to use for this encryption operation. More...
 
const stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & key_id () const
 Gets the key_id. More...
 
encryptkey_alt_name (std::string name)
 Sets a name by which to lookup a key from the key vault collection to use for this encryption operation. More...
 
const stdx::optional< std::string > & key_alt_name () const
 Gets the current key alt name. More...
 
encryptalgorithm (encryption_algorithm algorithm)
 Sets the algorithm to use for encryption. More...
 
const stdx::optional< encryption_algorithm > & algorithm () const
 Gets the current algorithm. More...
 
encryptcontention_factor (int64_t contention_factor)
 Sets the contention factor to use for encryption. More...
 
const stdx::optional< int64_t > & contention_factor () const
 Gets the current contention factor. More...
 
encryptquery_type (encryption_query_type query_type)
 Sets the query type to use for encryption. More...
 
const stdx::optional< encryption_query_type > & query_type () const
 Gets the current query type. More...
 
encryptrange_opts (options::range opts)
 Sets the range options to use for encryption. More...
 
const stdx::optional< options::range > & range_opts () const
 Gets the current range options. More...
 

Detailed Description

Class representing options for explicit client-side encryption.

Member Enumeration Documentation

◆ encryption_algorithm

Determines which AEAD_AES_256_CBC algorithm to use with HMAC_SHA_512 when encrypting data.

Enumerator
k_deterministic 

Use deterministic encryption.

k_random 

Use randomized encryption.

k_indexed 

Use indexed encryption.

k_unindexed 

Use unindexed encryption.

k_range_preview 

Use range encryption.

Warning
The Range algorithm is experimental only. It is not intended for public use. It is subject to breaking changes.

◆ encryption_query_type

queryType only applies when algorithm is "indexed" or "rangePreview".

It is an error to set queryType when algorithm is not "indexed" or "rangePreview".

Enumerator
k_equality 

Use query type "equality".

k_range_preview 

Use query type "rangePreview".

Warning
The Range algorithm is experimental only. It is not intended for public use. It is subject to breaking changes.

Member Function Documentation

◆ algorithm() [1/2]

const stdx::optional<encryption_algorithm>& mongocxx::v_noabi::options::encrypt::algorithm ( ) const

Gets the current algorithm.

Indexed and Unindexed are used for Queryable Encryption.

Returns
An optional algorithm.

◆ algorithm() [2/2]

encrypt& mongocxx::v_noabi::options::encrypt::algorithm ( encryption_algorithm  algorithm)

Sets the algorithm to use for encryption.

Indexed and Unindexed are used for Queryable Encryption.

Parameters
algorithmAn algorithm, either deterministic, random, indexed, or unindexed to use for encryption.
Note
To insert or query with an indexed encrypted payload, use a mongocxx::v_noabi::client configured with mongocxx::v_noabi::options::auto_encryption. mongocxx::v_noabi::options::auto_encryption::bypass_query_analysis may be true. mongocxx::v_noabi::options::auto_encryption::bypass_auto_encryption must be false.
See also
https://www.mongodb.com/docs/manual/core/security-client-side-encryption/#encryption-algorithms

◆ contention_factor() [1/2]

const stdx::optional<int64_t>& mongocxx::v_noabi::options::encrypt::contention_factor ( ) const

Gets the current contention factor.

Returns
An optional contention factor.

◆ contention_factor() [2/2]

encrypt& mongocxx::v_noabi::options::encrypt::contention_factor ( int64_t  contention_factor)

Sets the contention factor to use for encryption.

contentionFactor only applies when algorithm is "Indexed" or "RangePreview". It is an error to set contentionFactor when algorithm is not "Indexed".

Parameters
contention_factorAn integer specifiying the desired contention factor.

◆ key_alt_name() [1/2]

const stdx::optional<std::string>& mongocxx::v_noabi::options::encrypt::key_alt_name ( ) const

Gets the current key alt name.

Returns
An optional key name.

◆ key_alt_name() [2/2]

encrypt& mongocxx::v_noabi::options::encrypt::key_alt_name ( std::string  name)

Sets a name by which to lookup a key from the key vault collection to use for this encryption operation.

A key alt name can be used instead of a key id.

Parameters
nameThe name of the key to use for encryption.
Returns
A reference to this obejct to facilitate method chaining.
See also
https://www.mongodb.com/docs/manual/reference/method/getClientEncryption/

◆ key_id() [1/2]

const stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>& mongocxx::v_noabi::options::encrypt::key_id ( ) const

Gets the key_id.

Returns
An optional owning bson_value containing the key_id.

◆ key_id() [2/2]

encrypt& mongocxx::v_noabi::options::encrypt::key_id ( bsoncxx::v_noabi::types::bson_value::view_or_value  key_id)

Sets the key to use for this encryption operation.

A key id can be used instead of a key alt name.

If a non-owning bson_value::view is passed in as the key_id, the object that owns key_id's memory must outlive this object.

Parameters
key_idThe id of the key to use for encryption, as a bson_value containing a UUID (BSON binary subtype 4).
Returns
A reference to this object to facilitate method chaining.
See also
https://www.mongodb.com/docs/manual/core/security-client-side-encryption/

◆ query_type() [1/2]

const stdx::optional<encryption_query_type>& mongocxx::v_noabi::options::encrypt::query_type ( ) const

Gets the current query type.

Returns
A query type.

◆ query_type() [2/2]

encrypt& mongocxx::v_noabi::options::encrypt::query_type ( encryption_query_type  query_type)

Sets the query type to use for encryption.

Parameters
query_typeOne of the following: - equality query_type only applies when algorithm is "Indexed" or "RangePreview". It is an error to set query_type when algorithm is not "Indexed" or "RangePreview".

◆ range_opts() [1/2]

const stdx::optional<options::range>& mongocxx::v_noabi::options::encrypt::range_opts ( ) const

Gets the current range options.

Returns
An optional range options.
Warning
Queryable Encryption is in Public Technical Preview. Queryable Encryption should not be used in production and is subject to backwards breaking changes.
The Range algorithm is experimental only. It is not intended for public use. It is subject to breaking changes.

◆ range_opts() [2/2]

encrypt& mongocxx::v_noabi::options::encrypt::range_opts ( options::range  opts)

Sets the range options to use for encryption.

Warning
Queryable Encryption is in Public Technical Preview. Queryable Encryption should not be used in production and is subject to backwards breaking changes.
The Range algorithm is experimental only. It is not intended for public use. It is subject to breaking changes.

The documentation for this class was generated from the following file: