MongoDB C++ Driver mongocxx-3.11.0
Loading...
Searching...
No Matches
encrypt.hpp
Go to the documentation of this file.
1// Copyright 2009-present MongoDB, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <string>
18
21
23#include <bsoncxx/types.hpp>
25
27#include <mongocxx/stdx.hpp>
28
30
31namespace mongocxx {
32namespace v_noabi {
33namespace options {
34
38class encrypt {
39 public:
58 key_id(bsoncxx::v_noabi::types::bson_value::view_or_value key_id);
59
67 const stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>&)
68 key_id() const;
69
84
91 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<std::string>&) key_alt_name() const;
92
97 enum class encryption_algorithm : std::uint8_t {
102
106 k_random,
107
111 k_indexed,
112
117
121 k_range,
122 };
123
128 enum class encryption_query_type : std::uint8_t {
131
133 k_range,
134 };
135
153
163
173
181
191
199
204
212
213 private:
214 friend ::mongocxx::v_noabi::client_encryption;
215
216 void* convert() const;
217
219 stdx::optional<std::string> _key_alt_name;
221 stdx::optional<int64_t> _contention_factor;
224};
225
226} // namespace options
227} // namespace v_noabi
228} // namespace mongocxx
229
231
A polyfill for std::optional<T>.
Definition optional.hpp:874
Class representing options for explicit client-side encryption.
Definition encrypt.hpp:38
const stdx::optional< encryption_algorithm > & algorithm() const
Gets the current algorithm.
const stdx::optional< std::string > & key_alt_name() const
Gets the current key alt name.
const stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & key_id() const
Gets the key_id.
encrypt & algorithm(encryption_algorithm algorithm)
Sets the algorithm to use for encryption.
encrypt & query_type(encryption_query_type query_type)
Sets the query type to use for encryption.
const stdx::optional< encryption_query_type > & query_type() const
Gets the current query type.
encryption_query_type
queryType only applies when algorithm is "indexed" or "range". It is an error to set queryType when a...
Definition encrypt.hpp:128
encrypt & contention_factor(int64_t contention_factor)
Sets the contention factor to use for encryption. contentionFactor only applies when algorithm is "In...
encrypt & range_opts(options::range opts)
Sets the range options to use for encryption.
const stdx::optional< int64_t > & contention_factor() const
Gets the current contention factor.
encryption_algorithm
Determines which AEAD_AES_256_CBC algorithm to use with HMAC_SHA_512 when encrypting data.
Definition encrypt.hpp:97
const stdx::optional< options::range > & range_opts() const
Gets the current range options.
RangeOpts specifies index options for a Queryable Encryption field supporting "range" queries.
Definition range.hpp:42
Declares mongocxx::v_noabi::client_encryption.
Declares mongocxx::v_noabi::options::encrypt.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition fwd.hpp:222
The mongocxx macro guard postlude header.
The mongocxx macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
The top-level namespace within which all mongocxx library entities are declared.
The top-level namespace reserved for the C++ standard library.
Provides std::optional-related polyfills for library API usage.
Provides mongocxx::v_noabi::options::range.
Redeclares bsoncxx::v_noabi::stdx in mongocxx::v_noabi::stdx for internal use.
Provides bsoncxx::v_noabi::types::bson_value::view_or_value.
Provides entities used to represent BSON types.