MongoDB C++ Driver mongocxx-3.7.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
mongocxx::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 }
 Determines which AEAD_AES_256_CBC algorithm to use with HMAC_SHA_512 when encrypting data. More...
 

Public Member Functions

encryptkey_id (bsoncxx::types::bson_value::view_or_value key_id)
 Sets the key to use for this encryption operation.
 
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.
 
const stdx::optional< std::string > & key_alt_name () const
 Gets the current key alt name.
 
encryptalgorithm (encryption_algorithm algorithm)
 Sets the algorithm to use for encryption.
 
const stdx::optional< encryption_algorithm > & algorithm () const
 Gets the current algorithm.
 
const stdx::optional< bsoncxx::types::bson_value::view_or_value > & key_id () const
 Gets the key_id.
 

Friends

class mongocxx::client_encryption
 

Detailed Description

Class representing options for explicit client-side encryption.

Member Enumeration Documentation

◆ encryption_algorithm

enum class mongocxx::options::encrypt::encryption_algorithm : std::uint8_t
strong

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.

Member Function Documentation

◆ algorithm() [1/2]

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

Gets the current algorithm.

Returns
An optional algorithm.

◆ algorithm() [2/2]

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

Sets the algorithm to use for encryption.

Parameters
algorithmAn algorithm, either deterministic or random, to use for encryption.
See also
https://docs.mongodb.com/manual/core/security-client-side-encryption/#encryption-algorithms

◆ key_alt_name() [1/2]

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

Gets the current key alt name.

Returns
An optional key name.

◆ key_alt_name() [2/2]

encrypt & mongocxx::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://docs.mongodb.com/manual/reference/method/getClientEncryption/

◆ key_id() [1/2]

const stdx::optional< bsoncxx::types::bson_value::view_or_value > & mongocxx::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::options::encrypt::key_id ( bsoncxx::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://docs.mongodb.com/manual/core/security-client-side-encryption/

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